forked from github/plane
chore: sort order for cycle and modules (#1835)
This commit is contained in:
parent
e06ee25800
commit
edaeae1b69
@ -165,6 +165,9 @@ class CycleViewSet(BaseViewSet):
|
|||||||
try:
|
try:
|
||||||
queryset = self.get_queryset()
|
queryset = self.get_queryset()
|
||||||
cycle_view = request.GET.get("cycle_view", "all")
|
cycle_view = request.GET.get("cycle_view", "all")
|
||||||
|
order_by = request.GET.get("order_by", "sort_order")
|
||||||
|
|
||||||
|
queryset = queryset.order_by(order_by)
|
||||||
|
|
||||||
# All Cycles
|
# All Cycles
|
||||||
if cycle_view == "all":
|
if cycle_view == "all":
|
||||||
|
@ -53,6 +53,8 @@ class ModuleViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
order_by = self.request.GET.get("order_by", "sort_order")
|
||||||
|
|
||||||
subquery = ModuleFavorite.objects.filter(
|
subquery = ModuleFavorite.objects.filter(
|
||||||
user=self.request.user,
|
user=self.request.user,
|
||||||
module_id=OuterRef("pk"),
|
module_id=OuterRef("pk"),
|
||||||
@ -106,7 +108,7 @@ class ModuleViewSet(BaseViewSet):
|
|||||||
filter=Q(issue_module__issue__state__group="backlog"),
|
filter=Q(issue_module__issue__state__group="backlog"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.order_by("-is_favorite", "name")
|
.order_by(order_by, "name")
|
||||||
)
|
)
|
||||||
|
|
||||||
def perform_destroy(self, instance):
|
def perform_destroy(self, instance):
|
||||||
|
Loading…
Reference in New Issue
Block a user