Skip to content

Instantly share code, notes, and snippets.

@menecio
Created September 7, 2019 15:58
Show Gist options
  • Save menecio/503483c7be3bd55bc66b942e75c32da5 to your computer and use it in GitHub Desktop.
Save menecio/503483c7be3bd55bc66b942e75c32da5 to your computer and use it in GitHub Desktop.
from django.core.serializers import serialize
from django.http import HttpResponse
from .models import Movie
def movies_list(request):
queryset = Movie.objects.all()
content = serialize('json', queryset)
return HttpResponse(content=content, content_type='application/json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment