From cf30a0f10ff7148077781cdbf06dd7e6703213c8 Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Mon, 18 May 2026 12:10:51 +0330 Subject: [PATCH] __str__ fuction --- backend/product/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/product/models.py b/backend/product/models.py index 27f242a..4799ea1 100644 --- a/backend/product/models.py +++ b/backend/product/models.py @@ -410,6 +410,9 @@ class ProductVariant(DirtyFieldsMixin, models.Model): ShowCaseSlider, verbose_name='دسته بندی پورسانتی', blank=True, null=True, on_delete=models.CASCADE) created_at = models.DateTimeField( auto_now_add=True, verbose_name='زمان ثبت محصول') + + def __str__(self): + return f"{self.product.name} - {', '.join(str(attr) for attr in self.product_attributes.all())}" class Meta: verbose_name = 'تنوع محصول' @@ -433,8 +436,6 @@ class ProductVariant(DirtyFieldsMixin, models.Model): name='variant_product_discount_idx'), ] - def __str__(self): - return f"{self.product.name} - {', '.join(str(attr) for attr in self.product_attributes.all())}" @property def price_before_discount(self):