On 14 Apr, 16:54, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> Why don't you use the extra_context parameter to generic views?  Or am I
> misunderstanding what you are trying to do?
>
> def myview(request):
>    context = dict()
>    context["my_custom_var"] = "wwgd"
>    return generic_view(request, extra_context = context, bla=blah,...)

I have just tried setting it up but it is returning a 404 when I try
to load the page (and it obviously works with date_based.object_detail
and/or my custom "entry_detail")

This is the view I tried to setup:

def myview(request, year, month, day, queryset, date_field,
month_format, slug, template_object_name):
        context = dict()
        context['year'] = year
        context['month'] = month
        context['day'] = day

        return date_based.object_detail(
                request, year, month, day, queryset, date_field, month_format, 
slug,
template_object_name, extra_context=context,
        )

As far as I understood your suggestion and the docs I found it should
work, shouldn't it?

The urlconf, beside the from ... import statements is the following:


entry_info_dict = {
        'queryset': Entry.live.all(),
        'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
        (r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[\w\d\-]
+)/$', myview, dict(entry_info_dict, month_format='%m',
template_object_name='entry')),
)

(I'm using django.views.generic.date_based there since it's needed by
the other patterns, I didn't include them since they are relevant --
however it won't work even if I snip it out)

--~--~---------~--~----~------------~-------~--~----~
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