role childs service add to BaseViewSet
This commit is contained in:
@@ -25,7 +25,7 @@ from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
|
||||
|
||||
class RoleViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
|
||||
class RoleViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet):
|
||||
""" Crud Operations For User Roles """
|
||||
|
||||
queryset = Role.objects.all()
|
||||
@@ -33,6 +33,14 @@ class RoleViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = ['role_name', 'type__name']
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
""" all roles """
|
||||
|
||||
role = self.paginate_queryset(self.get_queryset().order_by('-modify_date'))
|
||||
if role is not None: # noqa
|
||||
serializer = self.get_serializer(role, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
|
||||
class PageViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
|
||||
""" add website pages to system to set permission on it """
|
||||
|
||||
Reference in New Issue
Block a user