Something like this should work:
class StaffRequiredAdminMixin(object):
def check_perm(self, user_obj):
if not user_obj.is_active or user_obj.is_anonymous():
return False
if user_obj.is_superuser or user_obj.is_staff:
return True
return False
def has_add_permission(self, request):
return self.check_perm(request.user)
def has_change_permission(self, request, obj=None):
return self.check_perm(request.user)
def has_delete_permission(self, request, obj=None):
return self.check_perm(request.user)
and all ModelAdmin(s) should inherit this class. For example:
class MyModelAdmin(StaffRequiredAdminMixin, admin.ModelAdmin):
pass
admin.site.register(MyModel, MyModelAdmin)
Please note, this code is untested.
staff_member_required
decorator, but first they must belong to this group, but you wrote that you do not want to enter in each USER and add it to the group. – Essary