#2430: QuerySet should be evaluated when used in boolean tests
------------------------------+---------------------------------------------
Reporter: ubernostrum | Owner: mtredinnick
Type: defect | Status: new
Priority: normal | Milestone:
Component: Database wrapper | Version: SVN
Severity: normal | Keywords:
------------------------------+---------------------------------------------
Currently, a QuerySet is not evaluated when being used in boolean contexts
(e.g., doing `if SomeModel.objects.all():`); this leads to
counterintuitive behavior, because it will always resolve to a True value
regardless of whether it would return any objects when "actually"
evaluated.
Adding a `__nonzero__` method to QuerySet which does the evaluation would
solve this.
--
Ticket URL: <http://code.djangoproject.com/ticket/2430>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---