Skip to content

Commit

Permalink
Merge pull request #2275 from IFRCGo/feature/sitrep-order-by-created-at
Browse files Browse the repository at this point in the history
SituationReports default ordering
  • Loading branch information
szabozoltan69 authored Sep 29, 2024
2 parents dab037c + 216934a commit e4f8145
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,13 @@ class SituationReportAdmin(CompareVersionAdmin, RegionRestrictedAdmin):
"name",
"link_to_event",
"type",
"created_at",
"visibility",
)
country_in = "event__countries__in"
region_in = "event__regions__in"
autocomplete_fields = ("event",)
readonly_fields = ("created_at",)

# WikiJS links added
change_form_template = "admin/situationreport_change_form.html"
Expand Down
2 changes: 1 addition & 1 deletion api/drf_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ class SituationReportTypeViewset(viewsets.ReadOnlyModelViewSet):


class SituationReportViewset(ReadOnlyVisibilityViewsetMixin, viewsets.ReadOnlyModelViewSet):
queryset = SituationReport.objects.select_related("type")
queryset = SituationReport.objects.select_related("type").order_by("created_at")
authentication_classes = (TokenAuthentication,)
serializer_class = SituationReportSerializer
ordering_fields = (
Expand Down

0 comments on commit e4f8145

Please sign in to comment.