Oh, it's just a preference. I don't like calculating stuff in the template. It violates the MVT pattern to some minor degree.
On Sep 25, 6:41 am, Bryan <matthe...@gmail.com> wrote: > I can't think of a reason, if nothing else its a matter or taste/ > preference. He said "I would probably...", so he may have been > implying that there was a technical reason but most likely he was just > stating his preference. > > On Sep 25, 5:03 am, Chris Withers <ch...@simplistix.co.uk> wrote: > > > Jani Tiainen wrote: > > > 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... > > > Er, I was asking what the difference was between calling .count in the > > view and in the template. I can't think why it would make a difference, > > but Brian suggested it did... > > > Chris > > > -- > > Simplistix - Content Management, Batch Processing & Python Consulting > > -http://www.simplistix.co.uk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---