Pagination with JsonResponse

I'd like to add pagination to my JsonResponse.

I'd like to add pagination to my JsonResponse.

I'm currently using the django.http.JsonResponse to generate json from an elastic search API. I'd like to add a pagination feature to be included. My code is as follows:

class ResultQueryView(View):
    def get(self, request):
        resource_meta = request.GET.getlist("resource_meta")
        locations = request.GET.getlist("location")
        page = request.GET.get("page")
        logger.info("Got search query where resource_meta: {} and locations: {}".format(resource_meta, locations))
        results = resource_query(resource_meta, locations)
        resource_ids = [r["_id"] for r in results['hits']['hits']]
        resources = get_enriched_resources(request.user, Resource.objects.filter(internal_id__in=resource_ids))
        serialized = ResourceSerializer(resources, many=True)
        return JsonResponse({"resources": serialized.data})


Python Django Tutorial | Django Course

Python Django Tutorial | Django Course

🔥Intellipaat Django course: https://intellipaat.com/python-django-training/ 👉This Python Django tutorial will help you learn what is django web development &...

This Python Django tutorial will help you learn what is django web development & application, what is django and introduction to django framework, how to install django and start programming, how to create a django project and how to build django app. There is a short django project as well to master this python django framework.

Why should you watch this Django tutorial?

You can learn Django much faster than any other programming language and this Django tutorial helps you do just that. Our Django tutorial has been created with extensive inputs from the industry so that you can learn Django and apply it for real world scenarios.

Django

Well i used django ... i want to know after completing all the coding stuff, can i make all the codes online ?

Well i used django ... i want to know after completing all the coding stuff, can i make all the codes online ?

as Django give you a local host, i have a .com domain but can i integrate the codes to it so it works ?