You can use your own template for flatpages, see
http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/?from=olddocs#flatpage-templates
Just make that menu a separate template and include it wherever you want. Of
course your flatpages template and your other templates can inherit from the
same base where the menu is included.

I  don't know what you mean by  "place
these variables ( db queries)"? Anyway if your menu is generated from a
database and it won't change often it's a good idea to wrap such template
code in a cache tag, especially if you make manny queries to generate that
menu.

On Tue, Sep 7, 2010 at 8:55 PM, Goran <[email protected]> wrote:

> I'm Django novice and I want to have some menu (top menu) which have
> some dynamically populated items. So inside home page view I have some
> variables to get these menu items. But because it's top menu I need it
> on every page on the site and i have about 20 views.  So I'm place
> these variables ( db queries) in every view on the site. It works
> except on the Flatpages because I can't find a way to extend Flatpage
> view with these variables. Now I have two questions:
>
> 1. How can I extend FlatPage view to get these menu variables on the
> flatpages.
> 2. Am I miss something? What's happen with D.R.Y. if I need to place
> the same variables on the every view and repeat myself 20 times?
>
> Any advice?
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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