Exemple #1
0
class SimplePage(Page):
    body_de = fields.RichTextField()
    body_en = fields.RichTextField(blank=True)

    body = TranslatedField(
        'body_de',
        'body_en'
    )

    en_content_panels = [
        FieldPanel('body_en')
    ]

    de_content_panels = [
        FieldPanel('body_de')
    ]

    common_panels = [
        FieldPanel('title'),
        FieldPanel('slug')
    ]

    edit_handler = TabbedInterface([
        ObjectList(common_panels, heading='Common'),
        ObjectList(en_content_panels, heading='English'),
        ObjectList(de_content_panels, heading='German')
    ])

    subpage_types = ['a4_candy_cms_pages.SimplePage']
Exemple #2
0
class DailyReadingPage(Page, ContentPageMixin):
    date = models.DateField("Date")
    video_link = models.URLField(default="", blank=True)
    content = wtfields.RichTextField(blank=True)
    reflection = wtfields.RichTextField(blank=True)

    content_panels = Page.content_panels + [
        FieldPanel("date"),
        FieldPanel("content"),
        FieldPanel("video_link"),
        FieldPanel("reflection"),
    ]

    def get_context(self, request):
        context = super().get_context(request)
        return context

    @cached_property
    def getdescription(self):
        ncomments = com_models.Comment.objects.filter(
            thread_id=self.pk).count()
        if ncomments > 0:
            return f"{ncomments} comment{'s' if ncomments > 1 else ''}"
        else:
            return ""
Exemple #3
0
class UserProfile(ClusterableModel):
    """User profile model. 1to1 with the custom User model.

    TODO Decide if we want / need all / any of these fields.

    Attributes:
        user (User): The user whose profile this is.
    """

    user = models.OneToOneField(
        User, null=True, blank=True, on_delete=models.SET_NULL, related_name="profile"
    )
    salutation = models.CharField(
        _("Salutation"), max_length=255, blank=True, null=True
    )
    job_title = models.CharField(_("Job title"), max_length=255, blank=True, null=True)
    bio = fields.RichTextField(_("Bio"), blank=True, null=True)
    short_bio = fields.RichTextField(_("Short bio"), blank=True, null=True)
    photo = models.ForeignKey(
        settings.WAGTAILIMAGES_IMAGE_MODEL,
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name="+",
    )

    @property
    def avatar(self):
        """Returns the author's profile pic, or None"""
        if self.photo is None:
            return None
        return self.photo

    def __str__(self):
        return self.user.full_name
Exemple #4
0
class EmailFormPage(AbstractEmailForm):
    intro = fields.RichTextField(
        help_text='Introduction text shown above the form')
    thank_you = fields.RichTextField(
        help_text='Text shown after form submission', )
    email_content = models.CharField(
        max_length=200,
        help_text='Email content message',
    )
    attach_as = models.CharField(
        max_length=3,
        choices=(
            ('inc', 'Include in Email'),
            ('xls', 'XLSX Document'),
            ('txt', 'Text File'),
        ),
        default='inc',
        help_text='Form results are send in this document format',
    )

    content_panels = AbstractEmailForm.content_panels + [
        edit_handlers.MultiFieldPanel([
            edit_handlers.FieldPanel('intro', classname='full'),
            edit_handlers.FieldPanel('thank_you', classname='full'),
        ], 'Page'),
        edit_handlers.MultiFieldPanel([
            edit_handlers.FieldPanel('to_address'),
            edit_handlers.FieldPanel('subject'),
            edit_handlers.FieldPanel('email_content', classname='full'),
            edit_handlers.FieldPanel('attach_as'),
        ], 'Email'),
        edit_handlers.InlinePanel('form_fields', label='Form fields'),
    ]

    def send_mail(self, form):
        kwargs = {
            'title': self.title.replace(' ', '_'),
            'to_addresses': self.to_address.split(','),
            'field_values': self.get_field_values(form),
            'submission_pk': self.get_submission_class().objects.last().pk
        }
        if self.attach_as == 'xls':
            emails.XlsxFormEmail.send(self, **kwargs)
        elif self.attach_as == 'txt':
            emails.TextFormEmail.send(self, **kwargs)
        else:
            emails.FormEmail.send(self, **kwargs)

    def get_field_values(self, form):
        fields = {}
        for field in form:
            value = field.value()
            if isinstance(value, list):
                value = ', '.join(value)
            fields[field.label] = value
        return fields
Exemple #5
0
class OrganisationSettings(BaseSetting):
    platform_name = models.CharField(
        max_length=20,
        default="adhocracy+",
        verbose_name="Platform name",
    )
    address = fields.RichTextField()
    contacts = fields.RichTextField()

    panels = [
        FieldPanel('platform_name'),
        FieldPanel('address'),
        FieldPanel('contacts')
    ]
