Added a test function for the API
This commit is contained in:
parent
b229c752a3
commit
619378c432
@ -5,6 +5,8 @@ from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from rest_framework import status, viewsets
|
||||
from .serializers import MigrationSerializer
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import action
|
||||
|
||||
from .models import Migration
|
||||
|
||||
@ -14,6 +16,11 @@ class MigrationViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = MigrationSerializer
|
||||
# permission_classes = (AllowAny,)
|
||||
|
||||
@action(detail=False, methods=['GET'])
|
||||
def upcoming(self, request, *args, **kwargs):
|
||||
response = {"message": "this will be upcoming migrations"}
|
||||
return Response(response, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class IndexView(generic.ListView):
|
||||
template_name = 'api/index.html'
|
||||
|
||||
Reference in New Issue
Block a user