Open kbessemer opened 1 year ago
I think your viewset needs to use DynamicModelViewSet
from dynamic_rest
instead of ModelViewSet
from DRF.
# views.py
from dynamic_rest.viewsets import DynamicModelViewSet
class NotificationsViewSet(DynamicModelViewSet):
# implementation here
https://github.com/AltSchool/dynamic-rest/blob/master/dynamic_rest/viewsets.py#L420
I am trying to sort the results from the django rest framework api, trying to sort so the newest notifications are sent first
models.py
views.py
serializers.py
Accessing the API in postman from this URL: http://localhost:8000/pm/getnotifications//?sort[]=-notifications_set.pk
The JSON results
Any help is appreciated, thank you!