Exemple #6
0
class ProjectPage(Page):
    image = models.ForeignKey('images.CustomImage',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+')

    start_date = models.DateField()
    end_date = models.DateField()

    short_description = models.CharField(max_length=112,
                                         help_text=_('Shown in list.'))
    description = fields.RichTextField()
    embed_code = models.TextField()

    content_panels = Page.content_panels + [
        edit_handlers.FieldPanel('short_description'),
        edit_handlers.FieldPanel('description'),
        ImageChooserPanel('image'),
        edit_handlers.FieldPanel('start_date'),
        edit_handlers.FieldPanel('end_date'),
        edit_handlers.FieldPanel('embed_code'),
    ]

    class Meta:
        verbose_name = _('Project')

    parent_page_types = ['ProjectContainerPage']
    subpage_types = []
Exemple #7
0
class SimplePage(Page):
    body = fields.RichTextField(blank=True)

    content_panels = [
        edit_handlers.FieldPanel('title'),
        edit_handlers.FieldPanel('body'),
    ]
Exemple #8
0
class StandardPage(wagtail_models.Page):
    """
    A standard content page.
    """

    description = models.TextField(blank=True)
    excerpt = wagtail_fields.RichTextField(blank=True)
    authors = modelcluster_fields.ParentalManyToManyField("users.User")
    date = models.DateTimeField()
    featured_image = models.ForeignKey(
        "wagtailimages.Image",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name="+",
    )
    body = wagtail_fields.StreamField([
        ("heading", wagtail_blocks.CharBlock()),
        ("paragraph", wagtail_blocks.RichTextBlock()),
        ("section", SectionBlock()),
    ])

    content_panels = wagtail_models.Page.content_panels + [
        wagtail_panels.FieldPanel("description"),
        wagtail_panels.FieldPanel("excerpt"),
        wagtail_panels.FieldPanel("authors"),
        wagtail_panels.FieldPanel("date"),
        wagtail_image_panels.ImageChooserPanel("featured_image"),
        wagtail_panels.StreamFieldPanel("body"),
    ]
Exemple #9
0
class HomePage(PreviewablePageBase):
    body = fields.RichTextField(blank=True)

    content_panels = wagtail_models.Page.content_panels + [
        FieldPanel('body', classname="full"),
    ]

    api_fields = [APIField('body')]
Exemple #10
0
class HomePage(Page):
    body = fields.RichTextField(blank=True)
    site_areas = fields.StreamField([('site_area', SiteAreaBlock())],
                                    blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('body'),
        StreamFieldPanel('site_areas'),
    ]
Exemple #11
0
class ServicesIndexPage(Page):
    intro = wtfields.RichTextField(blank=True)

    content_panels = Page.content_panels + [
        FieldPanel("intro", classname="full")
    ]

    @classmethod
    def service_pages(cls):
        return ServicePage.objects.in_menu().order_by("-date")
Exemple #12
0
class OrganisationSettings(BaseSetting):
    platform_name = models.CharField(
        max_length=20,
        default="adhocracy+",
        verbose_name="Platform name",
        help_text=("This name appears in the footer of all pages and e-mails "
                   "as well as in the tab of the browser."))
    address = fields.RichTextField(
        help_text="The address is published on the contact form.")
    contacts = fields.RichTextField(
        help_text="The contacts are published on the contact form.")

    class Meta:
        verbose_name = 'Platform settings'

    panels = [
        FieldPanel('platform_name'),
        FieldPanel('address'),
        FieldPanel('contacts')
    ]
Exemple #13
0
class BlogEntryPage(Page):
    text = wagtail_fields.RichTextField()

    content_panels = Page.content_panels + [
        edit_handlers.RichTextFieldPanel('text'),
    ]

    class Meta:
        verbose_name = _('Blog Entry')

    parent_page_types = ['blog.BlogIndexPage']
    subpage_types = []
Exemple #14
0
class BasicPage(Page):
    updated_at = models.DateTimeField(auto_now=True)
    content = wtfields.RichTextField(blank=True)
    show_last_updated = models.BooleanField(default=True)

    stream = wtfields.StreamField(
        [
            ("offering", OfferingBlock(name="Offering Section")),
        ],
        blank=True,
    )

    content_panels = Page.content_panels + [
        FieldPanel("show_last_updated"),
        FieldPanel("content"),
        StreamFieldPanel("stream"),
    ]
Exemple #15
0
class Post(wagtail_models.Page):
    """
    A standard post.
    """

    description = models.TextField(blank=True)
    excerpt = wagtail_fields.RichTextField(blank=True)
    authors = modelcluster_fields.ParentalManyToManyField("users.User")
    date = models.DateTimeField()
    featured_image = models.ForeignKey(
        "wagtailimages.Image",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name="+",
    )
    tags = modelcluster_taggit.ClusterTaggableManager(
        through="home.TaggedPost", blank=True)
    categories = modelcluster_fields.ParentalManyToManyField("home.Category",
                                                             blank=True)
    body = wagtail_fields.StreamField([
        ("heading", wagtail_blocks.CharBlock()),
        ("paragraph", wagtail_blocks.RichTextBlock()),
        ("section", SectionBlock()),
        ("image", wagtail_image_blocks.ImageChooserBlock()),
    ])

    content_panels = wagtail_models.Page.content_panels + [
        wagtail_panels.FieldPanel("description"),
        wagtail_panels.FieldPanel("excerpt"),
        wagtail_panels.FieldPanel("authors"),
        wagtail_panels.FieldPanel("date"),
        wagtail_panels.FieldPanel("tags"),
        wagtail_panels.FieldPanel("categories"),
        wagtail_image_panels.ImageChooserPanel("featured_image"),
        wagtail_panels.StreamFieldPanel("body"),
    ]

    parent_page_types = ["home.PostIndexPage"]
    subpage_types = []

    def set_url_path(self, parent):
        super().set_url_path(parent=parent)
        self.url_path = self.url_path.replace(
            self.slug, "{:%Y/%b/%d/}".format(self.date).lower() + self.slug)
Exemple #16
0
class DocsPage(Page):
    body = fields.StreamField([
        ('documents_list', cms_blocks.DocsBlock()),
        ('header',
         blocks.CharBlock(template='meinberlin_cms/blocks/header.html'))
    ])

    description = fields.RichTextField(blank=True)

    content_panels = Page.content_panels + [
        edit_handlers.FieldPanel('description'),
        edit_handlers.StreamFieldPanel('body'),
    ]

    class Meta:
        verbose_name = 'Documents'

    subpage_types = []
Exemple #17
0
class SimplePage(Page):
    body = fields.RichTextField(blank=True)
    body_block = fields.StreamField(
        [('text',
          blocks.RichTextBlock(icon='doc-full',
                               template='home/blocks/text.html')),
         ('html', blocks.RawHTMLBlock(template='home/blocks/text.html')),
         ('teasers', TeaserListBlock()), ('columns', ColumnsListBlock()),
         ('projects', CurrentProjectsListBlock()),
         ('updates', UpdatesBlock())],
        blank=True)

    content_panels = [
        edit_handlers.FieldPanel('title'),
        edit_handlers.FieldPanel('body'),
        edit_handlers.StreamFieldPanel('body_block'),
    ]

    parent_page_types = ['home.HomePage']
    subpage_types = []
Exemple #18
0
class HomePage(RoutablePageMixin, Page):
    template = 'home/home_page.html'

    banner_title = models.CharField(max_length=100, null=True, blank=True)

    banner_subtitle = fields.RichTextField(
        features=["bold", "italic", "image"], null=True, blank=True)
    banner_image = models.ForeignKey("wagtailimages.Image",
                                     on_delete=models.SET_NULL,
                                     null=True,
                                     blank=True,
                                     related_name="image")
    banner_cta = models.ForeignKey("wagtailcore.Page",
                                   on_delete=models.SET_NULL,
                                   null=True,
                                   blank=True,
                                   related_name="link")

    staff_card = fields.StreamField([
        ("cards", blocks.CardBlock()),
    ],
                                    null=True,
                                    blank=True)

    api_fields = [
        banner_title, banner_subtitle, banner_image, banner_cta, staff_card
    ]

    content_panels = Page.content_panels + [
        eh.FieldPanel("banner_title"),
        eh.FieldPanel("banner_subtitle"),
        ImageChooserPanel("banner_image"),
        eh.PageChooserPanel("banner_cta"),
        eh.StreamFieldPanel("staff_card"),
    ]

    class Meta:
        verbose_name = "HOME PAGE"
        verbose_name_plural = "HOME PAGES"
Exemple #19
0
class ServicePage(Page, ContentPageMixin):
    date = models.DateField("Service date")
    description = wtfields.RichTextField(
        blank=True,
        default=
        "Please join us for our Sunday service as we worship and listen to God's word.",
    )
    stream_link = models.URLField(default="", blank=True)
    public_stream_link = models.URLField(default="", blank=True)
    chat_enabled = models.BooleanField(default=True)
    weekly_theme = models.CharField(max_length=128, default="", blank=True)

    bulletin = wtfields.StreamField(
        [
            ("bulletin_section",
             BulletinSectionBlock(name="Bulletin Section")),
        ],
        blank=True,
    )

    # service = wtfields.StreamField([
    #     ('worship_section', WorshipSectionBlock(name="Worship Section")),
    #     ('announcements_section', AnnouncementsSectionBlock(name="Announcement Section")),
    #     ('sermon_section', SermonSectionBlock(name="Sermon Section")),
    #     ('discussion_section', DiscussionSectionBlock(name="Discussion Section")),
    #     # TODO
    #     # - polls/voting?
    #     # - feedback
    #     # - discussion
    # ])

    @property
    def getdescription(self):
        return self.description

    content_panels = Page.content_panels + [
        FieldPanel("date"),
        FieldPanel("stream_link"),
        FieldPanel("public_stream_link"),
        FieldPanel("description"),
        InlinePanel("documents", label="Documents"),
        FieldPanel("chat_enabled"),
        StreamFieldPanel("bulletin"),
        FieldPanel("weekly_theme"),
    ]

    prayer_requests = models.ManyToManyField(pr_models.PrayerRequest,
                                             related_name="services_pages")

    def child_pages(self):
        pages = DailyReadingPage.objects.live().descendant_of(self).order_by(
            "-date")
        return pages

    @classmethod
    def current_service_page(cls):
        return cls.objects.all().order_by("date").last()

    def add_prayer_request(self, pr):
        self.prayer_requests.add(pr)

    @property
    def email_attachments(self):
        return [
            doclink.document.file.file for doclink in self.documents.all()
            if doclink.include_in_email
        ]

    def get_context(self, request):
        context = super().get_context(request)
        context["self"] = self
        context["docs"] = self.documents.all()
        return context
Exemple #20
0
class OrganisationSettings(BaseSetting):
    address = fields.RichTextField()
    contacts = fields.RichTextField()

    panels = [FieldPanel('address'), FieldPanel('contacts')]
Exemple #21
0
class Migration(migrations.Migration):

    dependencies = [
        ('wagtaildocs', '0007_merge'),
        ('v1', '0198_recreated'),
        ('wagtailimages', '0019_delete_filter'),
    ]

    operations = [
        migrations.CreateModel(
            name='ActivityAgeRange',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityBloomsTaxonomyLevel',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityBuildingBlock',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
                ('icon',
                 models.ForeignKey(
                     related_name='+',
                     on_delete=django.db.models.deletion.SET_NULL,
                     blank=True,
                     to='wagtailimages.Image',
                     null=True)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityCouncilForEconEd',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityDuration',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityGradeLevel',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityIndexPage',
            fields=[
                ('cfgovpage_ptr',
                 models.OneToOneField(parent_link=True,
                                      auto_created=True,
                                      primary_key=True,
                                      serialize=False,
                                      to='v1.CFGOVPage')),
                ('intro', core_fields.RichTextField(blank=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('v1.cfgovpage', ),
        ),
        migrations.CreateModel(
            name='ActivityJumpStartCoalition',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityPage',
            fields=[
                ('cfgovpage_ptr',
                 models.OneToOneField(parent_link=True,
                                      auto_created=True,
                                      primary_key=True,
                                      serialize=False,
                                      to='v1.CFGOVPage')),
                ('date',
                 models.DateField(default=django.utils.timezone.now,
                                  verbose_name='Updated')),
                ('summary', models.TextField(verbose_name='Summary')),
                ('big_idea',
                 core_fields.RichTextField(verbose_name='Big idea')),
                ('essential_questions',
                 core_fields.RichTextField(
                     verbose_name='Essential questions')),
                ('objectives',
                 core_fields.RichTextField(verbose_name='Objectives')),
                ('what_students_will_do',
                 core_fields.RichTextField(
                     verbose_name='What students will do')),
                ('activity_duration',
                 models.ForeignKey(
                     to='teachers_digital_platform.ActivityDuration',
                     on_delete=django.db.models.deletion.PROTECT)),
                ('activity_file',
                 models.ForeignKey(
                     related_name='+',
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='wagtaildocs.Document',
                     null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('v1.cfgovpage', ),
        ),
        migrations.CreateModel(
            name='ActivitySchoolSubject',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivitySpecialPopulation',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityTeachingStrategy',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityTopic',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivityType',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['title'],
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='activitypage',
            name='activity_type',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityType'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='age_range',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityAgeRange'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='blooms_taxonomy_level',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityBloomsTaxonomyLevel'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='building_block',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityBuildingBlock'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='council_for_economic_education',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityCouncilForEconEd',
                blank=True),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='grade_level',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityGradeLevel'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='handout_file',
            field=models.ForeignKey(
                related_name='+',
                on_delete=django.db.models.deletion.SET_NULL,
                blank=True,
                to='wagtaildocs.Document',
                null=True),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='jump_start_coalition',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityJumpStartCoalition',
                blank=True),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='school_subject',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivitySchoolSubject'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='special_population',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivitySpecialPopulation',
                blank=True),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='teaching_strategy',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityTeachingStrategy'),
        ),
        migrations.AddField(
            model_name='activitypage',
            name='topic',
            field=modelcluster.fields.ParentalManyToManyField(
                to='teachers_digital_platform.ActivityTopic'),
        ),
    ]
Exemple #22
0
class HomePage(Page):

    image_1 = models.ForeignKey(
        'a4_candy_cms_images.CustomImage',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        verbose_name="Header Image 1",
        help_text="The Image that is shown on top of the page")

    image_2 = models.ForeignKey(
        'a4_candy_cms_images.CustomImage',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        verbose_name="Header Image 2",
        help_text="The Image that is shown on top of the page")

    image_3 = models.ForeignKey(
        'a4_candy_cms_images.CustomImage',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        verbose_name="Header Image 3",
        help_text="The Image that is shown on top of the page")

    image_4 = models.ForeignKey(
        'a4_candy_cms_images.CustomImage',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        verbose_name="Header Image 4",
        help_text="The Image that is shown on top of the page")

    image_5 = models.ForeignKey(
        'a4_candy_cms_images.CustomImage',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        verbose_name="Header Image 5",
        help_text="The Image that is shown on top of the page")

    form_page = models.ForeignKey(
        'a4_candy_cms_contacts.FormPage',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
    )

    subtitle_de = models.CharField(max_length=500,
                                   blank=True,
                                   verbose_name="Subtitle")
    subtitle_en = models.CharField(max_length=500,
                                   blank=True,
                                   verbose_name="Subtitle")

    teaser_de = fields.RichTextField(blank=True)
    teaser_en = fields.RichTextField(blank=True)

    body_de = fields.RichTextField(blank=True)
    body_en = fields.RichTextField(blank=True)

    body_streamfield_de = fields.StreamField(
        [('col_list_image_cta_block', cms_blocks.ColumnsImageCTABlock()),
         ('background_cta_block', cms_blocks.ColBackgroundCTABlock()),
         ('columns_cta', cms_blocks.ColumnsCTABlock()),
         ('html', blocks.RawHTMLBlock()),
         ('paragraph', blocks.RichTextBlock()), ('news', NewsBlock()),
         ('use_cases', UseCaseBlock())],
        blank=True)

    body_streamfield_en = fields.StreamField(
        [('col_list_image_cta_block', cms_blocks.ColumnsImageCTABlock()),
         ('background_cta_block', cms_blocks.ColBackgroundCTABlock()),
         ('columns_cta', cms_blocks.ColumnsCTABlock()),
         ('html', blocks.RawHTMLBlock()),
         ('paragraph', blocks.RichTextBlock()), ('news', NewsBlock()),
         ('use_cases', UseCaseBlock())],
        blank=True)

    subtitle = TranslatedField('subtitle_de', 'subtitle_en')

    teaser = TranslatedField('teaser_de', 'teaser_en')

    body_streamfield = TranslatedField('body_streamfield_de',
                                       'body_streamfield_en')

    body = TranslatedField(
        'body_de',
        'body_en',
    )

    @property
    def form(self):
        return self.form_page.get_form()

    @property
    def random_image(self):
        image_numbers = [
            i for i in range(1, 6) if getattr(self, 'image_{}'.format(i))
        ]
        if image_numbers:
            return getattr(self,
                           'image_{}'.format(random.choice(image_numbers)))

    en_content_panels = [
        FieldPanel('subtitle_en'),
        FieldPanel('teaser_en'),
        FieldPanel('body_en'),
        StreamFieldPanel('body_streamfield_en')
    ]

    de_content_panels = [
        FieldPanel('subtitle_de'),
        FieldPanel('teaser_de'),
        FieldPanel('body_de'),
        StreamFieldPanel('body_streamfield_de')
    ]

    common_panels = [
        FieldPanel('title'),
        FieldPanel('slug'),
        PageChooserPanel('form_page', 'a4_candy_cms_contacts.FormPage'),
        MultiFieldPanel([
            ImageChooserPanel('image_1'),
            ImageChooserPanel('image_2'),
            ImageChooserPanel('image_3'),
            ImageChooserPanel('image_4'),
            ImageChooserPanel('image_5'),
        ],
                        heading="Images",
                        classname="collapsible")
    ]

    edit_handler = TabbedInterface([
        ObjectList(common_panels, heading='Common'),
        ObjectList(en_content_panels, heading='English'),
        ObjectList(de_content_panels, heading='German')
    ])

    subpage_types = ['a4_candy_cms_pages.EmptyPage']
Exemple #23
0
class Migration(migrations.Migration):

    replaces = [
        ("wagtailgridder", "0001_initial"),
        ("wagtailgridder", "0002_griditem_landing_page_text"),
        ("wagtailgridder", "0003_remove_griditem_target_url"),
        ("wagtailgridder", "0004_auto_20161103_1446"),
        ("wagtailgridder", "0005_auto_20161117_0715"),
        ("wagtailgridder", "0006_auto_20170217_1354"),
        ("wagtailgridder", "0007_auto_20170217_1404"),
        ("wagtailgridder", "0008_auto_20170320_1707"),
        ("wagtailgridder", "0009_gridindexpage_logo_image"),
        ("wagtailgridder", "0010_auto_20170403_1347"),
        ("wagtailgridder", "0011_auto_20170404_1454"),
        ("wagtailgridder", "0012_auto_20170607_1317"),
    ]

    initial = True

    dependencies = [
        ("wagtailimages", "0018_remove_rendition_filter"),
        ("taggit", "0002_auto_20150616_2121"),
        ("wagtailimages", "0013_make_rendition_upload_callable"),
        ("wagtailcore", "0029_unicode_slugfield_dj19"),
    ]

    operations = [
        migrations.CreateModel(
            name="GridCategory",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=255)),
            ],
            options={
                "verbose_name_plural": "grid categories",
            },
        ),
        migrations.CreateModel(
            name="GridIndexGridItemRelationship",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "sort_order",
                    models.IntegerField(blank=True, editable=False, null=True),
                ),
            ],
            options={
                "ordering": ["sort_order"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="GridIndexPage",
            fields=[
                (
                    "page_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="wagtailcore.Page",
                    ),
                ),
            ],
            options={
                "verbose_name": "Grid Index Page",
            },
            bases=("wagtailcore.page", ),
        ),
        migrations.CreateModel(
            name="GridItem",
            fields=[
                (
                    "page_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="wagtailcore.Page",
                    ),
                ),
                (
                    "summary",
                    core_fields.RichTextField(
                        default="",
                        help_text=
                        'The summary will appear in the item "card" view.',
                        verbose_name="Summary",
                    ),
                ),
                (
                    "full_desc",
                    core_fields.RichTextField(
                        default="",
                        help_text=
                        "The description will appear when the grid item is clicked and expanded.",
                        verbose_name="Full Description",
                    ),
                ),
                (
                    "target_url",
                    models.URLField(
                        blank=True,
                        default="",
                        help_text=
                        "The URL for this grid item, if it is not a full Django App.",
                        verbose_name="URL",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(null=True,
                                         verbose_name="Page Modified"),
                ),
                (
                    "buttons",
                    core_fields.StreamField(
                        ((
                            "button_section",
                            core_blocks.StructBlock(((
                                "action_items",
                                core_blocks.StreamBlock(
                                    (
                                        (
                                            "document_button",
                                            core_blocks.StructBlock(
                                                (
                                                    (
                                                        "label",
                                                        core_blocks.TextBlock(
                                                            required=True),
                                                    ),
                                                    (
                                                        "document",
                                                        docs_blocks.
                                                        DocumentChooserBlock(
                                                            required=True),
                                                    ),
                                                ),
                                                icon="fa-file",
                                            ),
                                        ),
                                        (
                                            "url_button",
                                            core_blocks.StructBlock(
                                                (
                                                    (
                                                        "label",
                                                        core_blocks.TextBlock(
                                                            required=True),
                                                    ),
                                                    (
                                                        "url",
                                                        core_blocks.URLBlock(
                                                            required=True),
                                                    ),
                                                ),
                                                icon="fa-link",
                                            ),
                                        ),
                                        (
                                            "placeholder",
                                            core_blocks.StructBlock(
                                                (), icon="fa-square-o"),
                                        ),
                                    ),
                                    help_text=
                                    "A button or URL within a button section.",
                                ),
                            ), )),
                        ), ),
                        null=True,
                    ),
                ),
                (
                    "main_image",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="wagtailimages.Image",
                    ),
                ),
                (
                    "small_image",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="wagtailimages.Image",
                    ),
                ),
            ],
            options={
                "verbose_name": "Grid Item",
            },
            bases=("wagtailcore.page", ),
        ),
        migrations.CreateModel(
            name="GridItemTag",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "content_object",
                    modelcluster.fields.ParentalKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="tagged_items",
                        to="wagtailgridder.GridItem",
                    ),
                ),
                (
                    "tag",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="wagtailgridder_griditemtag_items",
                        to="taggit.Tag",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="griditem",
            name="tags",
            field=modelcluster.contrib.taggit.ClusterTaggableManager(
                blank=True,
                help_text="A comma-separated list of tags.",
                through="wagtailgridder.GridItemTag",
                to="taggit.Tag",
                verbose_name="Tags",
            ),
        ),
        migrations.AddField(
            model_name="gridindexgriditemrelationship",
            name="grid_relationship",
            field=modelcluster.fields.ParentalKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="grid_index_grid_item_relationship",
                to="wagtailgridder.GridIndexPage",
            ),
        ),
        migrations.AddField(
            model_name="gridindexgriditemrelationship",
            name="grid_item",
            field=models.ForeignKey(
                help_text="Add a grid item to the page",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="wagtailgridder.GridItem",
                verbose_name="Grid Items",
            ),
        ),
        migrations.AddField(
            model_name="griditem",
            name="landing_page_text",
            field=core_fields.RichTextField(
                blank=True,
                help_text=
                "This is the text which will appear on the grid item's landing page.",
                null=True,
                verbose_name="Landing Page Text",
            ),
        ),
        migrations.RemoveField(
            model_name="griditem",
            name="target_url",
        ),
        migrations.RenameField(
            model_name="griditem",
            old_name="main_image",
            new_name="description_image",
        ),
        migrations.RenameField(
            model_name="griditem",
            old_name="full_desc",
            new_name="description_text",
        ),
        migrations.RenameField(
            model_name="griditem",
            old_name="small_image",
            new_name="summary_image",
        ),
        migrations.RenameField(
            model_name="griditem",
            old_name="summary",
            new_name="summary_text",
        ),
        migrations.AlterField(
            model_name="griditem",
            name="buttons",
            field=core_fields.StreamField(
                ((
                    "button_section",
                    core_blocks.StructBlock(((
                        "action_items",
                        core_blocks.StreamBlock(
                            (
                                (
                                    "document_button",
                                    core_blocks.StructBlock(
                                        (
                                            (
                                                "label",
                                                core_blocks.TextBlock(
                                                    required=True),
                                            ),
                                            (
                                                "document",
                                                docs_blocks.
                                                DocumentChooserBlock(
                                                    required=True),
                                            ),
                                        ),
                                        icon="fa-file",
                                    ),
                                ),
                                (
                                    "url_button",
                                    core_blocks.StructBlock(
                                        (
                                            (
                                                "label",
                                                core_blocks.TextBlock(
                                                    required=True),
                                            ),
                                            (
                                                "url",
                                                core_blocks.TextBlock(
                                                    required=True),
                                            ),
                                        ),
                                        icon="fa-link",
                                    ),
                                ),
                                (
                                    "placeholder",
                                    core_blocks.StructBlock(
                                        (), icon="fa-square-o"),
                                ),
                            ),
                            help_text=
                            "A button or URL within a button section.",
                        ),
                    ), )),
                ), ),
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="griditem",
            name="categories",
            field=modelcluster.fields.ParentalManyToManyField(
                blank=True, to="wagtailgridder.GridCategory"),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="featured_grid_item_1",
            field=models.ForeignKey(
                blank=True,
                help_text="First featured grid item underneath the hero image.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="wagtailgridder.GridItem",
                verbose_name="Featured Item One",
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="featured_grid_item_2",
            field=models.ForeignKey(
                blank=True,
                help_text=
                "Second featured grid item underneath the hero image.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="wagtailgridder.GridItem",
                verbose_name="Featured Item Two,",
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="hero_background_image",
            field=models.ForeignKey(
                blank=True,
                help_text=
                "The background image for the hero section. This triggers the section to be displayed if an image is selected.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="wagtailimages.Image",
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="hero_logo_image",
            field=models.ForeignKey(
                blank=True,
                help_text=
                "The logo image to be displayed over the background image.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="wagtailimages.Image",
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="featured_description",
            field=models.TextField(
                blank=True,
                help_text=
                "Text to be displayed below the hero image next to the featured items.",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="hero_button_text",
            field=models.CharField(
                blank=True,
                help_text=
                "Text for the call-to-action button beneath the text and logo over the background image.",
                max_length=255,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="hero_button_url",
            field=models.CharField(
                blank=True,
                help_text=
                "URL for the call-to-action button beneath the text and logo over the background image.",
                max_length=255,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="gridindexpage",
            name="hero_description",
            field=models.TextField(
                blank=True,
                help_text=
                "Text to be displayed beneath the logo over the background image.",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="griditem",
            name="description_video",
            field=models.URLField(
                blank=True,
                help_text=
                "This video will be embedded in the expanded area when populated.",
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="griditem",
            name="description_image",
            field=models.ForeignKey(
                blank=True,
                help_text=
                "This image will appear in the expanded area when populated.",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="wagtailimages.Image",
            ),
        ),
        migrations.AlterField(
            model_name="griditem",
            name="description_text",
            field=core_fields.RichTextField(
                blank=True,
                help_text=
                "This description will appear in the expanded area when populated.",
                null=True,
                verbose_name="Full Description",
            ),
        ),
    ]
class Migration(migrations.Migration):

    replaces = [('wagtailgridder', '0001_initial'), ('wagtailgridder', '0002_griditem_landing_page_text'), ('wagtailgridder', '0003_remove_griditem_target_url'), ('wagtailgridder', '0004_auto_20161103_1446'), ('wagtailgridder', '0005_auto_20161117_0715'), ('wagtailgridder', '0006_auto_20170217_1354'), ('wagtailgridder', '0007_auto_20170217_1404'), ('wagtailgridder', '0008_auto_20170320_1707'), ('wagtailgridder', '0009_gridindexpage_logo_image'), ('wagtailgridder', '0010_auto_20170403_1347'), ('wagtailgridder', '0011_auto_20170404_1454'), ('wagtailgridder', '0012_auto_20170607_1317')]

    initial = True

    dependencies = [
        ('wagtailimages', '0018_remove_rendition_filter'),
        ('taggit', '0002_auto_20150616_2121'),
        ('wagtailimages', '0013_make_rendition_upload_callable'),
        ('wagtailcore', '0029_unicode_slugfield_dj19'),
    ]

    operations = [
        migrations.CreateModel(
            name='GridCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'verbose_name_plural': 'grid categories',
            },
        ),
        migrations.CreateModel(
            name='GridIndexGridItemRelationship',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='GridIndexPage',
            fields=[
                ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
            ],
            options={
                'verbose_name': 'Grid Index Page',
            },
            bases=('wagtailcore.page',),
        ),
        migrations.CreateModel(
            name='GridItem',
            fields=[
                ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
                ('summary', core_fields.RichTextField(default='', help_text='The summary will appear in the item "card" view.', verbose_name='Summary')),
                ('full_desc', core_fields.RichTextField(default='', help_text='The description will appear when the grid item is clicked and expanded.', verbose_name='Full Description')),
                ('target_url', models.URLField(blank=True, default='', help_text='The URL for this grid item, if it is not a full Django App.', verbose_name='URL')),
                ('modified', models.DateTimeField(null=True, verbose_name='Page Modified')),
                ('buttons', core_fields.StreamField((('button_section', core_blocks.StructBlock((('action_items', core_blocks.StreamBlock((('document_button', core_blocks.StructBlock((('label', core_blocks.TextBlock(required=True)), ('document', docs_blocks.DocumentChooserBlock(required=True))), icon='fa-file')), ('url_button', core_blocks.StructBlock((('label', core_blocks.TextBlock(required=True)), ('url', core_blocks.URLBlock(required=True))), icon='fa-link')), ('placeholder', core_blocks.StructBlock((), icon='fa-square-o'))), help_text='A button or URL within a button section.')),))),), null=True)),
                ('main_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
                ('small_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
            ],
            options={
                'verbose_name': 'Grid Item',
            },
            bases=('wagtailcore.page',),
        ),
        migrations.CreateModel(
            name='GridItemTag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content_object', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='tagged_items', to='wagtailgridder.GridItem')),
                ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wagtailgridder_griditemtag_items', to='taggit.Tag')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='griditem',
            name='tags',
            field=modelcluster.contrib.taggit.ClusterTaggableManager(blank=True, help_text='A comma-separated list of tags.', through='wagtailgridder.GridItemTag', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='gridindexgriditemrelationship',
            name='grid_relationship',
            field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='grid_index_grid_item_relationship', to='wagtailgridder.GridIndexPage'),
        ),
        migrations.AddField(
            model_name='gridindexgriditemrelationship',
            name='grid_item',
            field=models.ForeignKey(help_text='Add a grid item to the page', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailgridder.GridItem', verbose_name='Grid Items'),
        ),
        migrations.AddField(
            model_name='griditem',
            name='landing_page_text',
            field=core_fields.RichTextField(blank=True, help_text="This is the text which will appear on the grid item's landing page.", null=True, verbose_name='Landing Page Text'),
        ),
        migrations.RemoveField(
            model_name='griditem',
            name='target_url',
        ),
        migrations.RenameField(
            model_name='griditem',
            old_name='main_image',
            new_name='description_image',
        ),
        migrations.RenameField(
            model_name='griditem',
            old_name='full_desc',
            new_name='description_text',
        ),
        migrations.RenameField(
            model_name='griditem',
            old_name='small_image',
            new_name='summary_image',
        ),
        migrations.RenameField(
            model_name='griditem',
            old_name='summary',
            new_name='summary_text',
        ),
        migrations.AlterField(
            model_name='griditem',
            name='buttons',
            field=core_fields.StreamField((('button_section', core_blocks.StructBlock((('action_items', core_blocks.StreamBlock((('document_button', core_blocks.StructBlock((('label', core_blocks.TextBlock(required=True)), ('document', docs_blocks.DocumentChooserBlock(required=True))), icon='fa-file')), ('url_button', core_blocks.StructBlock((('label', core_blocks.TextBlock(required=True)), ('url', core_blocks.TextBlock(required=True))), icon='fa-link')), ('placeholder', core_blocks.StructBlock((), icon='fa-square-o'))), help_text='A button or URL within a button section.')),))),), null=True),
        ),
        migrations.AddField(
            model_name='griditem',
            name='categories',
            field=modelcluster.fields.ParentalManyToManyField(blank=True, to='wagtailgridder.GridCategory'),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='featured_grid_item_1',
            field=models.ForeignKey(blank=True, help_text='First featured grid item underneath the hero image.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailgridder.GridItem', verbose_name='Featured Item One'),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='featured_grid_item_2',
            field=models.ForeignKey(blank=True, help_text='Second featured grid item underneath the hero image.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailgridder.GridItem', verbose_name='Featured Item Two,'),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='hero_background_image',
            field=models.ForeignKey(blank=True, help_text='The background image for the hero section. This triggers the section to be displayed if an image is selected.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='hero_logo_image',
            field=models.ForeignKey(blank=True, help_text='The logo image to be displayed over the background image.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='featured_description',
            field=models.TextField(blank=True, help_text='Text to be displayed below the hero image next to the featured items.', null=True),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='hero_button_text',
            field=models.CharField(blank=True, help_text='Text for the call-to-action button beneath the text and logo over the background image.', max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='hero_button_url',
            field=models.CharField(blank=True, help_text='URL for the call-to-action button beneath the text and logo over the background image.', max_length=255, null=True),
        ),
        migrations.AddField(
            model_name='gridindexpage',
            name='hero_description',
            field=models.TextField(blank=True, help_text='Text to be displayed beneath the logo over the background image.', null=True),
        ),
        migrations.AddField(
            model_name='griditem',
            name='description_video',
            field=models.URLField(blank=True, help_text='This video will be embedded in the expanded area when populated.', null=True),
        ),
        migrations.AlterField(
            model_name='griditem',
            name='description_image',
            field=models.ForeignKey(blank=True, help_text='This image will appear in the expanded area when populated.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'),
        ),
        migrations.AlterField(
            model_name='griditem',
            name='description_text',
            field=core_fields.RichTextField(blank=True, help_text='This description will appear in the expanded area when populated.', null=True, verbose_name='Full Description'),
        ),
    ]
Exemple #25
0
class Migration(migrations.Migration):

    replaces = [
        ('jobmanager', '0001_initial'),
        ('jobmanager', '0002_auto_20160809_1619'),
        ('jobmanager', '0003_auto_20160814_2044'),
        ('jobmanager', '0004_auto_20160815_1008'),
        ('jobmanager', '0005_auto_20160815_1457'),
        ('jobmanager', '0006_auto_20160815_1705'),
        ('jobmanager', '0007_create_careers_pages'),
        ('jobmanager', '0008_migrate_job_pages'),
        ('jobmanager', '0009_django_cleanup'),
        ('jobmanager', '0010_cleanup_unused_fields'),
        ('jobmanager', '0011_delete_fellowshipupdatelist'),
        ('jobmanager', '0012_jobs_have_one_region'),
        ('jobmanager', '0013_job_region_to_location'),
        ('jobmanager', '0014_add_city_and_state'),
        ('jobmanager', '0015_remove_tinymce'),
        ('jobmanager', '0016_add_job_length_and_service_type'),
    ]

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='ApplicantType',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('applicant_type', models.CharField(max_length=255)),
                ('display_title',
                 models.CharField(max_length=255, null=True, blank=True)),
                ('description', models.TextField()),
            ],
            options={
                'ordering': ['applicant_type'],
            },
        ),
        migrations.CreateModel(
            name='City',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(max_length=255, verbose_name='City name')),
            ],
            options={
                'ordering': ('state_id', 'name'),
            },
        ),
        migrations.CreateModel(
            name='EmailApplicationLink',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('sort_order',
                 models.IntegerField(null=True, editable=False, blank=True)),
                ('address', models.EmailField(max_length=254)),
                ('label', models.CharField(max_length=255)),
                ('description', models.TextField(null=True, blank=True)),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Grade',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('grade', models.CharField(max_length=32)),
                ('salary_min', models.IntegerField()),
                ('salary_max', models.IntegerField()),
            ],
            options={
                'ordering': ['grade'],
            },
        ),
        migrations.CreateModel(
            name='GradePanel',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('sort_order',
                 models.IntegerField(null=True, editable=False, blank=True)),
            ],
            options={
                'ordering': ('grade', ),
            },
        ),
        migrations.CreateModel(
            name='JobCategory',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('job_category', models.CharField(max_length=255)),
                ('blurb', core_fields.RichTextField(null=True, blank=True)),
            ],
            options={
                'ordering': ['job_category'],
            },
        ),
        migrations.CreateModel(
            name='JobLength',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('job_length', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['job_length'],
            },
        ),
    ]
class Migration(migrations.Migration):

    replaces = [
        ('jobmanager', '0001_initial'),
        ('jobmanager', '0002_auto_20160809_1619'),
        ('jobmanager', '0003_auto_20160814_2044'),
        ('jobmanager', '0004_auto_20160815_1008'),
        ('jobmanager', '0005_auto_20160815_1457'),
        ('jobmanager', '0006_auto_20160815_1705'),
        ('jobmanager', '0007_create_careers_pages'),
        ('jobmanager', '0008_migrate_job_pages'),
        ('jobmanager', '0009_django_cleanup'),
        ('jobmanager', '0010_cleanup_unused_fields'),
        ('jobmanager', '0011_delete_fellowshipupdatelist'),
        ('jobmanager', '0012_jobs_have_one_region'),
        ('jobmanager', '0013_job_region_to_location'),
        ('jobmanager', '0014_add_city_and_state'),
        ('jobmanager', '0015_remove_tinymce'),
        ('jobmanager', '0016_add_job_length_and_service_type'),
    ]

    dependencies = [
        ('jobmanager', '0017_recreated'),
        ('v1', '0198_recreated'),
    ]

    operations = [
        migrations.CreateModel(
            name='JobListingPage',
            fields=[
                ('cfgovpage_ptr',
                 models.OneToOneField(parent_link=True,
                                      auto_created=True,
                                      primary_key=True,
                                      serialize=False,
                                      to='v1.CFGOVPage')),
                ('description',
                 core_fields.RichTextField(verbose_name='Summary')),
                ('open_date', models.DateField(verbose_name='Open date')),
                ('close_date', models.DateField(verbose_name='Close date')),
                ('salary_min',
                 models.DecimalField(verbose_name='Minimum salary',
                                     max_digits=11,
                                     decimal_places=2)),
                ('salary_max',
                 models.DecimalField(verbose_name='Maximum salary',
                                     max_digits=11,
                                     decimal_places=2)),
                ('allow_remote',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Adds remote option to jobs with office locations.',
                     verbose_name='Location can also be remote')),
                ('responsibilities',
                 core_fields.RichTextField(null=True,
                                           verbose_name='Responsibilities',
                                           blank=True)),
                ('travel_required',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Optional: Check to add a "Travel required" section to the job description. Section content defaults to "Yes".'
                 )),
                ('travel_details',
                 core_fields.RichTextField(
                     help_text=
                     'Optional: Add content for "Travel required" section.',
                     null=True,
                     blank=True)),
                ('additional_section_title',
                 models.CharField(
                     help_text=
                     'Optional: Add title for an additional section that will display at end of job description.',
                     max_length=255,
                     null=True,
                     blank=True)),
                ('additional_section_content',
                 core_fields.RichTextField(
                     help_text=
                     'Optional: Add content for an additional section that will display at end of job description.',
                     null=True,
                     blank=True)),
                ('division',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='jobmanager.JobCategory',
                                   null=True)),
                ('job_length',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   verbose_name='Position length',
                                   blank=True,
                                   to='jobmanager.JobLength',
                                   null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('v1.cfgovpage', ),
        ),
        migrations.CreateModel(
            name='JobLocation',
            fields=[
                ('abbreviation',
                 models.CharField(max_length=2,
                                  serialize=False,
                                  primary_key=True)),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ('abbreviation', ),
            },
        ),
        migrations.CreateModel(
            name='ServiceType',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('service_type', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ['service_type'],
            },
        ),
        migrations.CreateModel(
            name='State',
            fields=[
                ('name',
                 models.CharField(max_length=255, verbose_name='State name')),
                ('abbreviation',
                 models.CharField(max_length=2,
                                  serialize=False,
                                  primary_key=True)),
            ],
            options={
                'ordering': ('abbreviation', ),
            },
        ),
        migrations.CreateModel(
            name='USAJobsApplicationLink',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('sort_order',
                 models.IntegerField(null=True, editable=False, blank=True)),
                ('announcement_number', models.CharField(max_length=128)),
                ('url', models.URLField(max_length=255)),
                ('applicant_type',
                 models.ForeignKey(related_name='usajobs_application_links',
                                   to='jobmanager.ApplicantType')),
                ('job_listing',
                 modelcluster.fields.ParentalKey(
                     related_name='usajobs_application_links',
                     to='jobmanager.JobListingPage')),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Office',
            fields=[
                ('joblocation_ptr',
                 models.OneToOneField(parent_link=True,
                                      auto_created=True,
                                      primary_key=True,
                                      serialize=False,
                                      to='jobmanager.JobLocation')),
            ],
            options={
                'abstract': False,
            },
            bases=('jobmanager.joblocation', ),
        ),
        migrations.CreateModel(
            name='Region',
            fields=[
                ('joblocation_ptr',
                 models.OneToOneField(parent_link=True,
                                      auto_created=True,
                                      primary_key=True,
                                      serialize=False,
                                      to='jobmanager.JobLocation')),
            ],
            options={
                'abstract': False,
            },
            bases=('jobmanager.joblocation', ),
        ),
        migrations.AddField(
            model_name='joblistingpage',
            name='location',
            field=models.ForeignKey(
                related_name='job_listings',
                on_delete=django.db.models.deletion.PROTECT,
                to='jobmanager.JobLocation'),
        ),
        migrations.AddField(
            model_name='joblistingpage',
            name='service_type',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                blank=True,
                to='jobmanager.ServiceType',
                null=True),
        ),
        migrations.AddField(
            model_name='gradepanel',
            name='grade',
            field=models.ForeignKey(related_name='grade_panels',
                                    to='jobmanager.Grade'),
        ),
        migrations.AddField(
            model_name='gradepanel',
            name='job_listing',
            field=modelcluster.fields.ParentalKey(
                related_name='grades', to='jobmanager.JobListingPage'),
        ),
        migrations.AddField(
            model_name='emailapplicationlink',
            name='job_listing',
            field=modelcluster.fields.ParentalKey(
                related_name='email_application_links',
                to='jobmanager.JobListingPage'),
        ),
        migrations.AddField(
            model_name='city',
            name='location',
            field=modelcluster.fields.ParentalKey(related_name='cities',
                                                  to='jobmanager.JobLocation'),
        ),
        migrations.AddField(
            model_name='city',
            name='state',
            field=models.ForeignKey(related_name='cities',
                                    default=None,
                                    to='jobmanager.State'),
        ),
        migrations.AddField(
            model_name='state',
            name='region',
            field=modelcluster.fields.ParentalKey(related_name='states',
                                                  to='jobmanager.Region'),
        ),
    ]