readOnly.py 249 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
from rest_framework import permissions


class ReadOnly(permissions.BasePermission):

    def has_permission(self, request, view):
        if request.method in permissions.SAFE_METHODS:
            return True
        else:
            return False