set pagination message - V2

This commit is contained in:
2025-09-03 14:41:00 +03:30
parent 9df2cf6200
commit 6f025b787a
2 changed files with 26 additions and 1 deletions

View File

@@ -75,8 +75,10 @@ class InventoryEntryViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDevice
if page is not None:
serializer = self.get_serializer(page, many=True, context={'rancher': rancher.first(), 'device': device})
# set custom message for paginator
if not available_entries:
if not rancher:
self.paginator.set_message("دامدار با کد ملی مد نظر یافت نشد") # noqa
elif not available_entries:
self.paginator.set_message("دامدار با کد ملی مد نظر سهمیه ایی ندارد") # noqa
return self.get_paginated_response(serializer.data)