Hello seemant! On Thu, 05 Oct 2006 15:34:17 -0000 you wrote: > > Hi All, > > So, on the right column of http://www.djangoproject.com/weblog/ that > page, we see an index of archived posts, going back 12 months or so. > > And so I thought I'd check out the template: > http://code.djangoproject.com/browser/djangoproject.com/django_website/templates/base_weblog.html > > but the template (and adrian's commit message) seem to imply that that > list is generated manually. Is there no construct in Django that will > auto-gen a link list like that? > > Thanks!
I use that construction: http://www.djangoproject.com/documentation/templates/#regroup views.py ----------- months = Article.objects.dates('pub_date', 'month', 'DESC') dates = [{ 'year': m.year, 'month': m.month, 'count': Article.objects.filter(pub_date__year=m.year, pub_date__month=m.month) .count(), } for m in months] template --------- {% regroup dates by year as years %} <ul> {% for year in years %} <li><a href="{{ year.grouper }}">{{ year.grouper }}</a> <ul> {% for month in year.list %} <li><a href="/news/{{ year.grouper }}/{{ month.month|shortmonth }}/">{{ m onth.month|month }}</a> ({{ month.count }}) {% endfor %} </ul> {% endfor %} </ul> -- ÷ÓÅÇÏ ÎÁÉÌÕÞÛÅÇÏ! çÒÉÇÏÒÉÊ greg [at] anastasia [dot] ru ðÉÓØÍÏ ÏÔÐÒÁ×ÌÅÎÏ: 2006/10/05 19:55 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---