On Mon, Apr 5, 2010 at 11:33 AM, zweb <traderash...@gmail.com> wrote: > after some debugging, just found out that > filter method does not throw DoesNotExist while get does.
get() returns a single object. If a single object does not exist, you get a DoesNotExist exception. This is documented: http://docs.djangoproject.com/en/dev/ref/models/querysets/#id5 filter() applies a filtering condition to return a QuerySet of objects that match the filter. If no objects match the filter, the queryset can be empty. The result exists - it just doesn't contain anything (e.g., the set of "all people that are 4m tall" exists, but has no members). This is also documented: http://docs.djangoproject.com/en/dev/ref/models/querysets/#filter-kwargs Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.