Skip to content

Instantly share code, notes, and snippets.

View 0x46616c6b's full-sized avatar

0x46616c6b 0x46616c6b

  • Dresden
  • 12:48 (UTC +02:00)
View GitHub Profile
if request.method == 'GET':
# new callback functions
if 'format' in request.GET:
if request.GET['format'] == 'json':
json_serializer = serializers.get_serializer("json")()
if 'function' in request.GET:
if request.GET['function'] == 'get_all_entries':
allEntries = Entry.objects.all().order_by('-published')
return HttpResponse(json_serializer.serialize(allEntries, ensure_ascii=False))
elif request.GET['function'] == 'get_latest_entry':