fix: ordering in queryset (#598)

This commit is contained in:
pablohashescobar 2023-03-30 16:33:16 +05:30 committed by GitHub
parent 5aad20e7ed
commit 9c4fcca6c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View file

@ -91,7 +91,7 @@ class ProjectViewSet(BaseViewSet):
projects = (
self.get_queryset()
.annotate(is_favorite=Exists(subquery))
.order_by("name", "-is_favorite")
.order_by("-is_favorite", "name")
)
return Response(ProjectDetailSerializer(projects, many=True).data)
except Exception as e: