How to avoid duplicating context-setting-up procedure when using base template?
One way I can think of is to use a decorator that provides extra context variables to each view's result.
When using jinja2, base "skeleton" template are often extended by many other templates.
One of my base templates require certain variables in the context, and everywhere I use this base template I have to duplicate the setting up procedure.
For example, I may need to read some category names from DB and render them as a list in the header, now I have to write this query everywhere I use the base template.
What are some good way to avoid duplicating these kind of code when using jinja2?