Thanks Alex, thats a good idea.

But I want to have a more generic solution for this problem. There
must be an other way than to write custom template tags. I think the
passing-default-request-parameters approach is the solution, but I
dont know how and where to realize it elegant.

Toni



On 11 Mai, 09:15, Alex Morega <[EMAIL PROTECTED]> wrote:
> On May 11, 2008, at 09:58 , mwebs wrote:
>
>
>
>
>
> > In my application I need to build a dynamic menu. For this purpose I
> > have to pass a dict that contains the menu-entries that will be
> > displayed at my index.html
>
> > The not elegant way to do this, is to pass  the menu-entries in every
> > view-function. What I want to do is to pass these menu-entries per
> > default (when a certain url is requestes), so that I dont have to do
> > this in every tiny view-function.
>
> > I have had several ideas to do this (but I did not succed yet):
>
> > 1) urls.py
> >      invoking a method that inserts the default values in the
> > request. (Here I had errors when inserting the method in
> >      the urls.py)
>
> > 2) middleware: writing a middleware-class that can do these "per-
> > request default-jobs"
>
> > Does anyone has an idea how to do this in an elegant way?
>
> Create a custom templatetag that renders the menu; the templatetag
> should be able to figure out the menu contents for itself (if the menu
> is variable, pass a parameter to the tag from the template). You could
> include this tag in your base template if you have one.
>
> Cheers,
> -- Alex
--~--~---------~--~----~------------~-------~--~----~
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