I\'m trying to convert a server side Ajax response script into a Django HttpResponse, but apparently it\'s not working.
This is the server-side script:
With Django Class-based views you can write:
from django.views import View
from django.http import JsonResponse
class JsonView(View):
def get(self, request):
return JsonResponse({'some': 'data'})
and with Django-Rest-Framework you can write:
from rest_framework.views import APIView
from rest_framework.response import Response
class JsonView(APIView):
def get(self, request):
return Response({'some': 'data'})