2018-12-10 02:11:54 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2022-12-15 09:25:21 +00:00
|
|
|
from orgs.mixins.api import OrgBulkModelViewSet
|
2023-02-22 12:04:00 +00:00
|
|
|
from rbac.permissions import RBACPermission
|
2022-11-11 11:20:17 +00:00
|
|
|
from ..models import AdHoc
|
2020-06-15 11:42:36 +00:00
|
|
|
from ..serializers import (
|
2022-11-17 12:10:13 +00:00
|
|
|
AdHocSerializer
|
2020-06-15 11:42:36 +00:00
|
|
|
)
|
2018-12-10 02:11:54 +00:00
|
|
|
|
|
|
|
__all__ = [
|
2022-11-11 11:20:17 +00:00
|
|
|
'AdHocViewSet'
|
2018-12-10 02:11:54 +00:00
|
|
|
]
|
2017-03-22 16:15:25 +00:00
|
|
|
|
|
|
|
|
2022-12-15 09:25:21 +00:00
|
|
|
class AdHocViewSet(OrgBulkModelViewSet):
|
2022-11-17 12:10:13 +00:00
|
|
|
serializer_class = AdHocSerializer
|
2023-02-22 12:04:00 +00:00
|
|
|
permission_classes = (RBACPermission,)
|
2023-02-09 09:44:35 +00:00
|
|
|
search_fields = ('name', 'comment')
|
2022-12-06 09:30:54 +00:00
|
|
|
model = AdHoc
|
2022-12-15 09:25:21 +00:00
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
queryset = super().get_queryset()
|
|
|
|
return queryset.filter(creator=self.request.user)
|