debug product view serializer
This commit is contained in:
+1
-1
@@ -137,7 +137,7 @@ venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
media/
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
@@ -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."})
|
||||
|
||||
Reference in New Issue
Block a user