2👍
✅
Create a permission that your modelviewset uses
class CreatorPermissions(BasePermission):
def has_permission(self, request, view):
return request.method in permissions.SAFE_METHOD
def has_object_permission(self, request, view, obj):
return request.user.id == obj.user.id
class ImageViewSet(viewsets.ModelViewSet):
model = Image
serializer_class = ImageSerializer # you have to create this
permission_classes = (CreatorPermissions,)
queryset = Image.objects.all()
Source:stackexchange.com