Hello,

I'm trying to extend django.views.generic.date_based (specifically
object_detail). The goal is to make it return more context variables
(is that how they are called?) then it is supposed to return.

In fact by default it only returns "object" (or the
template_object_name name you pass), but I need it to return "year",
"month" and "day" too. This is because in my *_detail.html template
I'd have to keep on formatting object.pubdate over and over again to
achieve a simple "breadcrumbs" and this is obviously boring other than
not DRY at all ;)

So: what I did was to get the object_detail code from
django.views.generic.date_based and stick it in my myapp.views and
have urlconf to point at it. myapp.views.object_detail is identical to
the original beside for this portion:

c = RequestContext(request, {
        template_object_name: obj,
        'year': year,
        'month': month,
        'day': day,
}, context_processors)

Where I'm passing year, month, day.

However I kinda have the feeling there is a more elegant way to extend
a generic view like this, but I can't seem to find much on the
subject. What I want to do is not to do any special operation (like
formatting the object.date) in order to pass those vars since they are
already in use in the object_detail view, it'd be just a waste.

Can anyone throw me some tip, if any? (I'm ok with sticking to my
slightly modified object_detail view if this can't be done in any
other way)
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to