fix order
This commit is contained in:
1 parent
ae4dbab3cc
commit
4dc6d98abf
3 files changed
+39
-4
No files matched your search
@@ -1,5 +1,6 @@
|
||||
from apps.shop.models import Product as ProductModel
|
||||
from rest_framework import exceptions
|
||||
from apps.shop.ordering import product_ordering
|
||||
|
||||
|
||||
def retrieve_product(product_id: int, workspace_uuid: str) -> ProductModel:
|
||||
@@ -23,7 +24,7 @@ def list_product(workspace_uuid: str) -> ProductModel:
|
||||
def list_product_by_category(workspace_uuid: str, category_id: int) -> ProductModel:
|
||||
try:
|
||||
product_category_obj = ProductModel.objects.filter(sys_ws__uuid=workspace_uuid, category_id=category_id,
|
||||
view_only=False)
|
||||
view_only=False).order_by(*product_ordering())
|
||||
return product_category_obj
|
||||
except Exception as exp:
|
||||
message = f'Error Fetching List Product by category: {exp}'
|
||||
@@ -33,7 +34,7 @@ def list_product_by_category(workspace_uuid: str, category_id: int) -> ProductMo
|
||||
def list_view_only_product_by_category(workspace_uuid: str, category_id: int) -> ProductModel:
|
||||
try:
|
||||
view_only_product_category_obj = ProductModel.objects.filter(sys_ws__uuid=workspace_uuid, category_id=category_id,
|
||||
view_only=True)
|
||||
view_only=True).order_by(*product_ordering())
|
||||
return view_only_product_category_obj
|
||||
except Exception as exp:
|
||||
message = f'Error Fetching View Only List Product by category: {exp}'
|
||||
@@ -46,4 +47,4 @@ def count_product_in_category(workspace_uuid: str, category_id: int) -> int:
|
||||
return count_product
|
||||
except Exception as exp:
|
||||
message = f'Error Couting Product in category: {exp}'
|
||||
raise exceptions.ValidationError({'error': message})
|
||||
raise exceptions.ValidationError({'error': message})
|
||||
Reference in new issue
Block a user