views:

23

answers:

1

Hi!

It's newbie question, I think.

I want to iterate above two lists: first in for loop and second when some condition is true. How do it in django template ?

A: 

I'll try to do simple calendar.

Legend:
Events - lists with Event objects
month - calendar.Calendar().monthdatescalendar() lists with object timedate.date from python library

{% for week in month %}
    {% for day in week %}
         {% if day < Events.0.startdate.date %}
              print something like <a href = "{{ Events.0.get_absolute_url }}">{{ day }} </a>
              increase Events

         {% else %}
              {{ day }}
         {% endif %}
    {% endfor %}
 {% endfor %}
rafallo

related questions