文章排序

This commit is contained in:
caoqianming 2022-03-17 10:43:34 +08:00
parent b0ea55121b
commit 35bac2297c
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ class ArticleViewSet(CreateUpdateModelAMixin, ModelViewSet):
filterset_fields = ['is_top', 'is_published'] filterset_fields = ['is_top', 'is_published']
serializer_class = ArticleListSerializer serializer_class = ArticleListSerializer
search_fields = ['title', 'author'] search_fields = ['title', 'author']
ordering = ['is_published', 'is_top', 'update_time'] ordering = ['-is_published', '-is_top', '-update_time']
def get_serializer_class(self): def get_serializer_class(self):
if self.action in ['create', 'update']: if self.action in ['create', 'update']: