Hi,

I'm just learning Django, and had a question with my first site.

To have a common layout for multiple pages (even those in different
applications / python code folders) on the site, I'm using template
inheritance.
But the base template uses a few variables, for example the name of
the logged in user and some of his settings. These need to be provided
as parameters from *every* view's render_to_response call that uses a
template inheriting from base.

How should I structure my code to access these in every view?
An idea I had was to:
* make a basehelper.py to go with the base.html template
* have a get_params(request) function there that returns a dict with
the base template parameters
* every view would use this and add its own values before passing it
to render_to_response.

But is there something more generic for this problem in Django?

Mattias

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to