How to set variables in a basic template in django?

I have a base.html template and some templates for children. I do not know how to set variables for base.html

for example, if I have one {% for u in users %}{% endfor %}, where can I assign it to users? is there any parent view for all views?

+3
source share
2 answers

If you want certain variables to be available in all templates, you could write a template context processor ( docs ) and always use it RequestContextwhen rendering templates.

+2
source

. , .

Django .

0

Source: https://habr.com/ru/post/1739378/


All Articles