From b2e599db917477c92b63f41bf2d28199e0e8a8ca Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sun, 2 Nov 2025 11:37:06 +0330 Subject: [PATCH] fix - quota list by is_closed --- apps/product/models.py | 2 +- apps/product/web/api/v1/viewsets/quota_api.py | 6 ++++-- logs/django_requests.log | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/product/models.py b/apps/product/models.py index 7921261..6cf90ac 100644 --- a/apps/product/models.py +++ b/apps/product/models.py @@ -418,7 +418,7 @@ class Quota(BaseModel): if last: next_code = last.quota_id + 1 else: - next_code = 1001 + next_code = 10001 return next_code def calculate_final_price(self): diff --git a/apps/product/web/api/v1/viewsets/quota_api.py b/apps/product/web/api/v1/viewsets/quota_api.py index 3767a7c..2b1e840 100644 --- a/apps/product/web/api/v1/viewsets/quota_api.py +++ b/apps/product/web/api/v1/viewsets/quota_api.py @@ -347,7 +347,8 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, DynamicS """ list of organization active quotas """ queryset = self.filter_query( - self.get_queryset(visibility_by_org_scope=True)) # return by search param or all objects + self.get_queryset(visibility_by_org_scope=True).filter( + is_closed=False)) # return by search param or all objects # paginate queryset page = self.paginate_queryset( @@ -369,7 +370,8 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, DynamicS """ list of organization closed quotas """ queryset = self.filter_query( - self.get_queryset(visibility_by_org_scope=True)) # return by search param or all objects + self.get_queryset(visibility_by_org_scope=True).filter( + is_closed=True)) # return by search param or all objects # paginate queryset page = self.paginate_queryset( diff --git a/logs/django_requests.log b/logs/django_requests.log index fcb5ac0..905c7d4 100644 --- a/logs/django_requests.log +++ b/logs/django_requests.log @@ -664,3 +664,7 @@ AssertionError: .validate() should return the validated data [2025-11-02 11:04:48,112] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader [2025-11-02 11:05:16,197] INFO django.server | IP: - | Path: - | "GET /auth/api/v1/organization/child_organizations/ HTTP/1.1" 200 6938 [2025-11-02 11:33:14,043] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\product\models.py changed, reloading. +[2025-11-02 11:33:18,814] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-11-02 11:35:44,882] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\product\models.py changed, reloading. +[2025-11-02 11:35:52,593] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-11-02 11:36:51,561] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\product\web\api\v1\viewsets\quota_api.py changed, reloading.