Django Generic Views    Posted:


Working on setting up some generic views this evening, I ran into a problem that I'd run up against before. For some reason, I can't understand the very good documentation and always run up against the problem of referencing the queryset in the template.

The queryset is passed as 'queryset' in urls.py, but in the template it is not referenced as queryset, but some other name depending on the generic view.

In this evening's case, I was using the 'django.views.generic.date_based.archive_index' view, and couldn't figure out the name by which to reference my objects?!? After trying object_list, object, queryset, and any other name I could think of, I added the debug toolbar to the project at it kindly showed be the variable ('latest' in this case)


Of course now I see that it's rather clearly stated, but I always seem to skim over this important bit of info.
http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-...
see template_object_name and its default value

Hopefully this note will jar my memory next time, and maybe even help some one else :)

Comments

Ubuntu 9.10    Posted:


Ubuntu 9.10 comes out at the end of the month, and I've been testing it. It looks great, but unfortunately, it isn't working very well with my Intel video chip :( And that was supposed to be one of the improvements for this release...

Hopefully some one on the forum'll be able to help me fix it.

Comments

new blog    Posted:


testing the simplicity

Comments

Share