9👍
Use JsonResponse
from django.http import JsonResponse
..
def articleTheme(request):
..
return JsonResponse({'newTheme': theme })
0👍
You can return the data with HttpResponse
and in JSON format like this:
data = {'newTheme': theme}
data = json.dumps(data, cls=DjangoJSONEncoder)
return HttpResponse(data)
- [Django]-(Django and PIL) encoder error -2 when writing image file
- [Django]-Celery raise error while passing my queryset obj as parameter
- [Django]-Django send_mail get result
- [Django]-Django all-auth: How to disable automatic login via Google
- [Django]-Wildcard searching in Django
Source:stackexchange.com