Django User default permission

Viewed 199

I want to add permissions (view, add, change, delete) to every user, so I add this meta class in each Model

class Meta:
   default_permissions = ('add', 'change', 'delete', 'view')

but when I log in (with new user) to the Django admin site, the user hasn't got the permission yet. Is my approach wrong?

pics

EDIT: I solved this by adding this code to my registration form

permission_list = ['view_depot','view_courier','view_client',
                                'add_depot','add_courier','add_client',
                                'change_depot','change_courier','change_client',
                                'delete_depot','delete_courier','delete_client']
permission_list = list(map(lambda x : Permission.objects.get(codename=x), permission_list))
user.user_permissions.add(*permission_list)

if anyone know simpler method than feel free to share here

1 Answers

You need to login as Admin in Admin panel and go to users table and find that user and go to down and you will see "Available user permissions"enter image description here

Related