I have a 'Document' model which has many-to-many relationship with User model.There is a separate web page in my project which displays the Document instance in a text editor.
Now suppose user who created one document wants to invite other users to this document.But he wants to give read-only permission to some and read-write permission to others.
How do I implement this permission functionality in Django?How do groups and other permissions frameworks work in Django?
Django
Group
andPermission
applies on model itself. So for a specific entry of document if you want to give access to user in that case you need to change your schema ofDocument
model. Just add ausers_who_can_read=ManyToMany(Users)
,users_who_can_write=ManyToMany(Users)
, and at your view.py when a user is trying to load a page just check if he is in users_who_can_read or not.I think it should solve your problem without much problem.