update admin and image for product image

This commit is contained in:
Parsa Nazer
2025-10-20 18:56:48 +03:30
parent 9b89600314
commit e9e7601b3d
2 changed files with 20 additions and 2 deletions
+19 -1
View File
@@ -104,13 +104,31 @@ class ProductImagesAdmin(ModelAdmin):
search_fields = ['name']
compressed_fields = True
warn_unsaved_form = True
list_display = ['display_image', 'name',]
formfield_overrides = {
ArrayField: {
"widget": ArrayWidget,
}
}
@display(description='محصول', header=True)
def display_image(self, instance):
if instance and instance.image:
image = instance.image.url
else:
image = None
return [
instance.name,
None,
None,
{
"path": image,
"height": 30,
"width": 30,
"borderless": True,
# "squared": True,
},
]
+1 -1
View File
@@ -40,7 +40,7 @@ django-iranian-cities==1.0.2
django-jalali==7.3.0
django-storages==1.14.5
django-timezone-field==7.1
django-unfold==0.48.0
django-unfold==0.65.0
djangorestframework==3.15.2
djangorestframework-simplejwt==5.3.1
djoser==2.3.1