from django.shortcuts import render from django.core import serializers from django.http import HttpResponse, JsonResponse from .models import ImageSync, RemoteRegionSetup def index(request): return HttpResponse("Hello world") def count(request, count): data = { 'name': 'Vitor', 'location': 'Finland', 'is_active': True, 'count': count } return JsonResponse(data) def imagesync(request): rec = ImageSync.objects.order_by('-remote_region_name') return JsonResponse(serializers.serialize('json', rec), safe=False)