How to catch Django DoesNotExist exception
December 25, 2009 03:23:36 Last update: December 25, 2009 03:23:51
Suppose
User is the model class, this is the code to catch DoesNotExist:
>>> try: ... u = User.objects.get(name='Django Reinhardt') ... except User.DoesNotExist: ... print 'Not found!' ... Not found! >>>
Easy email testing with http://www.ximailstop.com