On Tue, 2007-03-13 at 13:30 +0000, Michel Thadeu Sabchuk wrote:
> Hi guys!
> 
> I want to use generic views to show all events on a year. I made use
> of year_archive view to accomplish my task. I want to show up the
> events on the year page categorized by its month, there won't be a
> month page, but the object_list gives the events uncategorized.
> 
> I think on a filter, maybe "regroup" is what I'm looking for, but I
> don't realize how to use it with date fields. Does someone know how
> can I make this happen? Can the year_archive view hit my needs or
> should I write a custom view?

Have a look at the "ifchanged" template tag (it's a standard one in
Django). This allows you to control the displaying of a line based on
whether some value has changed since the last time you checked it.

In my blog software, for example, I have a section that says

        {% ifchanged %}
                <h1 class="day"><span>{{ entry.creation|date:"D, j M Y" 
}}</span></h1>
        {% endifchanged %}
        
inside the loop that displays the articles on a page.

This will only display the day and date header if it has changed from
the previous article (the previous time around the loop).

Regards,
Malcolm



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