Sunday, April 22, 2012

Adding context data to a TemplateView?

I'm using a generic TemplateView (django-1.4), but I want to be able to add something to the context.  Is that possible?

The docs at https://docs.djangoproject.com/en/1.4/topics/generic-views/#adding-extra-context talk about "an extra optional parameter, extra_context", but I don't get what they're trying to explain.  I tried the obvious:

    url(r'^about$',
    TemplateView.as_view(template_name='legal_ipsum/about.html',
                         extra_context={'pagename': 'about'})
        ),

in my urls.py file, but that just raises: "TemplateView() received an invalid keyword 'extra_context'".  What am I missing here?

--
Roy Smith



0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate