From 2e515e288bb4c066af392b5a2204a0a9d0072200 Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Tue, 6 Jan 2026 14:41:19 +0330 Subject: [PATCH] update special_discount_link method to return a URL based on user authentication --- backend/product/serializers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/product/serializers.py b/backend/product/serializers.py index 9d41a85..a9ca9dc 100644 --- a/backend/product/serializers.py +++ b/backend/product/serializers.py @@ -88,7 +88,11 @@ class ProductVariantSerialzier(serializers.ModelSerializer): return None 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): return f'{obj.price_after_discount:,.0f} تومانءءء'