I just want to catch the exception thrown when the query returns nothing. Thanks, that seems to have done the trick.
[EMAIL PROTECTED] wrote: > I'm not sure where you got that code snippet from, but DoesNotExist is > an attribute on model classes, so that shoul read: > > except Tag.DoesNotExist. > > On Dec 8, 2:52 pm, Info Cascade <[EMAIL PROTECTED]> wrote: > >> How do I import the DoesNotExist exception? >> >> This doesn't seem to work:> from django.db.models.query import DoesNotExist >> >>> try: >>> tag = Tag.objects.get(name=cat_name) >>> except DoesNotExist: >>> # do something else >>> >> Doesn't DoesNotExist exist? >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---