from rest_framework.permissions import BasePermission, SAFE_METHODS


class IsOwnerOrReadOnly(BasePermission):

    message = "You cannot change other users data"

    def has_permission(self, request, view):
        if request.method in SAFE_METHODS:
            return True
        return request.user.username == view.kwargs['username']

       
            
72a83887b5face79372a99cbf852679198a093ea
<mask token>


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

<mask token>


class IsOwnerOrReadOnly(BasePermission):
    <mask token>

    def has_permission(self, request, view):
        if request.method in SAFE_METHODS:
            return True
        return request.user.username == view.kwargs['username']

<mask token>


class IsOwnerOrReadOnly(BasePermission):
    message = 'You cannot change other users data'

    def has_permission(self, request, view):
        if request.method in SAFE_METHODS:
            return True
        return request.user.username == view.kwargs['username']

from rest_framework.permissions import BasePermission, SAFE_METHODS


class IsOwnerOrReadOnly(BasePermission):
    message = 'You cannot change other users data'

    def has_permission(self, request, view):
        if request.method in SAFE_METHODS:
            return True
        return request.user.username == view.kwargs['username']

from rest_framework.permissions import BasePermission, SAFE_METHODS


class IsOwnerOrReadOnly(BasePermission):

    message = "You cannot change other users data"

    def has_permission(self, request, view):
        if request.method in SAFE_METHODS:
            return True
        return request.user.username == view.kwargs['username']

       
            