In Django, how can I access a parameter in a template? -
from view i'm doing following:
return render(request, 'yabe/login.html', {'error': true})
in template i'm trying
{% if error %} <div class="error">authentication error. please try again</div> {% endif %}
but it's not working
if you're using django.shortcuts.render
should work. problem might have contextmanager overriding context variable. try this:
your view:
from django.shortcuts import render def your_view(request): ... return render(request, 'yabe/login.html', {'errorusedjusthere': true})
your template:
{% if errorusedjusthere %} <div class="error">authentication error. please try again</div> {% endif %}
extra. use django debug toolbar see variables set in context.
Comments
Post a Comment