created at field
This commit is contained in:
@@ -168,7 +168,8 @@ class ProductVariantAdmin(ModelAdmin, ImportExportModelAdmin):
|
|||||||
export_form_class = ExportForm
|
export_form_class = ExportForm
|
||||||
autocomplete_fields = ['product_attributes', 'images', 'in_pack_items', 'details']
|
autocomplete_fields = ['product_attributes', 'images', 'in_pack_items', 'details']
|
||||||
warn_unsaved_form = True
|
warn_unsaved_form = True
|
||||||
readonly_fields = ['price']
|
readonly_fields = ['price', 'created_at']
|
||||||
|
list_display = ('product', 'created_at')
|
||||||
# inlines = [DetailModelInLine]
|
# inlines = [DetailModelInLine]
|
||||||
|
|
||||||
@admin.register(ProductModel)
|
@admin.register(ProductModel)
|
||||||
@@ -176,14 +177,14 @@ class ProductModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
|||||||
import_form_class = ImportForm
|
import_form_class = ImportForm
|
||||||
export_form_class = ExportForm
|
export_form_class = ExportForm
|
||||||
inlines = [ProductVariantInLine]
|
inlines = [ProductVariantInLine]
|
||||||
readonly_fields = ('slug', )
|
readonly_fields = ('slug', 'created_at')
|
||||||
search_fields = ['name', 'description', ]
|
search_fields = ['name', 'description', ]
|
||||||
list_filter = ['show', 'category']
|
list_filter = ['show', 'category']
|
||||||
autocomplete_fields = ['related_products', ]
|
autocomplete_fields = ['related_products', ]
|
||||||
# compressed_fields = True
|
# compressed_fields = True
|
||||||
warn_unsaved_form = True
|
warn_unsaved_form = True
|
||||||
actions_list = ['redirect_to_learn', 'update_products_price']
|
actions_list = ['redirect_to_learn', 'update_products_price']
|
||||||
list_display = ['display_image', 'display_price', 'view', 'show', 'rating', 'category', ]
|
list_display = ['display_image', 'display_price', 'view', 'show', 'rating', 'category', 'created_at']
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('فیلد های اصلی', {'fields': ('name', 'description', 'category', 'related_products', 'show',), "classes": ["tab"],}),
|
('فیلد های اصلی', {'fields': ('name', 'description', 'category', 'related_products', 'show',), "classes": ["tab"],}),
|
||||||
('فیلد های سيو', {'fields': ('meta_description', 'meta_keywords', 'meta_rating', 'slug'), "classes": ["tab"],}),
|
('فیلد های سيو', {'fields': ('meta_description', 'meta_keywords', 'meta_rating', 'slug'), "classes": ["tab"],}),
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 5.1.2 on 2025-05-22 14:31
|
||||||
|
|
||||||
|
import django.utils.timezone
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('product', '0047_alter_maincategorymodel_video'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='productvariant',
|
||||||
|
name='created_at',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='زمان ثبت محصول'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -115,6 +115,7 @@ class ProductModel(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@@ -244,6 +245,8 @@ class ProductVariant(models.Model):
|
|||||||
video = models.FileField(upload_to='product_videos/', blank=True, null=True, verbose_name='ویدیو')
|
video = models.FileField(upload_to='product_videos/', blank=True, null=True, verbose_name='ویدیو')
|
||||||
details = models.ManyToManyField(ProductDetailModel, verbose_name='جزییات محصول', related_name='product')
|
details = models.ManyToManyField(ProductDetailModel, verbose_name='جزییات محصول', related_name='product')
|
||||||
slider_category = models.ForeignKey(ShowCaseSlider, verbose_name='دسته بندی پورسانتی', blank=True, null=True, on_delete=models.CASCADE)
|
slider_category = models.ForeignKey(ShowCaseSlider, verbose_name='دسته بندی پورسانتی', blank=True, null=True, on_delete=models.CASCADE)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True, verbose_name='زمان ثبت محصول')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = 'تنوع محصول'
|
verbose_name = 'تنوع محصول'
|
||||||
verbose_name_plural = 'تنوعهای محصول'
|
verbose_name_plural = 'تنوعهای محصول'
|
||||||
|
|||||||
Reference in New Issue
Block a user