Exemplo n.º 1
0
class Image(Content):
    editable = True

    image = ImageField(verbose_name=_('image'))

    objects = SelectRelatedManager(select_related=['image'])

    class Meta:
        verbose_name = _('image')
        verbose_name_plural = _('images')
Exemplo n.º 2
0
class Image(Content):
    editable = True

    image = FilerImageField(verbose_name=_('image'), null=True,
                            related_name='+', on_delete=models.PROTECT)

    objects = SelectRelatedManager(select_related=['image'])

    class Meta:
        verbose_name = _('image')
        verbose_name_plural = _('images')
Exemplo n.º 3
0
class CallToAction(StrDisplayNameMixin, Content):
    editable = True
    tooltip = _('Add a link to another page')
    form = CallToActionForm
    objects = SelectRelatedManager(prefetch_related=['link'])

    text = models.CharField(max_length=255, verbose_name=_('text'), blank=True)
    link = LinkField(null=True)

    class Meta:
        verbose_name = _('CTA Button')

    def __str__(self):
        return self.text or ''
Exemplo n.º 4
0
class Button(StrDisplayNameMixin, Content):
    text = models.CharField(max_length=255, verbose_name=_('text'), null=True, blank=True)

    link = LinkField(null=True)

    css_classes = ('page_builder', 'buttonwidget')
    form = ButtonForm
    editable = True
    tooltip = _("Add a link to another page.")

    objects = SelectRelatedManager(prefetch_related=['link'])

    class Meta:
        verbose_name = _('button')
        verbose_name_plural = _('buttons')

    def __str__(self):
        if self.text is not None:
            return self.text
        return ''
Exemplo n.º 5
0
class CalloutWidget(StrDisplayNameMixin, Content):
    callout = models.ForeignKey(Callout, null=True, blank=True,
                                on_delete=models.PROTECT)

    editable = True
    tooltip = _("Callouts are a way to call a user's attention to something."
                " Callouts can be shared across pages.")

    objects = SelectRelatedManager(select_related=['callout__root_node'])

    class Meta:
        verbose_name = _('callout widget')
        verbose_name_plural = _('callout widgets')

    def __str__(self):
        if self.callout:
            return self.callout.name
        return ''

    @classmethod
    def valid_child_of(cls, parent, obj=None):
        return isinstance(parent, Sidebar)