[Answer]-In Django, how can I access a parameter in a template?

1👍

If you’re using django.shortcuts.render that should work. The problem you might have could be some ContextManager overriding that 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. You could use Django Debug Toolbar to see what variables are set in the context.

Leave a comment