コード例 #1
0
class Contact(models.Model):
    heading = models.CharField(verbose_name=('Heading'),
                               max_length=255,
                               help_text=("The snippet heading"))
    body = RichTextField(blank=True)
    body_shown_in_expandables = models.BooleanField(default=False)

    contact_info = StreamField([
        ('email', molecules.ContactEmail()),
        ('phone', molecules.ContactPhone()),
        ('address', molecules.ContactAddress()),
        ('hyperlink', molecules.ContactHyperlink()),
    ],
                               blank=True)

    panels = [
        FieldPanel('heading'),
        FieldPanel('body'),
        FieldPanel('body_shown_in_expandables'),
        StreamFieldPanel('contact_info'),
    ]

    def __str__(self):
        return self.heading

    class Meta:
        ordering = ['heading']
コード例 #2
0
class Expandable(BaseExpandable):
    content = blocks.StreamBlock([
        ('paragraph', blocks.RichTextBlock(required=False)),
        ('well', Well()),
        ('links', atoms.Hyperlink()),
        ('email', molecules.ContactEmail()),
        ('phone', molecules.ContactPhone()),
        ('address', molecules.ContactAddress()),
    ],
                                 blank=True)
コード例 #3
0
ファイル: snippets.py プロジェクト: xcorail/cfgov-refresh
class Contact(models.Model):
    heading = models.CharField(verbose_name=('Heading'), max_length=255,
                               help_text=("The snippet heading"))
    body = RichTextField(blank=True)

    contact_info = StreamField([
        ('email', molecules.ContactEmail()),
        ('phone', molecules.ContactPhone()),
        ('address', molecules.ContactAddress()),
    ], blank=True)

    panels = [
        FieldPanel('heading'),
        FieldPanel('body'),
        StreamFieldPanel('contact_info'),
    ]

    def __str__(self):
        return self.heading