mirror of https://github.com/jumpserver/jumpserver
18 lines
514 B
Python
18 lines
514 B
Python
from rest_framework_bulk import BulkModelViewSet
|
|
|
|
from common.mixins import CommonApiMixin
|
|
|
|
__all__ = ['SelfBulkModelViewSet']
|
|
|
|
|
|
class SelfBulkModelViewSet(CommonApiMixin, BulkModelViewSet):
|
|
|
|
def get_queryset(self):
|
|
if hasattr(self, 'model'):
|
|
return self.model.objects.filter(creator=self.request.user)
|
|
else:
|
|
assert self.queryset is None, (
|
|
"'%s' should not include a `queryset` attribute"
|
|
% self.__class__.__name__
|
|
)
|