image library migration step 1
All checks were successful
Build and Deploy / build (push) Successful in 1m7s
Django Tests / test (push) Successful in 1m10s
Build and Deploy / deploy (push) Successful in 6s

This commit is contained in:
Tobias Brunner 2025-07-04 17:26:09 +02:00
parent 07bea333bc
commit 1a2bbb1c35
No known key found for this signature in database
23 changed files with 413 additions and 57 deletions

View file

@ -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"