update special_discount_link method to return a URL based on user authentication

This commit is contained in:
Parsa Nazer
2026-01-06 14:41:19 +03:30
parent 2fe7fa0005
commit 2e515e288b
+5 -1
View File
@@ -88,7 +88,11 @@ class ProductVariantSerialzier(serializers.ModelSerializer):
return None return None
def get_special_discount_link(self, obj): def get_special_discount_link(self, obj):
return 'https://' request = self.context.get('request')
if request.user.is_authenticated:
return 'https://google.com'
else:
return None
def get_price_after_discount(self, obj): def get_price_after_discount(self, obj):
return f'{obj.price_after_discount:,.0f} تومانءءء' return f'{obj.price_after_discount:,.0f} تومانءءء'