add guarantee filed to product varient and add timeout for nobitex api
This commit is contained in:
@@ -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='ویدیو')
|
||||
|
||||
Reference in New Issue
Block a user