debug product view serializer

This commit is contained in:
Parsa Nazer
2025-01-26 16:57:30 +03:30
parent 20e70f464d
commit 6549b1b4cb
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ venv/
ENV/
env.bak/
venv.bak/
media/
# Spyder project settings
.spyderproject
.spyproject
+1 -1
View File
@@ -10,7 +10,7 @@ class ProductChatSerializer(serializers.ModelSerializer):
model = ProductModel
fields = ['name', 'description', 'price', 'in_stock', 'discount', ]
def get_price(self, obj):
dollor_price = self.content.get('dollor_price')
dollor_price = self.context.get('dollor_price')
dollar_to_dirham = 0.27
if dollor_price is None:
raise ValidationError({"dollor_price": "The 'dollor_price' must be provided in the context for dollar pricing."})