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

Use abstract ModelWithImageFields for Note model

this renames the fields
- `ppoi` -> `image_ppoi`
- `width` -> `image_width`
- `height` -> `image_height`
and adds the fields `image_credits` and `image_alt_text`.
parent c935815f
No related branches found
No related tags found
No related merge requests found
......@@ -1158,7 +1158,7 @@ class TimeSlot(models.Model):
return str("".join(s for s in string if s.isdigit()))
class Note(models.Model):
class Note(ModelWithImageFields):
timeslot = models.OneToOneField(TimeSlot, on_delete=models.CASCADE, unique=True)
contributors = models.ManyToManyField(Host, related_name="contributions")
owner = models.ForeignKey(
......@@ -1168,17 +1168,6 @@ class Note(models.Model):
slug = models.SlugField(max_length=32, unique=True)
summary = models.TextField(blank=True)
content = models.TextField()
ppoi = PPOIField()
height = models.PositiveIntegerField(blank=True, null=True, editable=False)
width = models.PositiveIntegerField(blank=True, null=True, editable=False)
image = VersatileImageField(
blank=True,
null=True,
upload_to="note_images",
width_field="width",
height_field="height",
ppoi_field="ppoi",
)
cba_id = models.IntegerField(blank=True, null=True)
tags = models.TextField(blank=True, null=True)
......@@ -1195,11 +1184,6 @@ class Note(models.Model):
super(Note, self).save(*args, **kwargs)
# Generate thumbnails
if self.image.name and THUMBNAIL_SIZES:
for size in THUMBNAIL_SIZES:
self.image.thumbnail = self.image.crop[size].name
class NoteLink(Link):
note = models.ForeignKey(Note, on_delete=models.CASCADE, related_name="links")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment