|
29 | 29 | from contentcuration.viewsets.base import RESTCreateModelMixin |
30 | 30 | from contentcuration.viewsets.base import RESTDestroyModelMixin |
31 | 31 | from contentcuration.viewsets.base import RESTUpdateModelMixin |
| 32 | +from contentcuration.viewsets.base import ValuesViewsetOrderingFilter |
32 | 33 | from contentcuration.viewsets.common import UserFilteredPrimaryKeyRelatedField |
33 | 34 | from contentcuration.viewsets.sync.utils import ( |
34 | 35 | generate_added_to_community_library_event, |
@@ -244,12 +245,15 @@ class CommunityLibrarySubmissionViewSetMixin: |
244 | 245 | "resolved_by_name": get_resolved_by_name, |
245 | 246 | "channel_name": lambda item: item.get("channel__name"), |
246 | 247 | } |
247 | | - queryset = CommunityLibrarySubmission.objects.all().order_by("-date_updated") |
248 | | - filter_backends = [DjangoFilterBackend, SearchFilter] |
| 248 | + queryset = CommunityLibrarySubmission.objects.all() |
| 249 | + filter_backends = [DjangoFilterBackend, SearchFilter, ValuesViewsetOrderingFilter] |
249 | 250 | filterset_class = CommunityLibrarySubmissionFilterSet |
250 | 251 | search_fields = ["channel__name"] |
251 | 252 | pagination_class = CommunityLibrarySubmissionPagination |
252 | 253 |
|
| 254 | + ordering_fields = ["date_updated", "date_created"] |
| 255 | + ordering = "-date_updated" |
| 256 | + |
253 | 257 | def consolidate(self, items, queryset): |
254 | 258 | countries = {} |
255 | 259 | for (submission_id, country_code,) in Country.objects.filter( |
|
0 commit comments