From c376ce7fb9b1f18589c699112217130c408181df Mon Sep 17 00:00:00 2001 From: Ashwin Thanaraj <37061471+ashwin1111@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:51:48 +0530 Subject: [PATCH] Advanced search on destination by value (#98) * Advanced search on destination by value * fix indent --- fyle_accounting_mappings/urls.py | 4 +++- fyle_accounting_mappings/views.py | 10 ++++++++++ setup.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fyle_accounting_mappings/urls.py b/fyle_accounting_mappings/urls.py index 6ad8740..f8cb73e 100644 --- a/fyle_accounting_mappings/urls.py +++ b/fyle_accounting_mappings/urls.py @@ -27,7 +27,8 @@ EmployeeAttributesMappingView, ExpenseFieldView, DestinationAttributesView, - FyleFieldsView + FyleFieldsView, + PaginatedDestinationAttributesView ) urlpatterns = [ @@ -44,4 +45,5 @@ path('expense_fields/', ExpenseFieldView.as_view()), path('destination_attributes/', DestinationAttributesView.as_view()), path('fyle_fields/', FyleFieldsView.as_view()), + path('paginated_destination_attributes/', PaginatedDestinationAttributesView.as_view()), ] diff --git a/fyle_accounting_mappings/views.py b/fyle_accounting_mappings/views.py index 4e331e6..52f329c 100644 --- a/fyle_accounting_mappings/views.py +++ b/fyle_accounting_mappings/views.py @@ -464,3 +464,13 @@ class FyleFieldsView(ListAPIView): def get_queryset(self): return FyleFieldsSerializer().format_fyle_fields(self.kwargs["workspace_id"]) + +class PaginatedDestinationAttributesView(LookupFieldMixin, ListAPIView): + """ + Paginated Destination Attributes view + """ + queryset = DestinationAttribute.objects.filter(active=True) + serializer_class = DestinationAttributeSerializer + filter_backends = (DjangoFilterBackend,) + filterset_fields = {'attribute_type': {'exact', 'in'}, 'display_name': {'exact', 'in'}, 'value': {'icontains'}} + ordering_fields = ('value',) diff --git a/setup.py b/setup.py index 77da10d..98eec75 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='fyle-accounting-mappings', - version='1.29.2', + version='1.30.0', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='Django application to store the fyle accounting mappings in a generic manner',