Yes, instead of returning all the records and counting them in python you would be using your databases COUNT() funciton.
On Mar 27, 10:33 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > On Mar 27, 3:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Well, books can be redefined as: > > > def books(self): > > progs = self.programs.all() > > return sum([prog.publications.all().filter(type=u'Book').count() > > for prog in progs]) > > > and likewise for the other methods. > > Nice. Would this also be faster? > > Thanks, > > Rodrigo --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---