Chris Withers kirjoitti:
> Brian McKeever wrote:
>> .count is definitely the way to go. Although, I would probably pass it
>> to your template instead of determining it there.
> 
> What difference does it make?

len(qs) evaluates queryset - thus pulling in _every_ object from DB to 
Python - which you might not want specially if queryset is large.

.count() executes count query on DB side returing only single scalar 
value to Python.

Figure out which one is faster...

-- 
Jani Tiainen

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

Reply via email to