Django verifique si el usuario es administrador
{% if user.is_superuser %}
<p>Hello, admin.</p>
{% else %}
<p>Hello, ordinary visitor.</p>
{% endif %}
Torrin worx
{% if user.is_superuser %}
<p>Hello, admin.</p>
{% else %}
<p>Hello, ordinary visitor.</p>
{% endif %}
user.is_superuser
from django.conf import settings
from django.shortcuts import redirect
def my_view(request):
if not request.user.is_authenticated:
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
# ...