change tomaon text
This commit is contained in:
@@ -23,14 +23,14 @@ class ProductVariantSerialzier(serializers.ModelSerializer):
|
||||
|
||||
def get_discount_amount(self, obj):
|
||||
discount_amount = int(obj.price * (obj.discount / 100))
|
||||
return f'{discount_amount:,.0f} تومان'
|
||||
return f'{discount_amount:,.0f} تومانءءء'
|
||||
|
||||
def get_final_price(self, obj):
|
||||
final_price = obj.price - int(obj.price * (obj.discount / 100))
|
||||
return f'{final_price:,.0f} تومان'
|
||||
return f'{final_price:,.0f} تومانءءء'
|
||||
|
||||
def get_price(self, obj):
|
||||
return f'{obj.price:,.0f} تومان'
|
||||
return f'{obj.price:,.0f} تومانءءء'
|
||||
|
||||
def get_image(self, obj):
|
||||
return self.context.get('request').build_absolute_uri(obj.images.all().first().image.url)
|
||||
@@ -66,13 +66,13 @@ class OrderItemSerailzier(serializers.ModelSerializer):
|
||||
return ProductVariantSerialzier(instance=obj.product_variant, context={'request': self.context.get('request')}).data
|
||||
|
||||
def get_discount_amount(self, obj):
|
||||
return f'{obj.item_discount_amount:,.0f} تومان'
|
||||
return f'{obj.item_discount_amount:,.0f} تومانءءء'
|
||||
|
||||
def get_final_price(self, obj):
|
||||
return f'{obj.price_after_discount:,.0f} تومان'
|
||||
return f'{obj.price_after_discount:,.0f} تومانءءء'
|
||||
|
||||
def get_price(self, obj):
|
||||
return f'{obj.price_before_discount:,.0f} تومان'
|
||||
return f'{obj.price_before_discount:,.0f} تومانءءء'
|
||||
|
||||
def get_discount(self, obj):
|
||||
return obj.product_variant.discount
|
||||
@@ -85,7 +85,7 @@ class OrderItemSerailzier(serializers.ModelSerializer):
|
||||
amount = getattr(obj, 'item_special_discount_amount', 0)
|
||||
if amount is None or amount == 0:
|
||||
return None
|
||||
return f'{int(amount):,.0f} تومان'
|
||||
return f'{int(amount):,.0f} تومانءءء'
|
||||
|
||||
|
||||
class CartSerializer(serializers.ModelSerializer):
|
||||
@@ -118,28 +118,28 @@ class CartSerializer(serializers.ModelSerializer):
|
||||
return {
|
||||
'code': f'{obj.discount_code.code}',
|
||||
'percent': obj.discount_code.percent,
|
||||
'amount': f'{obj.discount_code_amount:,.0f} تومان'
|
||||
'amount': f'{obj.discount_code_amount:,.0f} تومانءءء'
|
||||
}
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_tax_amount(self, obj):
|
||||
return f'{obj.tax_amount:,.0f} تومان'
|
||||
return f'{obj.tax_amount:,.0f} تومانءءء'
|
||||
|
||||
def get_cart_total(self, obj):
|
||||
return f'{obj.cart_total:,.0f} تومان'
|
||||
return f'{obj.cart_total:,.0f} تومانءءء'
|
||||
|
||||
def get_items_discount_amount(self, obj):
|
||||
return f'{obj.items_discount_amount:,.0f} تومان'
|
||||
return f'{obj.items_discount_amount:,.0f} تومانءءء'
|
||||
|
||||
def get_final_price(self, obj):
|
||||
return f'{obj.final_price:,.0f} تومان'
|
||||
return f'{obj.final_price:,.0f} تومانءءء'
|
||||
|
||||
def get_special_discount_total(self, obj):
|
||||
# sum of special discounts on cart items
|
||||
total = obj.special_discount_total if hasattr(
|
||||
obj, 'special_discount_total') else 0
|
||||
return f'{int(total):,.0f} تومان'
|
||||
return f'{int(total):,.0f} تومانءءء'
|
||||
|
||||
|
||||
class OrderListSerializer(serializers.ModelSerializer):
|
||||
|
||||
Reference in New Issue
Block a user