Skip to content
Advertisement

I want Staffuser in Django not to see any superusers

Right now i have applied this code

JavaScript

Here all the staff user are able to see superuser when i am logged in as staffuser enter image description here

But I want that the staffuser wont be able to see any superuser. so in this case staffuser can only view 1 user which is “new” and “admin” user which is superuser, should be hidden

How can i do that ?

Advertisement

Answer

You need to override get_queryset method:

JavaScript
Advertisement