Commit 8948fcc8 authored by Gladys Forte's avatar Gladys Forte

Merge branch 'core-dev-gladys' into 'core-dev'

{dev bugfix} download list

See merge request rms/Backend/api-main-service!844
parents 3141143b 9412f5d5
...@@ -12,9 +12,6 @@ from django.db.models import Q ...@@ -12,9 +12,6 @@ from django.db.models import Q
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.permissions import AllowAny from rest_framework.permissions import AllowAny
# from cms.applicationlayer.utilities import logged_user # from cms.applicationlayer.utilities import logged_user
from app.helper import decorators
from rest_framework.decorators import action
from app.helper.decorators import rms, error_safe
class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet): class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
...@@ -24,14 +21,21 @@ class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet): ...@@ -24,14 +21,21 @@ class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
filename = 'User List.xlsx' filename = 'User List.xlsx'
permission_classes = (AllowAny,) permission_classes = (AllowAny,)
@decorators.rms.user_list
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):
# id_number = request.user.code # id_number = self.request.user
data = User.objects.all().exclude(id=1) data = User.objects.all().exclude(id=1)
# user_type = data.values_list('user_type', flat=True)
code = data.values_list('department__company', flat=True)
data = User.objects.filter(
department__company=str(code)).exclude(id=1)
serializer = headers(data=data, many=True) serializer = headers(data=data, many=True)
serializer.is_valid(raise_exception=False) serializer.is_valid(raise_exception=False)
return Response(serializer.data) return Response(serializer.data)
column_header = { column_header = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment