Team-uMigrate / umigrate

Source code for the uMigrate project
13 stars 2 forks source link

Added ordering filters for datetime_created on CommentViewSet and ReplyViewSet #297

Closed justin-lu054 closed 3 years ago

justin-lu054 commented 3 years ago

I added in the ability to sort comments and replies by datetime_created through using rest_framework.filters.OrderingFilter and overriding the filter_backends property of both CommentViewSet and ReplyViewSet. These filters can be used by adding in the query parameter ordering=datetime_created for descending order and ordering=-datetime_created for ascending order. Note the only distinction between descending and ascending order is the minus sign used.