image library migration step 1
This commit is contained in:
parent
07bea333bc
commit
1a2bbb1c35
23 changed files with 413 additions and 57 deletions
|
@ -93,12 +93,37 @@ class ServiceAdmin(admin.ModelAdmin):
|
|||
filter_horizontal = ("categories",)
|
||||
inlines = [ExternalLinkInline, OfferingInline]
|
||||
|
||||
fieldsets = (
|
||||
(None, {"fields": ("name", "slug", "description", "tagline")}),
|
||||
(
|
||||
"Images",
|
||||
{
|
||||
"fields": (
|
||||
"image_library",
|
||||
"logo",
|
||||
), # New image library field and legacy field
|
||||
"description": "Use the Image Library field for new images. Legacy field will be removed after migration.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"Configuration",
|
||||
{
|
||||
"fields": (
|
||||
"categories",
|
||||
"features",
|
||||
"is_featured",
|
||||
"is_coming_soon",
|
||||
"disable_listing",
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
def logo_preview(self, obj):
|
||||
"""Display logo preview in admin list view"""
|
||||
if obj.logo:
|
||||
return format_html(
|
||||
'<img src="{}" style="max-height: 50px;"/>', obj.logo.url
|
||||
)
|
||||
logo = obj.get_logo
|
||||
if logo:
|
||||
return format_html('<img src="{}" style="max-height: 50px;"/>', logo.url)
|
||||
return "No logo"
|
||||
|
||||
logo_preview.short_description = "Logo"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue