You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
from rest_framework.permissions import BasePermission, SAFE_METHODS
|
|
|
|
|
|
class IsAuthorOrReadOnly(BasePermission):
|
|
|
|
def has_object_permission(self, request, view, obj):
|
|
if request.method in SAFE_METHODS:
|
|
return True
|
|
|
|
return obj.user == request.user |