user290043
user290043

Reputation:

Django: Permissions based on Model Instance

I have a model class Project and for each model instance, there should be a 'group' of users who may edit that instance. I guess I could add another model class called ProjectEditor to add those editors. Is there a better way of implementing this? What about checking for permissions? I would need to write my own permission method then too, right?

Thanks Eric

Upvotes: 13

Views: 6735

Answers (3)

Myers Carpenter
Myers Carpenter

Reputation: 979

Django Guardian seems to be the best solution today for Model instance level permissions.

Upvotes: 15

ars
ars

Reputation: 123568

There was an open source release for row/object level permissions by the washington times team that might be of use:

Upvotes: 2

Manoj Govindan
Manoj Govindan

Reputation: 74795

Model (table) level permissions can be achieved using the groups facility provided by Django auth. Groups let you create custom permissions at a model level. Instance (row) level would be trickier. You would most likely have to write a custom mechanism to accomplish this.

Here is a Django Snippet that might give you some ideas.

Upvotes: 3

Related Questions