add search ro excel
This commit is contained in:
@@ -22,19 +22,12 @@ class ProductExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin):
|
||||
serializer_class = distribution_serializers.QuotaDistributionSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = [
|
||||
"assigner_organization__name",
|
||||
"assigned_organization__name",
|
||||
"distribution_id",
|
||||
"quota__quota_id",
|
||||
"quota__product__name",
|
||||
"quota__sale_type",
|
||||
"quota__group",
|
||||
"registerer_organization__name",
|
||||
"quota_id",
|
||||
"product__name",
|
||||
"sale_type",
|
||||
"sale_unit__unit",
|
||||
"group"
|
||||
"group",
|
||||
]
|
||||
|
||||
# noqa # سهمیه و توزیع
|
||||
@@ -286,6 +279,15 @@ class ProductExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin):
|
||||
queryset = product_models.Quota.objects.filter(id=request.GET['id'], trash=False)
|
||||
queryset = self.filter_query(queryset)
|
||||
serializer_class = QuotaSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = [
|
||||
"registerer_organization__name",
|
||||
"quota_id",
|
||||
"product__name",
|
||||
"sale_type",
|
||||
"sale_unit__unit",
|
||||
"group",
|
||||
]
|
||||
|
||||
output = BytesIO()
|
||||
workbook = Workbook()
|
||||
@@ -533,9 +535,21 @@ class ProductExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin):
|
||||
name='quota_excel'
|
||||
)
|
||||
def quota_excel(self, request):
|
||||
search_fields = [
|
||||
"registerer_organization__name",
|
||||
"quota_id",
|
||||
"product__name",
|
||||
"sale_type",
|
||||
"sale_unit__unit",
|
||||
"group",
|
||||
]
|
||||
queryset = product_models.Quota.objects.all()
|
||||
queryset = self.filter_query(queryset)
|
||||
|
||||
serializer_class = QuotaSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
|
||||
|
||||
output = BytesIO()
|
||||
workbook = Workbook()
|
||||
worksheet = workbook.active
|
||||
|
||||
Reference in New Issue
Block a user