from rest_framework.permissions import BasePermission


class IsOwner(BasePermission):
    message = 'You must be owner of this object'

    def has_object_permission(self, request, view, obj):
        my_safe_method = ['PUT']
        if request.method is my_safe_method:
            return True
        print(obj.username)
        print(request.user)
        return str(obj.username) == str(request.user)

5615634c0af5198247ce35881162db49273cc2e0
<mask token>


class IsOwner(BasePermission):
    <mask token>
    <mask token>

<mask token>


class IsOwner(BasePermission):
    <mask token>

    def has_object_permission(self, request, view, obj):
        my_safe_method = ['PUT']
        if request.method is my_safe_method:
            return True
        print(obj.username)
        print(request.user)
        return str(obj.username) == str(request.user)

<mask token>


class IsOwner(BasePermission):
    message = 'You must be owner of this object'

    def has_object_permission(self, request, view, obj):
        my_safe_method = ['PUT']
        if request.method is my_safe_method:
            return True
        print(obj.username)
        print(request.user)
        return str(obj.username) == str(request.user)

from rest_framework.permissions import BasePermission


class IsOwner(BasePermission):
    message = 'You must be owner of this object'

    def has_object_permission(self, request, view, obj):
        my_safe_method = ['PUT']
        if request.method is my_safe_method:
            return True
        print(obj.username)
        print(request.user)
        return str(obj.username) == str(request.user)
