remove old image fields - migrated to library
This commit is contained in:
parent
93eb45930a
commit
272e068a12
6 changed files with 16 additions and 56 deletions
|
@ -66,11 +66,8 @@ class ArticleAdmin(admin.ModelAdmin):
|
||||||
(
|
(
|
||||||
"Images",
|
"Images",
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": ("image_library",),
|
||||||
"image_library",
|
"description": "Select an image from the 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.",
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -52,11 +52,8 @@ class CloudProviderAdmin(SortableAdminMixin, admin.ModelAdmin):
|
||||||
(
|
(
|
||||||
"Images",
|
"Images",
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": ("image_library",),
|
||||||
"image_library",
|
"description": "Select an image from the 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.",
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -98,11 +95,8 @@ class ConsultingPartnerAdmin(SortableAdminMixin, admin.ModelAdmin):
|
||||||
(
|
(
|
||||||
"Images",
|
"Images",
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": ("image_library",),
|
||||||
"image_library",
|
"description": "Select an image from the 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.",
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -98,11 +98,8 @@ class ServiceAdmin(admin.ModelAdmin):
|
||||||
(
|
(
|
||||||
"Images",
|
"Images",
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": ("image_library",),
|
||||||
"image_library",
|
"description": "Select an image from the 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.",
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -20,13 +20,6 @@ class Article(ImageReference):
|
||||||
meta_keywords = models.CharField(
|
meta_keywords = models.CharField(
|
||||||
max_length=255, blank=True, help_text="SEO keywords separated by commas"
|
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")
|
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="articles")
|
||||||
article_date = models.DateField(
|
article_date = models.DateField(
|
||||||
default=timezone.now, help_text="Date of the article publishing"
|
default=timezone.now, help_text="Date of the article publishing"
|
||||||
|
@ -92,10 +85,10 @@ class Article(ImageReference):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def get_image(self):
|
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:
|
if self.image_library and self.image_library.image:
|
||||||
return self.image_library.image
|
return self.image_library.image
|
||||||
return self.image
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def related_to(self):
|
def related_to(self):
|
||||||
|
|
|
@ -16,13 +16,6 @@ class CloudProvider(ImageReference):
|
||||||
phone = models.CharField(max_length=25, blank=True, null=True)
|
phone = models.CharField(max_length=25, blank=True, null=True)
|
||||||
email = models.EmailField(max_length=254, blank=True, null=True)
|
email = models.EmailField(max_length=254, blank=True, null=True)
|
||||||
address = models.TextField(max_length=250, 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)
|
order = models.IntegerField(default=0)
|
||||||
is_featured = models.BooleanField(default=False)
|
is_featured = models.BooleanField(default=False)
|
||||||
disable_listing = models.BooleanField(default=False)
|
disable_listing = models.BooleanField(default=False)
|
||||||
|
@ -43,23 +36,16 @@ class CloudProvider(ImageReference):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def get_logo(self):
|
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:
|
if self.image_library and self.image_library.image:
|
||||||
return self.image_library.image
|
return self.image_library.image
|
||||||
return self.logo
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ConsultingPartner(ImageReference):
|
class ConsultingPartner(ImageReference):
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
slug = models.SlugField(unique=True)
|
slug = models.SlugField(unique=True)
|
||||||
description = ProseEditorField()
|
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)
|
website = models.URLField(blank=True)
|
||||||
linkedin = models.URLField(blank=True)
|
linkedin = models.URLField(blank=True)
|
||||||
phone = models.CharField(max_length=25, blank=True, null=True)
|
phone = models.CharField(max_length=25, blank=True, null=True)
|
||||||
|
@ -96,7 +82,7 @@ class ConsultingPartner(ImageReference):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def get_logo(self):
|
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:
|
if self.image_library and self.image_library.image:
|
||||||
return self.image_library.image
|
return self.image_library.image
|
||||||
return self.logo
|
return None
|
||||||
|
|
|
@ -21,13 +21,6 @@ class Service(ImageReference):
|
||||||
slug = models.SlugField(max_length=250, unique=True)
|
slug = models.SlugField(max_length=250, unique=True)
|
||||||
description = ProseEditorField()
|
description = ProseEditorField()
|
||||||
tagline = models.TextField(max_length=500, blank=True, null=True)
|
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")
|
categories = models.ManyToManyField(Category, related_name="services")
|
||||||
features = ProseEditorField()
|
features = ProseEditorField()
|
||||||
is_featured = models.BooleanField(default=False)
|
is_featured = models.BooleanField(default=False)
|
||||||
|
@ -62,10 +55,10 @@ class Service(ImageReference):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def get_logo(self):
|
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:
|
if self.image_library and self.image_library.image:
|
||||||
return self.image_library.image
|
return self.image_library.image
|
||||||
return self.logo
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ServiceOffering(models.Model):
|
class ServiceOffering(models.Model):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue