On Nov 4, 4:14 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 11/4/07, Brot <[EMAIL PROTECTED]> wrote:[snip]
>
> To get the last event I use:
>
> > Event.objects.latest('date')
>
> > To get a list of EventPartners i use:
> > Event.objects.latest('date').eventpartner_set.all()
>
> > But how do I get a list of my Partners? I tried a few things, but I
> > didn't find a solution. I need the Partner-list, because I want to use
> > a template, which expect a Partner-list. It would also be possible to
> > write another template for a EventPartner-list, but that's a bad
> > solution.
>
> To extract a list of partners from a list of EventPartners, use a Python
> list comprehension:
>
> partner_list = [ep.partner for ep in Event.objects.latest
> ('date').eventpartner_set.all()]
>
> Karen

Ok, that works! But there is another problem now. I would like to sort
the list of partners.
The sort-criteria should be a field from the partner model. e.g: name
Is this possible?

Bernd


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to