[Answered ]-Allow page access only for admin user Django

1👍

You can use user_passes_test decorator:

Then you can create an admin_check method like so:

def admin_check(user):
   return user.is_superuser

Pass the admin_check method to the decorator like so:

@user_passes_test(admin_check)
def my_view(request):
    ...

0👍

thank you for this, i had issue with caching… I just needed to restart server

Leave a comment