customer_pickup_title and customer_pickup_description added
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.1.2 on 2026-02-24 13:14
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('account', '0034_add_telegram_chat_id_to_shop'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='shopmodel',
|
||||||
|
name='customer_pickup_description',
|
||||||
|
field=models.CharField(blank=True, max_length=500, null=True, verbose_name='توضیحات دریافت حضوری'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='shopmodel',
|
||||||
|
name='customer_pickup_title',
|
||||||
|
field=models.CharField(blank=True, max_length=40, null=True, verbose_name='عنوان دریافت حضوری'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -145,6 +145,10 @@ class ShopModel(models.Model):
|
|||||||
commission_percent = models.DecimalField(max_digits=5, decimal_places=2, verbose_name='درصد کمیسیون')
|
commission_percent = models.DecimalField(max_digits=5, decimal_places=2, verbose_name='درصد کمیسیون')
|
||||||
telegram_chat_id = models.CharField(max_length=100, blank=True, null=True, verbose_name='شناسه چت تلگرام', help_text='برای ارسال خودکار فاکتورها به تلگرام')
|
telegram_chat_id = models.CharField(max_length=100, blank=True, null=True, verbose_name='شناسه چت تلگرام', help_text='برای ارسال خودکار فاکتورها به تلگرام')
|
||||||
|
|
||||||
|
customer_pickup_title = models.CharField(max_length=40, verbose_name='عنوان دریافت حضوری', blank=True, null=True)
|
||||||
|
customer_pickup_description = models.CharField(max_length=500, verbose_name='توضیحات دریافت حضوری', blank=True, null=True)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.user.phone} - {self.shop_name}"
|
return f"{self.user.phone} - {self.shop_name}"
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ class DynamicProductSerializer(serializers.ModelSerializer):
|
|||||||
best_deal_price_after_discount = serializers.SerializerMethodField()
|
best_deal_price_after_discount = serializers.SerializerMethodField()
|
||||||
best_deal_discount = serializers.SerializerMethodField()
|
best_deal_discount = serializers.SerializerMethodField()
|
||||||
main_image = serializers.SerializerMethodField()
|
main_image = serializers.SerializerMethodField()
|
||||||
|
customer_pickup_title = serializers.SerializerMethodField()
|
||||||
|
customer_pickup_description = serializers.SerializerMethodField()
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
view_type = self.context.get('view_type', 'all')
|
view_type = self.context.get('view_type', 'all')
|
||||||
@@ -174,7 +176,7 @@ class DynamicProductSerializer(serializers.ModelSerializer):
|
|||||||
view_type = {
|
view_type = {
|
||||||
'list': ['id', 'name', 'rating', 'slug', 'category', 'colors', 'image', 'best_deal_price_before_discount', 'best_deal_price_after_discount', 'best_deal_discount', 'main_image'],
|
'list': ['id', 'name', 'rating', 'slug', 'category', 'colors', 'image', 'best_deal_price_before_discount', 'best_deal_price_after_discount', 'best_deal_discount', 'main_image'],
|
||||||
'slider': ['id', 'name', 'rating', 'slug', 'category', 'variants', 'colors', 'image', 'best_deal_price_before_discount', 'best_deal_price_after_discount', 'best_deal_discount', ],
|
'slider': ['id', 'name', 'rating', 'slug', 'category', 'variants', 'colors', 'image', 'best_deal_price_before_discount', 'best_deal_price_after_discount', 'best_deal_discount', ],
|
||||||
'instance': ['id', 'name', 'description', 'rating', 'slug', 'meta_description', 'meta_keywords', 'meta_rating', 'category', 'related_products', 'in_pack_items', 'variants', 'colors', 'added_to_favorites', 'image'],
|
'instance': ['id', 'name', 'description', 'rating', 'slug', 'meta_description', 'meta_keywords', 'meta_rating', 'category', 'related_products', 'in_pack_items', 'variants', 'colors', 'added_to_favorites', 'image', 'customer_pickup_title', 'customer_pickup_description'],
|
||||||
'chat': ['id', 'name', 'description', 'variants', 'image']
|
'chat': ['id', 'name', 'description', 'variants', 'image']
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +205,16 @@ class DynamicProductSerializer(serializers.ModelSerializer):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def get_customer_pickup_title(self, obj):
|
||||||
|
if obj.shop:
|
||||||
|
return obj.shop.customer_pickup_title
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_customer_pickup_description(self, obj):
|
||||||
|
if obj.shop:
|
||||||
|
return obj.shop.customer_pickup_description
|
||||||
|
return None
|
||||||
|
|
||||||
def get_added_to_favorites(self, obj):
|
def get_added_to_favorites(self, obj):
|
||||||
from account.models import UserFavorites
|
from account.models import UserFavorites
|
||||||
request = self.context.get('request')
|
request = self.context.get('request')
|
||||||
|
|||||||
Reference in New Issue
Block a user