noPostIfNotStaff.py 263 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
from rest_framework import permissions


class NoPostIfNotStaff(permissions.BasePermission):
    """
    TODO
    """

    def has_permission(self, request, view):
10
        if request.method == "POST":
11
12
13
            return request.user.is_staff

        return True