Skip to content

Commit

Permalink
Merge pull request #2397 from IFRCGo/feature/date-ordered-tables
Browse files Browse the repository at this point in the history
Pinned situation report documents first
  • Loading branch information
szabozoltan69 authored Jan 31, 2025
2 parents 21b2899 + ced305d commit 336e0e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/drf_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ class EventViewset(ReadOnlyVisibilityViewset):
ordering_fields = (
"disaster_start_date",
"created_at",
"dtype",
"name",
"summary",
"num_affected",
Expand Down Expand Up @@ -778,11 +779,12 @@ class SituationReportTypeViewset(viewsets.ReadOnlyModelViewSet):


class SituationReportViewset(ReadOnlyVisibilityViewsetMixin, viewsets.ReadOnlyModelViewSet):
queryset = SituationReport.objects.select_related("type").order_by("-created_at")
queryset = SituationReport.objects.select_related("type").order_by("-is_pinned", "-created_at")
authentication_classes = (TokenAuthentication,)
serializer_class = SituationReportSerializer
ordering_fields = (
"created_at",
"is_pinned",
"name",
)
filterset_class = SituationReportFilter
Expand Down Expand Up @@ -864,6 +866,7 @@ class AppealDocumentViewset(viewsets.ReadOnlyModelViewSet):
)
ordering_fields = (
"created_at",
"type",
"name",
)
filterset_class = AppealDocumentFilter
Expand Down

0 comments on commit 336e0e2

Please sign in to comment.