Skip to content

Instantly share code, notes, and snippets.

@filipgorczynski
Created February 9, 2018 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipgorczynski/2d88596364a238ee385ac3f95f5bf0c7 to your computer and use it in GitHub Desktop.
Save filipgorczynski/2d88596364a238ee385ac3f95f5bf0c7 to your computer and use it in GitHub Desktop.
views.py for movies application
from django.http import JsonResponse
def top_rated(request):
return JsonResponse(
[
{
'title': 'Skazani na Shawshank',
'year': 1994
},
{
'title': 'Ojciec chrzestny',
'year': 1972
},
{
'title': 'Ojciec chrzestny II',
'year': 1974
},
{
'title': 'Mroczny Rycerz',
'year': 2008
},
{
'title': 'Dwunastu gniewnych ludzi',
'year': 1957
}
],
safe=False
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment