Hi all,
most generic views from date_based accept a template_object_name keyword arg,
except the archive_index, instead the latest object_list is created in the
RequestContext.
I would suggest to apply the attached patch, to make keyword arg
template_object_name available with respect to the other generic views.
As nothing should break current behavior template_object_name is given as None
the normal latest object_list will be generated in RequestContext, but if
template_object_name is set instead of latest the '<template_object_name>_list'
is generated.
As times go by latest could be deprecated and template_object_name could be set
to 'object' as default.
Regards,
Dirk
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---
Index: django/views/generic/date_based.py
===================================================================
--- django/views/generic/date_based.py (Revision 3706)
+++ django/views/generic/date_based.py (Arbeitskopie)
@@ -8,7 +8,7 @@
def archive_index(request, queryset, date_field, num_latest=15,
template_name=None, template_loader=loader,
extra_context=None, allow_empty=False, context_processors=None,
- mimetype=None, allow_future=False):
+ mimetype=None, allow_future=False, template_object_name=None):
"""
Generic top-level archive of date-based objects.
@@ -35,9 +35,10 @@
if not template_name:
template_name = "%s/%s_archive.html" % (model._meta.app_label, model._meta.object_name.lower())
t = template_loader.get_template(template_name)
+ latest_var_name = (template_object_name and ('%s_list' % template_object_name)) or 'latest'
c = RequestContext(request, {
'date_list' : date_list,
- 'latest' : latest,
+ latest_var_name : latest,
}, context_processors)
for key, value in extra_context.items():
if callable(value):