object-level permissions django
-
11-11-2019 - |
سؤال
How do you ensure that a User can only edit objects they've created? What's the best way to set this up?
I'm using django-rest-framework and wondering if there's a way I can restrict users from viewing/ editing objects they don't 'own'.
class Video(models.Model):
owner = models.ForeignKey(User)
...
So User 'x' should only be able to edit videos in their owner_set.
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow