TNRIS / api.tnris.org

Django RESTful API and PostgreSQL backend database management system for maintaining and serving Texas GIO's available data and content.

Home Page:https://api.tnris.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

adjust api response querysets

adambreznicky opened this issue · comments

commented

currently, almost all api viewsets overwrite the get_queryset() method to always apply public=True, convert null/none values to the proper 'None' python format, and order the query results in a standard way.

maybe these get_queryset methods should be removed and, instead, use the more standard queryset=model object query. then we can/should add the standard orderingfilter & serarchfilter to each viewset via their filter_backends property.
currently, api responses are hard coded in the order which the viewset designates. making these changes would open up the user's (and our frontends) ability to sort the response from their request url and simplify the code.

https://www.django-rest-framework.org/api-guide/filtering/#orderingfilter
https://www.django-rest-framework.org/api-guide/filtering/#searchfilter

commented

might be best to develop this alternative endpoint at /api/v2/