admin pannel update
This commit is contained in:
@@ -9,7 +9,7 @@ from django.contrib.postgres.fields import ArrayField
|
||||
from unfold.widgets import (
|
||||
UnfoldAdminColorInputWidget,
|
||||
)
|
||||
|
||||
from unfold.decorators import action, display
|
||||
class InStuckColorsInLine(TabularInline):
|
||||
model = InStuckColors
|
||||
extra = 1
|
||||
@@ -27,7 +27,7 @@ class ProductModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
autocomplete_fields = ['related_products']
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
|
||||
list_display = ['display_image', 'price',]
|
||||
formfield_overrides = {
|
||||
models.TextField: {
|
||||
"widget": WysiwygWidget,
|
||||
@@ -36,6 +36,23 @@ class ProductModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
"widget": ArrayWidget,
|
||||
}
|
||||
}
|
||||
@display(description='محصول', header=True)
|
||||
def display_image(self, instance):
|
||||
if instance.image1:
|
||||
return [
|
||||
instance.name,
|
||||
None,
|
||||
None,
|
||||
{
|
||||
"path": instance.image1.url,
|
||||
"height": 24,
|
||||
"width": 24,
|
||||
"borderless": True,
|
||||
# "squared": True,
|
||||
},
|
||||
]
|
||||
return ()
|
||||
|
||||
|
||||
@admin.register(MainCategoryModel)
|
||||
class MainCategoryModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
|
||||
Reference in New Issue
Block a user