Wednesday, June 1, 2016

Re: Why are models must for permissions?

It's a know limitation: https://code.djangoproject.com/ticket/24754

Maybe http://stackoverflow.com/questions/13932774/how-can-i-use-django-permissions-without-defining-a-content-type-or-model helps.

On Wednesday, June 1, 2016 at 10:32:12 AM UTC-4, Ankush Thakur wrote:
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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/65d8dabb-5c97-431a-9367-b79023cf7aa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment