I am working on an api built using the Django Rest Framework . I have defined several model classes, and I have also created some filters to apply to specific requests that occur in the specified api-endpoints .
I am trying to apply LIMIT to queryset , but I would prefer not to use the Django ex Entry.objects.all()[:5] notation. Instead, I would like to use the limit from the filter associated with the model.
So far I have not found any solution. I think I should find a way to define a filter with a default value, which will result in it not limiting the set of requests, and if the request reaches the endpoint and contains something like ?filter=10 , then the set of requests should be limited first 10.
python django django-rest-framework django-filter
LetsPlayYahtzee
source share