add status functionality

This commit is contained in:
2025-05-26 10:33:09 +03:00
parent 4897a5050d
commit 50e6da10f1
7 changed files with 92 additions and 49 deletions

View File

@@ -37,7 +37,7 @@ class NewsView(APIView):
class LatestRoutesView(APIView):
@handle_exceptions
def get(self, request):
"""Получаем последние маршруты"""
"""Получаем последние актуальные маршруты"""
routes = []
owner_types = dict(owner_type_choices).keys()
@@ -45,7 +45,10 @@ class LatestRoutesView(APIView):
for owner_type in owner_types:
routes.extend(
HomePageRouteSerializer(
Route.objects.filter(owner_type=owner_type).order_by('-id')[:5],
Route.objects.filter(
owner_type=owner_type,
status="actual"
).order_by('-id')[:5],
many=True
).data
)