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


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

    def has_permission(self, request, view):
        if request.method == 'POST':
            return request.user.is_staff

        return True