myModelViewSet.py 359 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
from rest_framework import viewsets, permissions
from .myModelSerializer import MyModelSerializer
from backend.models.tools import NoDeleteIfNotAdmin


class MyModelViewSet(viewsets.ModelViewSet):  # TODO switch to dict
    serializer_class = MyModelSerializer
    permission_classes = (
        permissions.IsAuthenticated,
        NoDeleteIfNotAdmin,
    )