How to add custom permission to the User model in django?

后端 未结 4 1027
我寻月下人不归
我寻月下人不归 2021-02-12 15:53

in django by default when syncdb is run with django.contrib.auth installed, it creates default permissions on each model... like foo.can_change , foo.can_delete and foo.can_add.

4条回答
  •  感动是毒
    2021-02-12 16:27

    I don't think there is a "right" answer here, but i used the exact same code as you except i changed Permission.objects.create to Permission.objects.get_or_create and that worked find to sync with syncdb

提交回复
热议问题