I have a model called Logs
:
class Logs(models.Model):
entry = models.CharField(max_length=100)
Some Users can administer logs, others edit and the rest only view. How would you handle such permissions in Django?
I was thinking of adding a new many-to-many
field, one for admins the other for editors, then on the save function check which user is in what group.
However, this seems static and bad, can I somehow use Django's built in permissions? What other solutions, packages are there, what is the best approach to this problem?
I have seen you can create custom permissions in Django i.e.
permission = Permission.objects.create(codename='can_publish',
name='Can Publish Logs',
content_type=content_type)
But how on Logs
would I check the permissions, would this be done in the Save()
method.