Re: Selecting related objects with condition

2011-02-01 Thread Martin Tiršel
Thanks, I didn't know the {% ifchanged %} tag. Martin On Mon, 31 Jan 2011 22:58:55 +0100, Michael wrote: The easiest way would be to get a list of all closed work items, ordered by user: context['work'] = Work.objects.filter(whatever).order_by('user') {% for work_item in work %}

Re: Selecting related objects with condition

2011-01-31 Thread Michael
The easiest way would be to get a list of all closed work items, ordered by user: context['work'] = Work.objects.filter(whatever).order_by('user') {% for work_item in work %} {% ifchanged %}Display {{work_item.user}}{% endifchanged %} Display {{ work_item }} {% endfor %} -- Mich

Selecting related objects with condition

2011-01-31 Thread Martin Tiršel
Hello, I have a model: class Work(models.Model): ... user = models.ForeignKey( User ) closed = models.DateTimeField( blank=True ) ... Now, I want to print all users and for each user all Works closed between a specific date. If I don't need the "closed