update admin and image for product image
This commit is contained in:
@@ -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,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user