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'