Skip to content
Snippets Groups Projects
Verified Commit c4d2323e authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Remove ModelWithImageFields

parent a0dbb0f6
No related branches found
No related tags found
No related merge requests found
Pipeline #3069 failed
...@@ -46,41 +46,6 @@ class ScheduleConflictError(ValidationError): ...@@ -46,41 +46,6 @@ class ScheduleConflictError(ValidationError):
self.conflicts = conflicts self.conflicts = conflicts
class ModelWithImageFields(models.Model):
"""Abstract model that adds:
- `image`, a `VersatileImageField`
- `image_ppoi`, a `PPOIField`
- `image_width`, a `PositiveIntegerField`
- `image_height`, a `PositiveIntegerField`
- `image_credits`, a `TextField`
- `image_alt_text`, a `TextField`
"""
image = VersatileImageField(
blank=True,
null=True,
upload_to="images",
width_field="image_width",
height_field="image_height",
ppoi_field="image_ppoi",
)
image_ppoi = PPOIField()
image_width = models.PositiveIntegerField(blank=True, null=True, editable=False)
image_height = models.PositiveIntegerField(blank=True, null=True, editable=False)
image_credits = models.TextField(blank=True, null=True)
image_alt_text = models.TextField(blank=True, null=True)
class Meta:
abstract = True
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
if self.image.name and THUMBNAIL_SIZES:
for size in THUMBNAIL_SIZES:
self.image.thumbnail = self.image.crop[size].name
class ModelWithCreatedUpdatedFields(models.Model): class ModelWithCreatedUpdatedFields(models.Model):
"""Abstract model that adds: """Abstract model that adds:
- `created_at`, a `DateTimeField` with `auto_now_add=True` - `created_at`, a `DateTimeField` with `auto_now_add=True`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment