diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/ChannelList.vue b/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/ChannelList.vue index 58bb5390af..dfa961a3b6 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/ChannelList.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/ChannelList.vue @@ -124,7 +124,6 @@ [this.channelFilter]: true, page: this.$route.query.page || 1, exclude: this.currentChannelId, - ordering: this.channelFilter === 'public' ? 'name' : '-modified', }).then(page => { this.pageCount = page.total_pages; this.channels = page.results; diff --git a/contentcuration/contentcuration/viewsets/channel.py b/contentcuration/contentcuration/viewsets/channel.py index 4ab57c4595..07d27b7281 100644 --- a/contentcuration/contentcuration/viewsets/channel.py +++ b/contentcuration/contentcuration/viewsets/channel.py @@ -400,8 +400,6 @@ class ChannelViewSet(ValuesViewset): serializer_class = ChannelSerializer pagination_class = ChannelListPagination filterset_class = ChannelFilter - ordering_fields = ["modified", "name"] - ordering = "-modified" field_map = channel_field_map values = base_channel_values + ("edit", "view", "unpublished_changes") @@ -414,15 +412,6 @@ def get_queryset(self): queryset = super(ChannelViewSet, self).get_queryset() user_id = not self.request.user.is_anonymous and self.request.user.id user_queryset = User.objects.filter(id=user_id) - # Add the last modified node modified value as the channel last modified - channel_main_tree_nodes = ContentNode.objects.filter( - tree_id=OuterRef("main_tree__tree_id") - ) - queryset = queryset.annotate( - modified=Subquery( - channel_main_tree_nodes.values("modified").order_by("-modified")[:1] - ) - ) return queryset.annotate( edit=Exists(user_queryset.filter(editable_channels=OuterRef("id"))), @@ -445,6 +434,12 @@ def annotate_queryset(self, queryset): queryset = queryset.annotate( count=SQCount(non_topic_content_ids, field="content_id"), ) + # Add the last modified node modified value as the channel last modified + queryset = queryset.annotate( + modified=Subquery( + channel_main_tree_nodes.values("modified").order_by("-modified")[:1] + ) + ) queryset = queryset.annotate(unpublished_changes=Exists(_unpublished_changes_query(OuterRef("id"))))