fix(dashboard): stabilize result tables and fns filters
This commit is contained in:
@@ -840,12 +840,24 @@ class FinancialReportViewSet(ReadOnlyModelViewSet):
|
||||
"ogrn",
|
||||
"external_id",
|
||||
"status",
|
||||
"source",
|
||||
"load_batch",
|
||||
"registry_organization",
|
||||
]
|
||||
search_fields = ["ogrn", "external_id", "file_name"]
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
source_value = self.request.query_params.get("source", "").strip()
|
||||
if not source_value or source_value in {
|
||||
"fns_reports",
|
||||
"fns_financial",
|
||||
"financial-indicators",
|
||||
}:
|
||||
return queryset
|
||||
if source_value in FinancialReport.SourceType.values:
|
||||
return queryset.filter(source=source_value)
|
||||
return queryset.none()
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action == "retrieve":
|
||||
return FinancialReportDetailSerializer
|
||||
|
||||
Reference in New Issue
Block a user