Monday, November 28, 2011

Re: Boolean test on queryset

Jirka,

That doesn't solve the problem.  That will still do a very expensive count() operation on the queryset.  In fact, examples.count() is what happens when you do bool(examples) anyway.

Thanks,
Adam

On Mon, Nov 28, 2011 at 8:11 PM, Jirka Vejrazka <jirka.vejrazka@gmail.com> wrote:
Hi Adam,

 I tend to use:

 if examples.count():

   ...something...

 HTH

   Jirka

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment