17👍
✅
You want this Generic view:
class IniciView(ListView):
template_name = 'principal/inici.html'
model = Zona
are the context processors in settings?
This is more redeable:
{% if user.is_authenticated %}
<ul>
<li class="nivell1">
<a href="/accounts/logout/?next=/">Logout</a>
</li>
<li class="nivell1">
<a class="nivell1" herf="#"> Configuració </a>
</li>
{% if user.is_superuser %}
<li class="nivell1">
<a href="zona/crear/">Crear zona</a>
</li>
{% endif %}
</ul>
{% else %}
...
{% endif %}
I’ve changed {% if request.user.is_superuser %}
to {% if user.is_superuser %}
Source:stackexchange.com