From cc98dc4ccf1b055a7af12467e38aecf6302bc508 Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Thu, 28 May 2026 10:33:39 +0330 Subject: [PATCH] add guarantee filed to product varient and add timeout for nobitex api --- backend/product/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/product/models.py b/backend/product/models.py index 438556f..550f0fa 100644 --- a/backend/product/models.py +++ b/backend/product/models.py @@ -147,7 +147,7 @@ class DollorModel(models.Model): def get_usd_price(self): try: api_usd = "https://api.nobitex.ir/v2/orderbook/USDTIRT" - response = requests.get(api_usd) + response = requests.get(api_usd, timeout=5) data = response.json() price = int(data["lastTradePrice"]) price_in_usd = price / 10.0 @@ -403,6 +403,10 @@ class ProductVariant(DirtyFieldsMixin, models.Model): discount = models.SmallIntegerField(default=0, verbose_name='درصد تخفیف', help_text='این درصد از قیمت نهایی محصول کسر میگردد') color = models.CharField( verbose_name='رنگ', max_length=7, blank=True, null=True) + guarantee = models.CharField( + max_length=200, default='گرانتی اصالت و سلامت کالا', + verbose_name='گارانتی', + help_text='این مقدار به ترب ارسال می‌شود تا محصول به‌عنوان نو طبقه‌بندی شود') images = models.ManyToManyField(ProductImageModel, verbose_name='عکس ها') video = models.FileField(upload_to='product_videos/', blank=True, null=True, verbose_name='ویدیو')