add filter by type_field in organization type
This commit is contained in:
@@ -212,9 +212,18 @@ class OrganizationTypeViewSet(SoftDeleteMixin, ModelViewSet):
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
""" all organization type """
|
||||
queryset = self.get_queryset().order_by('-modify_date')
|
||||
page = self.paginate_queryset(queryset.order_by('-create_date')) # paginate queryset
|
||||
|
||||
org_type_field = request.query_params.get('org_type_field', None)
|
||||
if not org_type_field:
|
||||
queryset = self.get_queryset().order_by('-modify_date')
|
||||
elif org_type_field == 'CI':
|
||||
queryset = self.get_queryset().filter(org_type_field=org_type_field).order_by('-modify_date')
|
||||
elif org_type_field == 'PR':
|
||||
queryset = self.get_queryset().filter(org_type_field=org_type_field).order_by('-modify_date')
|
||||
elif org_type_field == 'CO':
|
||||
queryset = self.get_queryset().filter(org_type_field=org_type_field).order_by('-modify_date')
|
||||
|
||||
page = self.paginate_queryset(queryset.order_by('-create_date')) # paginate queryset # noqa
|
||||
if page is not None: # noqa
|
||||
serializer = self.serializer_class(page, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
@@ -573,3 +573,6 @@ AssertionError: .validate() should return the validated data
|
||||
[2025-10-29 10:30:41,225] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
|
||||
[2025-10-29 10:30:44,066] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||
[2025-10-29 10:32:34,721] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
|
||||
[2025-10-29 10:32:38,147] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||
[2025-10-29 10:38:36,906] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\api.py changed, reloading.
|
||||
[2025-10-29 10:38:40,119] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||
|
||||
Reference in New Issue
Block a user