[Answered ]-Django: How to manage groups and permission without using default admin

2👍

“If I have deleted all permissions, will it be OK for project?”

If you try to get rid of existing permissions django might just recreate them, or you may run into trouble when creating new models. I’m not sure on the details of when the get created/recreated, but django has default permissions for every model you create.

“Django functions for validate permissions like has_perm would work?”

As long as you create permissions either by Programmatically creating permissions or by putting Custom Permissions in a model’s Meta class you should be able to use them like any other permissions. Specifically I mean you should be able to use user.has_perm and the permission_required decorator.

“Can I do some different thing for it?”

If you want to only show certain permissions from something like user.user_permissions I’d suggest filtering the results you get instead of trying to get rid of existing permissions. Something like the following would be appropriate:

filter_show_permissions = ["perm_a", "perm_b", ...]
filtered_permissions = [perm for perm in user.user_permissions
                        if perm in filter_show_permissions]

Leave a comment