Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想列出 django 为特定应用程序的模型创建的权限,就像在 django 后端创建用户时所做的那样:
app_name | model_name | can add model_name
这个怎么做?
您可以从 Permissions 模型中检索它,例如:
>>> Permission.objects.filter(content_type=ContentType.objects.get(app_label='auth', model='user')) [<Permission: auth | user | Can add user>, <Permission: auth | user | Can change user>, <Permission: auth | user | Can delete user>]