Nirali Supe
2018-07-01 03:44:05 UTC
Hello,
class JobsFilter(filters.FilterSet):
class Meta:
model = Jobs
fields = {'id': ['exact', 'lt', 'gt'],
'runs': ['exact', 'in', 'lt', 'gt'],
}
class JobsViewSet(viewsets.ModelViewSet):
"""
List all Entries, or create a new one.
"""
queryset = Jobs.objects.all()
serializer_class = JobsSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_class = JobsFilter
The following url is working:
http://127.0.0.1:8000/suite-runs-by-job?id__lt=2&runs__gt=30
But I need the url in the following format:
http://127.0.0.1:8000/suite-runs-by-job?id=lt:2&runs=gt:30
Is there a way I can do that?
class JobsFilter(filters.FilterSet):
class Meta:
model = Jobs
fields = {'id': ['exact', 'lt', 'gt'],
'runs': ['exact', 'in', 'lt', 'gt'],
}
class JobsViewSet(viewsets.ModelViewSet):
"""
List all Entries, or create a new one.
"""
queryset = Jobs.objects.all()
serializer_class = JobsSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_class = JobsFilter
The following url is working:
http://127.0.0.1:8000/suite-runs-by-job?id__lt=2&runs__gt=30
But I need the url in the following format:
http://127.0.0.1:8000/suite-runs-by-job?id=lt:2&runs=gt:30
Is there a way I can do that?
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.