Thank you Nikolas. Works perfect :)
On Wednesday, June 20, 2012 11:21:28 PM UTC+1, Nikolas Stevenson-Molnar
wrote:
>
> First, order by date in your query:
>
> events = Event.objects.order_by('date')
>
> Then in your template, use the ifchanged tag (
> https://docs.djangoproject.com/en/1.4/ref/te
First, order by date in your query:
events = Event.objects.order_by('date')
Then in your template, use the ifchanged tag
(https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#ifchanged):
{% for event in events %}
{% ifchanged event.date.month event.date.year %}
month here
Hi,
I am trying to output upcoming events in the following format
*June 2012*
12th - Event 1
15th - Event 2
*July 2012*
1st - Event 3
*August 2012*
20th - Event 4
My model is very simple with just a title and dateTime field. I am unsure
how i could output the months followed by the events in
3 matches
Mail list logo