[Answered ]-Internal error on AJAX call to a Django view (restframework endpoint)

2👍

You need to be sure your result (in your case data) is json serializable, note you are doing 'is_taking': Notification.objects.all(), you should do something like this instead:

from rest_framework.response import Response
from rest_framework.decorators import api_view

@api_view(['GET', ]) 
def notify(request):
    data = {
        'is_taken': NotificationSerializer(Notification.objects.all(), many=True).data
    }
    return Response(data)

And write the Serializer e.g. NotificationSerializer for Notification

Leave a comment