Skip to content

Models

hypha.images.models

CustomImage

Bases: AbstractImage

Custom image class to replace wagtailimages.Image, providing various additional data fields

drupal_id class-attribute instance-attribute

drupal_id = IntegerField(null=True, blank=True, editable=False)

alt class-attribute instance-attribute

alt = CharField(max_length=255, blank=True)

credit class-attribute instance-attribute

credit = CharField(max_length=255, blank=True)

admin_form_fields class-attribute instance-attribute

admin_form_fields = admin_form_fields + ('alt', 'credit')

save

save(*args, **kwargs)
Source code in hypha/images/models.py
def save(self, *args, **kwargs):
    if not self.alt:
        self.alt = self.title

    super().save(*args, **kwargs)

Rendition

Bases: AbstractRendition

image class-attribute instance-attribute

image = ForeignKey('CustomImage', related_name='renditions', on_delete=CASCADE)

Meta

unique_together class-attribute instance-attribute
unique_together = (('image', 'filter_spec', 'focal_point_key'))