A
A
Artyom2018-02-06 10:40:21
Django
Artyom, 2018-02-06 10:40:21

The variable is not passed to the html template. What to do?

def site(request):
               name='Name'
               return render(request, 'site/index.html',locals())

..
<h1>{{name}}</h1>
..

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2018-02-06
@sergey-gornostaev

Be more attentive. The function is called local s ()

R
Roman Kitaev, 2018-02-06
@deliro

locals in general
Also it is not necessary to do so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question