Z
Z
zkweb2015-07-24 14:43:24
Django
zkweb, 2015-07-24 14:43:24

Why doesn't request.user.is_superuser work in Django?

I'm still learning Django. When I make a condition (for example: if self.request.user.is_superuser: ) then I immediately get an Error 500 error.
I work in the admin panel!
from django.contrib.auth.models import User - enabled
PS - please do not scold me, still a beginner)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pinkevich, 2015-07-24
@zkweb

In BookAdmin:

list_display = ('fio_klient', 'adres')
def get_list_display(self, request):
    if request.user.is_superuser:
        return self.list_display + ('status',)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question