Re: Problem building data structure for Archive page

2009-08-27 Thread Gijs Nijholt
That's exactly what I needed. Thanks a lot. -- Gijs On Aug 27, 4:31 pm, David Zhou wrote: > On Thu, Aug 27, 2009 at 10:10 AM, gnijholt wrote: > > Or is there a better way to generate a full archive page (per year, > > per month)? > > You'll need to test this, but you should be able to do that

Re: Problem building data structure for Archive page

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 10:10 AM, gnijholt wrote: > Or is there a better way to generate a full archive page (per year, > per month)? You'll need to test this, but you should be able to do that with {% ifchanged %}: #view: posts = Posts.objects.order_by('-pub_date') #template {% for post in po

Problem building data structure for Archive page

2009-08-27 Thread gnijholt
Hello Django-users, Actually it's more of a basic Python problem than a Django problem. I'll try to be brief: In the view, I'm looping through my posts as such: --- def archive(request): years = Post.objects.dates('pub_date', 'year') for year in years: print year.year mon