fix - sort livestocks by modify date
This commit is contained in:
@@ -36,6 +36,18 @@ class LiveStockViewSet(viewsets.ModelViewSet, SoftDeleteMixin): # noqa
|
||||
"herd__rancher__ranching_farm",
|
||||
]
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""
|
||||
list of live stocks
|
||||
"""
|
||||
queryset = self.filter_queryset(self.get_queryset().order_by('-modify_date'))
|
||||
|
||||
# paginate queryset
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None: # noqa
|
||||
serializer = self.serializer_class(page, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
@action(
|
||||
methods=['put'],
|
||||
detail=True,
|
||||
|
||||
Reference in New Issue
Block a user