[clug] dynamic inserts with django templates?

jm jeffm at ghostgun.com
Tue Dec 14 19:09:09 MST 2010


Only after a high level explaination here as I'm just reading up on 
django as a potential solution for something. Say that you have a page 
with this layout:


+-----------------------------+
|         header              |
+-----------------------------+
|         navbar              |
+-------+---------------------+
| menu  |        main content |
|       |                     |
|       |                     |
+-------+---------------------+
|        footer               |
+-----------------------------+


The header is fixed, the navbar changes depending on whether your logged 
in and who's logged in, the menu changes depending on the context, and 
the footer changes to show the date and time the page was generated.

If the main content is generated by the controller and the decoration 
(header, footer, navbar, and menu) are common to most pages so you place 
them in an inherited template. How do you generate the variables to be 
used by the decoration? You don't what to repeat yourself by adding it 
to all the actions in each controller.

Jeff.





More information about the linux mailing list