1

I want to use the Django user model, but I want to keep the super user to administrate the site. I want the other users to be unable to access the admin interface. But I want them to be able to access another custom admin page that deals with uploaded files. I've read a lot of documentation regarding customizing the user model and the admin pages, but I'm having trouble figuring out how to accomplish such a task.

I see that I can subclass the AdminSite that is used for the admin page and make my own, but that runs into problems with is_staff and such.

My idea was to create a custom permission and extend the user model to have it, this permission would allow access to the admin page. But I'm still unsure how to create the admin page with the method I mentioned and avoid the problems of still allowing them access to the regular admin page.

What would be the best method to accomplish this? How could I create an admin page like this and such a permission and then assign it to an extended User as well as prevent them access to the normal admin page?

I am familiar with the decorator @user_passes_test() to check for groups, but what I am concerned with is making sure they can't get into anything but the "lesser" admin panel. Basically I don't want these users to be able to access anything but their own admin dashboard.

Any examples or suggestions would be most welcome, I need advice on creating the admin page for these normal users, how to create these normal users, and how to ensure that they can access the "lesser" admin page but not the normal django admin that has control over everything.

As a side question, if I was using django-suit to customize my normal admin page, would this change anything?

Thanks

1 Answer 1

0

If I understood correctly:

in your views.py

from django.contrib.auth.decorators import permission_required

adn over your def:

@permission_required('is_superuser')

this page will only see is_superuser.

3
  • I am familiar with this decorator. What I want is to retain the superuser as they are the site administrators. I need to do this as well as create another "normal" user that cannot access the admin panel but can access another lesser admin panel. I need advice on creating the user, the admin panel, and restricting access to it to the normal users but also ensuring they cannot access they normal django admin panel
    – ss7
    Jul 16, 2015 at 2:50
  • in your admin panel 'Check if the user can log into the administrative part of the site . == True' for your user. And the user will be able to go to the admin panel with fewer rights and opportunities. Jul 16, 2015 at 3:09
  • Right the group permission, but if I wanted a second admin part of the site, how could I differentiate the two with permissions, and make it so that permission doesn't give them access to both sites? I only want the superuser to access both
    – ss7
    Jul 16, 2015 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.