I have a function that i want to be accessed only if the user is a 
supersuser.

I have tried this

from django.contrib.admin.views.decorators import staff_member_required

@staff_member_required
def my_view(request):
    template_name = 'Core\CustomizedAdmin.html'
    return render(request, template_name)


What happens is that when i try to access this view, it directs me to the 
default login admin page. 
And then when i login as a superuser, it gives an OSError invalid argument:

I expected that after login in as a superuser it will redirect to the Page 
i want.

Am i doing it the wrong way?

Is there an alternative way to Limit a view to superuser only?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc05e300-5e71-4bc5-b388-2996c5b8bb0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to