On 3/19/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > Here's how I'd solve this particular problem: > > [c.get_poll() for c in choices.get_list(choice__exact='foo')] > > If you need to remove duplicates: > > dict([(c.get_poll(), 1) for c in > choices.get_list(choice__exact='foo')]).keys()
One thing I forgot to mention: I'd suggest adding the select_related=True argument to the choices.get_list() calls here. That way, calls to c.get_poll() won't cause a database lookup. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---