Why are models must for permissions?

25 views
Skip to first unread message

Ankush Thakur

unread,
Jun 1, 2016, 10:32:12 AM6/1/16
to Django users
Why are all permissions linked to a model? I'm just learning the basics of permissions and wanted to set up a quick example where I wanted to have a single user who belongs to a group that has permission to access restricted content, let's say. So far I have created a group  and added the user to that group but now I am stuck -- which model should I associate the permission with? Should it be the User model here? Why not some other model? Why a model at all?

This example in the docs also has me confused: https://docs.djangoproject.com/en/1.9/topics/auth/default/#groups
It looks like we are creating a generic permission here (generic in the sense that Django doesn't know what to do with it right out of the box). Why, then, must it be tied to the BlogPost model?

I guess my broader concern is that a permission like 'access_restricted_content' is not linked to any one model. Maybe there's a way to create permissions without a model and I've missed it?

I think I'm going nuts . . .

~~Ankush

Tim Graham

unread,
Jun 1, 2016, 10:45:43 AM6/1/16
to Django users
Reply all
Reply to author
Forward
0 new messages