remove old image fields - migrated to library

This commit is contained in:
Tobias Brunner 2025-07-08 11:45:13 +02:00
parent 93eb45930a
commit 272e068a12
No known key found for this signature in database
6 changed files with 16 additions and 56 deletions

View file

@ -66,11 +66,8 @@ class ArticleAdmin(admin.ModelAdmin):
(
"Images",
{
"fields": (
"image_library",
"image",
), # New image library field and legacy field
"description": "Use the Image Library field for new images. Legacy field will be removed after migration.",
"fields": ("image_library",),
"description": "Select an image from the Image Library.",
},
),
(

View file

@ -52,11 +52,8 @@ class CloudProviderAdmin(SortableAdminMixin, admin.ModelAdmin):
(
"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.",
"fields": ("image_library",),
"description": "Select an image from the Image Library.",
},
),
(
@ -98,11 +95,8 @@ class ConsultingPartnerAdmin(SortableAdminMixin, admin.ModelAdmin):
(
"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.",
"fields": ("image_library",),
"description": "Select an image from the Image Library.",
},
),
(

View file

@ -98,11 +98,8 @@ class ServiceAdmin(admin.ModelAdmin):
(
"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.",
"fields": ("image_library",),
"description": "Select an image from the Image Library.",
},
),
(

View file

@ -20,13 +20,6 @@ class Article(ImageReference):
meta_keywords = models.CharField(
max_length=255, blank=True, help_text="SEO keywords separated by commas"
)
# Original image field - keep temporarily for migration
image = models.ImageField(
upload_to="article_images/",
help_text="Title picture for the article",
null=True,
blank=True,
)
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="articles")
article_date = models.DateField(
default=timezone.now, help_text="Date of the article publishing"
@ -92,10 +85,10 @@ class Article(ImageReference):
@property
def get_image(self):
"""Returns the image from library or falls back to legacy image"""
"""Returns the image from the library"""
if self.image_library and self.image_library.image:
return self.image_library.image
return self.image
return None
@property
def related_to(self):

View file

@ -16,13 +16,6 @@ class CloudProvider(ImageReference):
phone = models.CharField(max_length=25, blank=True, null=True)
email = models.EmailField(max_length=254, blank=True, null=True)
address = models.TextField(max_length=250, blank=True, null=True)
# Original logo field - keep temporarily for migration
logo = models.ImageField(
upload_to="cloud_provider_logos/",
validators=[validate_image_size],
null=True,
blank=True,
)
order = models.IntegerField(default=0)
is_featured = models.BooleanField(default=False)
disable_listing = models.BooleanField(default=False)
@ -43,23 +36,16 @@ class CloudProvider(ImageReference):
@property
def get_logo(self):
"""Returns the logo from library or falls back to legacy logo"""
"""Returns the logo from the library"""
if self.image_library and self.image_library.image:
return self.image_library.image
return self.logo
return None
class ConsultingPartner(ImageReference):
name = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
description = ProseEditorField()
# Original logo field - keep temporarily for migration
logo = models.ImageField(
upload_to="partner_logos/",
validators=[validate_image_size],
null=True,
blank=True,
)
website = models.URLField(blank=True)
linkedin = models.URLField(blank=True)
phone = models.CharField(max_length=25, blank=True, null=True)
@ -96,7 +82,7 @@ class ConsultingPartner(ImageReference):
@property
def get_logo(self):
"""Returns the logo from library or falls back to legacy logo"""
"""Returns the logo from the library"""
if self.image_library and self.image_library.image:
return self.image_library.image
return self.logo
return None

View file

@ -21,13 +21,6 @@ class Service(ImageReference):
slug = models.SlugField(max_length=250, unique=True)
description = ProseEditorField()
tagline = models.TextField(max_length=500, blank=True, null=True)
# Original logo field - keep temporarily for migration
logo = models.ImageField(
upload_to="service_logos/",
validators=[validate_image_size],
null=True,
blank=True,
)
categories = models.ManyToManyField(Category, related_name="services")
features = ProseEditorField()
is_featured = models.BooleanField(default=False)
@ -62,10 +55,10 @@ class Service(ImageReference):
@property
def get_logo(self):
"""Returns the logo from library or falls back to legacy logo"""
"""Returns the logo from the library"""
if self.image_library and self.image_library.image:
return self.image_library.image
return self.logo
return None
class ServiceOffering(models.Model):