On Tue, Sep 7, 2010 at 8:55 PM, Goran <thego...@gmail.com> 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
Hi, whats about extending? for example base.html? Could this be a way to solve your problem? http://stackoverflow.com/questions/671369/django-specifying-a-base-template-by-directory A live example and pretty cool explanation can be seen in this screencast(s): http://showmedo.com/videotutorials/series?name=PPN7NA155 (The mentioned project is not available anymore but the principles are pretty clear explained. I think extending is shown in episode 3.) good luck TR > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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. > > -- --- http://thoreg.org --- -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.