From c905ad8d5f1ce8b9b511f462a2294b636a386d53 Mon Sep 17 00:00:00 2001 From: benjamyn Date: Wed, 21 Oct 2020 03:10:30 -0400 Subject: [PATCH] Added missed function --- migratorapi/api/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/migratorapi/api/views.py b/migratorapi/api/views.py index ba55e60..3d68299 100644 --- a/migratorapi/api/views.py +++ b/migratorapi/api/views.py @@ -21,6 +21,12 @@ class MigrationViewSet(viewsets.ModelViewSet): response = {"message": "this will be upcoming migrations"} return Response(response, status=status.HTTP_200_OK) + @action(detail=False, methods=['GET']) + def missed(self, request, *args, **kwargs): + response = {"message": str(Migration.objects.filter( + booked_time__gte=timezone.now()).order_by('-booked_time')[:5])} + return Response(response, status=status.HTTP_200_OK) + class IndexView(generic.ListView): template_name = 'api/index.html'