attribute: Phillie Casablanca

Category link listing complete

Well, I think my category list solution has arrived.

For awhile there I thought I would have to stop using generic views and write a view to handle passing the data to the template. But actually it turned out to be pretty easy. Basically, I'm just not familar with the terms used in django, otherwise I may have figured out this earlier.

The orginal tutorial I ran through wasn't the django one so it left out some key structural explanations.
Now I think I've got it.

You define a urlpattern to handle incoming request and direct them to views. The views job is to render the template and provide a response.

The template variable is called context. Which is the part I overlooked.
Re-reading the generic views documentation I noticed that "django.views.generic.date_based.archive_index" has an optional argument, "extra_context". This option allows you to pass additional data to the template.

Then by reviewing the filtering documentation I was able to send the data I wanted to the template, and heres the added info in the file:

{'queryset': Post.objects.all(),
'date_field': 'date',


I'm understanding django more clearly now as I continue to hack away.
I don't yet feel like I'm programming yet though, it just feels like I'm configuring and tweaking settings.

monkut // June 12, 2008 // 11:33 a.m.