python 3.x - Django rest pagination next url is not correct -


i have created django rest api using modelviewset. deployed in staging , in production.production working fine,but staging has incorrect "next" url.

enter image description here enter image description here

see key "next" in both images, first image staging response , second 1 production response.in staging next key, "nub.staging.scoretrends.com" appears twice.same code used in both environment.working fine in localhost too.what makes happened this? modelviewset shown below.

class entitydetail(viewsets.modelviewset):     """     retrieve spider.     """     queryset = entity.objects.all()     serializer_class = entityserializer     filter_backends = (filters.djangofilterbackend, filters.orderingfilter)     filter_class = entityfilter     filter_fields = ('name', 'entity_type', 'gender', 'active', 'verified', 'date_created', 'date_modified')     ordering_fields = ('name', 'date_created', 'date_modified')      def get_queryset(self):         queryset = entity.objects.all()         name = self.request.query_params.get('name', none)         industry = self.request.query_params.get('industry', none)         entity_types = self.request.query_params.get('entity_types', none)         if name:           queryset = entity.objects.filter(name__icontains=name)         if industry:           queryset = entity.objects.filter(meta__primary_industry__iexact=industry)         if entity_types:           entity_types = [int(id) id in entity_types.split(',')]           queryset = queryset.filter(entity_type__in=entity_types)         return queryset      def list(self, request, *args, **kwargs):         queryset = self.filter_queryset(self.get_queryset())         if request.query_params.get('nopaginate') none:           page = self.paginate_queryset(queryset)           if page not none:             serializer = entityserializer(page, many=true)             return self.get_paginated_response(serializer.data)         serializer = entityserializer(queryset, many=true)         return response(serializer.data)     def update(self, request, *args, **kwargs):         instance = self.get_object()         serializer = entityserializer(instance, data=request.data, partial=true)         serializer.is_valid(raise_exception=true)         serializer.save(entity_id=instance.pk, **serializer.validated_data)         return response(serializer.data)     def partial_update(self, request, *args, **kwargs):        kwargs['partial'] = true        return self.update(request, *args, **kwargs) 

this django rest configuration have used

rest_framework = {     'default_pagination_class': 'rest_framework.pagination.pagenumberpagination',     'page_size': 20,     'default_filter_backends': ('rest_framework.filters.djangofilterbackend',),     'default_authentication_classes': (         'rest_framework.authentication.basicauthentication',         'rest_framework.authentication.sessionauthentication',     ) } 


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -