Rob Hudson wrote:
>def list(request):
> """
> Sets up a list of tuples: (month, list of events)
> [("March", [<event object>, <event object>]), ("April", [<>])]
> """
>
>
Malcolm has answered your question but I want to add that with Django
templates you can do this thing much simpler without two nested loops.
All you have to do is to give events list into a template:
def list(request):
return render_to_response(
'events/index.html',
{'events_list': Events.objects.order_by('date_from').all()})
And let the template tag {% ifchanged %} output month names:
{% for event in event_list %}
{% ifchanged %}
{{ event.date_from|date:"F" }}
{% endifchanged %}
<b>{{ event.date_from }}</b>
{{ event.title }}<br>
{{ event.body }}
{% endfor %}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---