Answer the question
In order to leave comments, you need to log in
How to pass context to include in all Django Python pages?
Greetings. I have an HTML wrapper that other templates inherit from.
<html>
<head>
<title>Сайт на Python</title>
</head>
<body>
{% include 'includes/top_menu.html' with context=context %}
</body>
</html>
from .models import Page
def index(request):
context={'pages': Page.objects()}
return render(request, 'shablon.html', context=context)
def feedback(request):
context={'pages': Page.objects()}
return render(request, 'shablon2.html', context=context)
def help(request):
context={'pages': Page.objects()}
return render(request, 'shablon3.html', context=context)
Answer the question
In order to leave comments, you need to log in
did you try that?
from .models import Page
context={'pages': Page.objects()}
def index(request):
return render(request, 'shablon.html', context)
def feedback(request):
return render(request, 'shablon2.html', context)
def help(request):
return render(request, 'shablon3.html', context)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question