Beispiel #1
0
class EventPageSpeaker(Orderable, LinkFields):
    page = ParentalKey('tests.EventPage',
                       related_name='speakers',
                       on_delete=models.CASCADE)
    first_name = models.CharField("Name", max_length=255, blank=True)
    last_name = models.CharField("Surname", max_length=255, blank=True)
    image = models.ForeignKey('wagtailimages.Image',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+')

    @property
    def name_display(self):
        return self.first_name + " " + self.last_name

    panels = [
        FieldPanel('first_name'),
        FieldPanel('last_name'),
        ImageChooserPanel('image'),
        MultiFieldPanel(LinkFields.panels, "Link"),
    ]
Beispiel #2
0
class Location(ClusterableModel):
    TX = 'TX'
    STATE_CHOICES = ((TX, 'Texas'), )

    USA = 'United States'
    COUNTRY_CHOICES = ((USA, 'United States'), )

    name = models.CharField(max_length=DEFAULT_MAX_LENGTH)
    street = models.TextField()
    city = models.CharField(max_length=DEFAULT_MAX_LENGTH, default='Austin')
    state = models.CharField(max_length=2, choices=STATE_CHOICES, default=TX)
    country = models.CharField(max_length=100,
                               choices=COUNTRY_CHOICES,
                               default=USA)
    zip = models.CharField(max_length=50)

    panels = [
        FieldPanel('name'),
        MultiFieldPanel(children=[
            FieldPanel('street'),
            FieldPanel('city', classname='col5'),
            FieldPanel('state', classname='col4'),
            FieldPanel('zip', classname='col2'),
            FieldPanel('country', classname='col5'),
        ],
                        heading='Location'),
    ]

    api_fields = [
        'name',
        'street',
        'city',
        'state',
        'country',
        'zip',
    ]

    def __str__(self):
        return self.name
Beispiel #3
0
class AnswerPage(Page):

    #database fields
    #date = models.DateField("Post Date")
    question = models.ForeignKey(Question)
    text = models.CharField(max_length=1000)
    correct = models.BooleanField()

    search_fields = Page.search_fields + [
        index.SearchField('question'),
        index.SearchField('text'),
        #index.FilterField('date'),
    ]

    # editor panels configuration

    content_panels = Page.content_panels + [
        #MultiFieldPanel([
        #	FieldPanel('date'),
        #	#FieldPanel('tags'),
        #], heading = 'Answer information'),
        FieldPanel('question'),
        FieldPanel('text', classname="full"),
        #InlinePanel('question_images', label="Question images"),
        #InlinePanel('related_links', label="Related links"),
    ]

    promote_panels = [
        MultiFieldPanel(Page.promote_panels, "Common page configuration"),
        #ImageChooserPanel('feed_image'),
    ]

    # parent page/subpage type rules

    parent_page_types = ['courses.QuestionPage']
    subpage_types = ['courses.UserAnswerPage']

    def __str__(self):
        return self.text
Beispiel #4
0
class CarouselItem(LinkFields):
    image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )
    embed_url = models.URLField("Embed URL", blank=True)
    caption = models.CharField(max_length=255, blank=True)
    
    panels = [
        ImageChooserPanel('image'),
        FieldPanel('embed_url'),
        FieldPanel('caption'),
        MultiFieldPanel(LinkFields.panels, "Link"),
    ]

    api_fields = ['image', 'embed_url', 'caption'] + LinkFields.api_fields

    class Meta:
        abstract = True
Beispiel #5
0
class BlogPage(Page):
    date = models.DateField("Post date")
    intro = models.CharField(max_length=250, blank=True)
    main_feature = models.BooleanField(default=False)
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
    ])
    tags = ClusterTaggableManager(through=BlogPageTag, blank=True)
    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
    authors = models.CharField(max_length=255, default="Buckanjären")

    def main_image(self):
        gallery_item = self.gallery_images.first()
        if gallery_item:
            return gallery_item.image
        else:
            return None

    search_fields = Page.search_fields + [
        index.SearchField('intro'),
        index.SearchField('body'),
    ]

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('date'),
            FieldPanel('tags'),
            FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
            FieldPanel('main_feature', widget=forms.CheckboxSelectMultiple),
        ],
                        heading="Blog information"),
        FieldPanel('intro'),
        FieldPanel('authors'),
        StreamFieldPanel('body'),
        InlinePanel('gallery_images', label="Gallery images"),
    ]
Beispiel #6
0
class FaqPage(TranslationMixin, ModelMeta, Page):
    class Meta:
        verbose_name = _('Запись в FAQ')
        verbose_name_plural = _('Записи в FAQ')

    date = models.DateField("Post date of FAQ")
    body = RichTextField(blank=True)

    def get_absolute_url(self):
        abs_url = Page.get_site(self).root_url
        return abs_url + self.url

    def get_context(self, request):
        context = super(FaqPage, self).get_context(request)
        context['meta'] = self.as_meta(request)
        return context

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('date'),
        ], heading="FAQ information"),
        FieldPanel('body'),
    ]

    search_fields = Page.search_fields + [
        index.SearchField('title'),
        index.SearchField('body'),
    ]

    _metadata = {
        'title': 'title',
        'use_title_tag': 'title',
        'description': 'body',
        'url': 'url',
        'site_name': 'wisemarker.com',
        'published_time': 'first_published_at',
        'modified_time': 'latest_revision_created_at',
    }
Beispiel #7
0
class Job(ClusterableModel, index.Indexed):
    title = CharField(max_length=255, unique=True)
    background = RichTextField(blank=True)
    responsibilities = RichTextField(blank=True)
    skills = RichTextField(blank=True)
    notes = RichTextField(blank=True)
    location = RichTextField(blank=True)
    benefits = RichTextField(blank=True)
    applying = RichTextField(blank=True)
    core_technologies = RichTextField(blank=True)
    referrals = RichTextField(blank=True)
    preferred = RichTextField(blank=True)
    qualifications = RichTextField(blank=True)
    experience_we_need = RichTextField(blank=True)

    panels = [
        MultiFieldPanel([
            FieldPanel('title'),
            FieldPanel('background'),
            FieldPanel('responsibilities'),
            FieldPanel('skills'),
            FieldPanel('notes'),
            FieldPanel('location'),
            FieldPanel('core_technologies'),
            FieldPanel('qualifications'),
            FieldPanel('experience_we_need'),
            FieldPanel('preferred'),
            FieldPanel('referrals'),
            FieldPanel('benefits'),
            FieldPanel('applying'),
        ]),
    ]

    class Meta:
        ordering = ['title']

    def __str__(self):
        return '{self.title}'.format(self=self)
class SectionPage(Page):

    # Database fields
    category = StreamField([('cat_title_class',
                             blocks.CharBlock(classname="full")),
                            ('cat_title', blocks.CharBlock(classname="full"))])
    body = StreamField(InfowebStreamBlock())
    recently = models.TextField()
    date = models.DateField("Post date")
    feed_image = models.ForeignKey('wagtailimages.Image',
                                   null=True,
                                   blank=True,
                                   on_delete=models.SET_NULL,
                                   related_name='+')

    # Search index configuraiton

    search_fields = Page.search_fields + (
        index.SearchField('body'),
        index.FilterField('date'),
    )

    # Editor panels configuration

    content_panels = Page.content_panels + [
        StreamFieldPanel('category'),
        StreamFieldPanel('body'),
        FieldPanel('date'),
        FieldPanel('recently', classname="full"),
    ]

    promote_panels = [
        MultiFieldPanel(Page.promote_panels, "Common page configuration"),
        ImageChooserPanel('feed_image'),
    ]

    # Parent page / subpage type rules
    subpage_types = ['NavPage']
Beispiel #9
0
class EventPage(Page):
    class Meta:
        verbose_name = 'Event'

    description = RichTextField()
    location = models.TextField()
    start_date = models.DateTimeField()
    end_date = models.DateTimeField()

    facebook_event = models.URLField(null=True,
                                     blank=True,
                                     verbose_name='Facebook Event URL')
    ussu_event = models.URLField(null=True,
                                 blank=True,
                                 verbose_name='Students Union Event Page URL')

    featured_image = models.ForeignKey('wagtailimages.Image',
                                       null=True,
                                       blank=True,
                                       on_delete=models.SET_NULL,
                                       related_name='+')

    content_panels = Page.content_panels + [
        FieldPanel('featured_image'),
        FieldPanel('location'),
        FieldPanel('start_date'),
        FieldPanel('end_date'),
        FieldPanel('description'),
        FieldPanel('facebook_event'),
        FieldPanel('ussu_event'),
    ]

    promote_panels = [
        MultiFieldPanel(Page.promote_panels, "Common page configuration"),
    ]

    parent_page_types = ['news.NewsEventsIndexPage']
    subpage_types = ['shows.ShowAudioSeriesIndexPage', 'shows.ShowContentPage']
Beispiel #10
0
class ContactPage(Page):
    def get_context(self, request):
        context = super(ContactPage, self).get_context(request)
        context.update(get_base_context())
        context.update({'api_key': settings.GOOGLE_MAPS_V3_APIKEY})
        return context

    map_address = models.CharField(max_length=250)
    location = models.CharField(max_length=250)
    zoom = models.IntegerField(null=True)

    address = RichTextField(blank=True)
    contact = RichTextField(blank=True)
    other_info = RichTextField(blank=True)

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('map_address'),
            GeoPanel('location', address_field='map_address'),
            FieldPanel('zoom'),
        ], ('Google Map configuration')),
        FieldPanel('address', classname="full"),
        FieldPanel('contact', classname="full"),
        FieldPanel('other_info', classname="full"),
        InlinePanel('receiver_emails', label="Adresses emails receveurs"),
    ]

    @cached_property
    def point(self):
        return geosgeometry_str_to_struct(self.location)

    @property
    def lat(self):
        return self.point['y']

    @property
    def lng(self):
        return self.point['x']
Beispiel #11
0
class CollectingAreaPage(PublicBasePage, LibGuide):
    """
    Content type for collecting area pages.
    """
    subject = models.ForeignKey('subjects.Subject',
                                null=True,
                                blank=False,
                                on_delete=models.SET_NULL,
                                related_name='%(app_label)s_%(class)s_related')
    collecting_statement = models.TextField(null=False, blank=False)

    subpage_types = []

    content_panels = Page.content_panels + [
        FieldPanel('subject'),
        FieldPanel('collecting_statement'),
        InlinePanel('subject_specialist_placement',
                    label='Subject Specialist'),
        InlinePanel('stacks_ranges', label='Stacks Ranges'),
        InlinePanel('reference_location_placements',
                    label='Reference Locations'),
        InlinePanel('highlighted_collection_placements',
                    label='Highlighted Collections'),
        InlinePanel('regional_collections', label='Regional Collections'),
        MultiFieldPanel([
            FieldPanel('guide_link_text'),
            FieldPanel('guide_link_url'),
        ],
                        heading='Primary Guide'),
        InlinePanel('lib_guides', label='Other Guides'),
    ] + PublicBasePage.content_panels

    search_fields = PublicBasePage.search_fields + [
        index.SearchField('subject'),
        index.SearchField('collecting_statement'),
        index.SearchField('guide_link_text'),
        index.SearchField('guide_link_url'),
    ]
Beispiel #12
0
class BlogEntry(OpenGraphMixin, Page):
    """Page for a single blog entry."""

    blog_date = models.DateField("Blog Entry Date")
    blog_author = models.CharField(max_length=255)
    blog_tags = ClusterTaggableManager(through=BlogEntryTag, blank=True)

    body = StreamField([
        ('banner_image', common_blocks.BannerImage()),
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', common_blocks.CaptionImageBlock()),
        ('h1', common_blocks.HeaderH1(classname="full title")),
        ('subhead', common_blocks.Subhead(classname="full title")),
        ('block_quote', common_blocks.BlockQuote()),
        ('call_to_action', common_blocks.CallToAction()),
        ('small_call_to_action', common_blocks.CTAButton()),
    ])

    search_fields = Page.search_fields + [
        index.SearchField('body'),
    ]

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('blog_date'),
            FieldPanel('blog_author'),
            FieldPanel('blog_tags'),
        ],
                        heading="Blog information"),
        StreamFieldPanel('body'),
    ]

    def save(self, *args, **kwargs):
        """Override to have a more specific slug w/ date & title."""
        self.slug = "{0}-{1}".format(self.blog_date.strftime("%Y-%m-%d"),
                                     slugify(self.title))
        super().save(*args, **kwargs)
Beispiel #13
0
class GeoPage(Page):
    address = models.CharField(max_length=250, blank=True, null=True)
    location = models.PointField(srid=4326, null=True, blank=True)

    content_panels = Page.content_panels + [
        InlinePanel('related_locations', label="Related locations"),
    ]

    location_panels = [
        MultiFieldPanel([
            FieldPanel('address'),
            GeoPanel('location', address_field='address'),
        ],
                        heading='Location')
    ]

    edit_handler = TabbedInterface([
        ObjectList(content_panels, heading='Content'),
        ObjectList(location_panels, heading='Location'),
        ObjectList(Page.settings_panels,
                   heading='Settings',
                   classname="settings"),
    ])
class HomePageContentItem(Orderable, LinkFields):
    page = ParentalKey('pages.HomePage', related_name='content_items')
    image = models.ForeignKey('wagtailimages.Image',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+')
    title = models.CharField(max_length=100)
    content = RichTextField(
        null=True,
        blank=True,
    )
    summary = RichTextField(blank=True)
    slug = models.SlugField()

    panels = [
        FieldPanel('title'),
        ImageChooserPanel('image'),
        FieldPanel('summary'),
        FieldPanel('content'),
        FieldPanel('slug'),
        MultiFieldPanel(LinkFields.panels, "Link"),
    ]
class Region(models.Model):
    name = models.CharField(max_length=128, verbose_name=("Region"))
    image = models.ForeignKey('wagtailimages.Image',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+')

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = 'Country Region'

    panels = [
        MultiFieldPanel(
            [
                FieldPanel('name'),
                ImageChooserPanel('image'),
            ],
            heading="country details",
        )
    ]
Beispiel #16
0
class FormPage(AbstractEmailForm):
    intro = RichTextField(blank=True)
    followup_text = RichTextField(blank=True)
    subtitle = RichTextField(default='Get in touch')
    thank_you_text = RichTextField(blank=True)

    content_panels = AbstractEmailForm.content_panels + [
        FormSubmissionsPanel(),
        FieldPanel('subtitle', classname="full"),
        FieldPanel('intro', classname="full"),
        InlinePanel('form_fields', label="Form fields"),
        FieldPanel('followup_text', classname="full"),
        FieldPanel('thank_you_text', classname="full"),
        MultiFieldPanel([
            FieldRowPanel([
                FieldPanel('from_address', classname="col6"),
                FieldPanel('to_address', classname="col6"),
            ]),
            FieldPanel('subject'),
        ], "Email"),
    ]

    form_builder = CaptchaFormBuilder
Beispiel #17
0
class Advert(LinkFields):
    page = models.ForeignKey(
        Page,
        related_name='adverts',
        null=True,
        blank=True
    )
    title = models.CharField(max_length=150, null=True)
    image = models.ForeignKey(
        Image, null=True, blank=True, on_delete=models.SET_NULL
    )
    text = RichTextField(blank=True)

    panels = [
        PageChooserPanel('page'),
        FieldPanel('title'),
        ImageChooserPanel('image'),
        FieldPanel('text'),
        MultiFieldPanel(LinkFields.panels, "Link"),
    ]

    def __unicode__(self):
        return self.title
Beispiel #18
0
class ProjectPage(Page):
    heading = RichTextField()
    summary = models.TextField(blank=True)
    content = StreamField([("image", ImageChooserBlock()),
                           ("embed", EmbedBlock()),
                           ("blockquote", blocks.BlockQuoteBlock()),
                           ("text", blocks.RichTextBlock())],
                          default=None)
    concept = RichTextField(blank=True)
    tech = RichTextField(blank=True)
    legend = StreamField(LegendBlock(), default=None)

    content_panels = Page.content_panels + [
        FieldPanel("heading"),
        InlinePanel("images", label="Cover and carousel images", min_num=1),
        FieldPanel("summary"),
        StreamFieldPanel("content"),
        FieldPanel("concept"),
        FieldPanel("tech"),
        MultiFieldPanel([InlinePanel("cta", min_num=None)],
                        heading="Call to action/s"),
        StreamFieldPanel("legend")
    ]
Beispiel #19
0
class FormPage(AbstractEmailForm):
    hero = models.ForeignKey('wagtailimages.Image',
                             null=True,
                             blank=True,
                             on_delete=models.SET_NULL,
                             related_name='+')
    intro = RichTextField(blank=True)
    sidebar = StreamField([('callout', SidebarCallOutBlock()),
                           ('call_to_action', CallToActionBlock())])
    thank_you_text = RichTextField(blank=True)

    content_panels = AbstractEmailForm.content_panels + [
        ImageChooserPanel('hero'),
        FieldPanel('intro'),
        StreamFieldPanel('sidebar'),
        InlinePanel('form_fields', label="Form fields"),
        FieldPanel('thank_you_text', classname="full"),
        MultiFieldPanel([
            FieldPanel('to_address', classname="full"),
            FieldPanel('from_address', classname="full"),
            FieldPanel('subject', classname="full"),
        ], "Email")
    ]
Beispiel #20
0
class ProgramFaculty(Orderable):
    """
    Faculty for the program
    """
    program_page = ParentalKey(ProgramPage, related_name='faculty_members')
    name = models.CharField(max_length=255,
                            help_text='Full name of the faculty member')
    title = models.CharField(max_length=20, blank=True)
    short_bio = models.CharField(max_length=200, blank=True)
    image = models.ForeignKey(Image,
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+',
                              help_text='Image for the faculty member')
    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('name'),
            FieldPanel('title'),
            FieldPanel('short_bio'),
            FieldPanel('image'),
        ])
    ]
Beispiel #21
0
class CategoryLandingPage(Page, CossBaseModel):
    """Category Landing page for Open Source Clubs."""
    heading_text = fields.RichTextField(
        verbose_name='Text',
        blank=True,
        default='',
    )
    heading_cta_text = models.CharField(verbose_name='CTA Text',
                                        blank=True,
                                        default='',
                                        max_length=50)
    heading_cta_link = models.URLField(verbose_name='CTA Link',
                                       blank=True,
                                       default='')

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('heading_text'),
            FieldPanel('heading_cta_text'),
            FieldPanel('heading_cta_link'),
        ],
                        heading='Heading'),
    ]
Beispiel #22
0
class Testimonial(LinkFields):
    page = models.ForeignKey(
        Page,
        related_name='testimonials',
        null=True,
        blank=True
    )
    name = models.CharField(max_length=150)
    photo = models.ForeignKey(
        Image, null=True, blank=True, on_delete=models.SET_NULL
    )
    text = models.CharField(max_length=255)

    panels = [
        PageChooserPanel('page'),
        FieldPanel('name'),
        ImageChooserPanel('photo'),
        FieldPanel('text'),
        MultiFieldPanel(LinkFields.panels, "Link"),
    ]

    def __unicode__(self):
        return self.name
Beispiel #23
0
class GalleryHomePage(Page):
    photo_of_the_week = models.ForeignKey("core.AffixImage",
                                          null=False,
                                          blank=False,
                                          on_delete=models.PROTECT)
    photo_title = models.TextField(blank=False, null=False)
    photo_link = models.TextField(blank=True, null=True)
    talking_album = models.ForeignKey("album.Album",
                                      null=False,
                                      blank=False,
                                      related_name='talking',
                                      on_delete=models.PROTECT)
    photo_album = models.ForeignKey("album.Album",
                                    null=False,
                                    blank=False,
                                    related_name='photo',
                                    on_delete=models.PROTECT)
    video = models.ForeignKey("article.Article",
                              null=False,
                              blank=False,
                              on_delete=models.PROTECT)

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            ImageChooserPanel('photo_of_the_week'),
            FieldPanel('photo_title'),
            FieldPanel('photo_link'),
        ]),
        FieldPanel('talking_album'),
        FieldPanel('photo_album'),
        FieldPanel('video'),
    ]

    base_form_class = GalleryHomePageAdminForm

    def __str__(self):
        return _("GalleryHomePage")
Beispiel #24
0
class LinkField(models.Model):
    """Model field to handle link item
    """
    link_external = models.URLField(verbose_name='External Link', blank=True, null=True,
                                    help_text='Set external link if you want your \
                                     link points somewher outside this CMS System')
    link_page = models.ForeignKey('wagtailcore.Page', verbose_name='Internal Page',
                                  on_delete=models.SET_NULL, blank=True, null=True,
                                  help_text='Choose existing from existing page')
    link_document = models.ForeignKey('wagtaildocs.Document', verbose_name='Link to Document',
                                      on_delete=models.SET_NULL, blank=True, null=True)
    link_email = models.EmailField(verbose_name='Email Link', blank=True, null=True)

    panels = [
        MultiFieldPanel([
            PageChooserPanel('link_page'),
            FieldPanel('link_external'),
            DocumentChooserPanel('link_document'),
            FieldPanel('link_email'),
        ], heading="Link Type", classname="full"),
    ]

    class Meta:
        abstract = True

    @property
    def link(self):
        if self.link_page:
            return self.link_page.url
        elif self.link_external:
            return self.link_external
        elif self.link_document:
            return self.link_document.url
        elif self.link_email:
            return 'mailto:{}'.format(self.link_email)
        else:
            return '#'
Beispiel #25
0
class Statistic(ClusterableModel, LinkFields):
    title = models.CharField(max_length=255)
    cms_title = models.CharField(
        max_length=225,
        null=True,
        blank=True,
        help_text="Snippet CMS title only viewable in admin area")
    description = RichTextField(
        blank=True,
        max_length=180,
        verbose_name="Description",
        help_text=
        "The statistic. For example, '66% of girls complete primary school'",
        features=[
            "bold", "italic", "link", "document-link", "h2", "h3", "h4", "h5",
            "h6", "justify"
        ])
    citation_text = models.CharField(max_length=80, blank=True)

    @cached_property
    def statistic_customisations(self):
        return self.statistic_customisation.first()

    panels = [
        FieldPanel('title'),
        FieldPanel('cms_title'),
        FieldPanel('description'),
        FieldPanel('citation_text'),
        MultiFieldPanel([
            InlinePanel('statistic_customisation',
                        label="Snippet Customisation",
                        max_num=1),
        ], 'Customisations'),
    ] + LinkFields.content_panels

    def __str__(self):
        return self.title
Beispiel #26
0
class BlogPage(PageMixin, Page):
    #date = models.DateField(_('Post Date'))
    #intro = RichTextField(max_length=250)
    #body = RichTextField()
    tags = ClusterTaggableManager(through=BlogPageTag, blank=True)
    #categories = ParentalManyToManyField(BlogCategory, blank=True)
    #author = models.ForeignKey(User, on_delete=models.SET_NULL,
    #                           related_name='blogs', null=True, blank=True)

    author = models.ForeignKey(User,
                               on_delete=models.SET_NULL,
                               related_name='blogauthors',
                               null=True,
                               blank=True)
    isPost = models.BooleanField(default=True)

    #client = models.ForeignKey('home.Client', on_delete=models.SET_NULL,
    #                           blank=True,
    #                           null=True, related_name='projects')
    ### categories
    """
    search_fields = Page.search_fields + [
            index.SearchField('intro'),
            index.SearchField('body'),
            ]
    """
    content_panels = PageMixin.content_panels + [
        MultiFieldPanel(
            [FieldPanel('tags'),
             FieldPanel('author'),
             FieldPanel('isPost')],
            heading='Basic Information'),

        #InlinePanel("project_docs"),
        #FieldPanel('client')
    ]
    """
class EventIndexPage(Page):
    subpage_types = [
        'events.SimpleEventPage', 'events.MultidayEventPage',
        'events.RecurringEventPage', 'events.CalendarPage'
    ]

    intro = RichTextField(blank=True)

    search_fields = Page.search_fields + (index.SearchField('intro'), )

    @property
    def recurringEvents(self):
        events = RecurringEventPage.objects.live()
        return events

    @property
    def old_events(self):
        # Get list of live event pages that are descendants of this page
        events = Page.objects.live().descendant_of(self)

        # Filter events list to get ones that are either
        # running now or start in the future
        #events = events.filter(date_from__gte=dt.date.today())

        # Order by date
        #events = events.order_by('date_from')

        return events

    content_panels = Page.content_panels + [
        FieldPanel('intro', classname="full"),
        InlinePanel('related_links', label="Related links"),
    ]

    promote_panels = [
        MultiFieldPanel(Page.promote_panels, "Common page configuration")
    ]
Beispiel #28
0
class BaseEvent(Event, TagSearchable):
    """
    Adds tags to schedule.Event.
    """
    tags = TaggableManager(blank=True)

    panels = [
        FieldPanel('title', classname='full title'),
        MultiFieldPanel([
            FieldRowPanel([
                FieldPanel('start', classname='col6'),
                FieldPanel('end', classname='col6'),
            ], classname='label-above'),
        ], _(u'Date Range'), classname='publishing'),
        FieldPanel('description'),
        FieldPanel('rule'),
        FieldPanel('tags'),
    ]

    class Meta(object):
        app_label           = 'wagtailevents'
        verbose_name        = 'Event'
        verbose_name_plural = 'Events'
        ordering            = ('-start', 'title',)
class NavPage(Page):

    # Database fields
    nav_title = RichTextField(default='')
    body = StreamField([('heading', blocks.CharBlock(classname="full title")),
                        ('paragraph', blocks.RawHTMLBlock())])
    date = models.DateField("Post date")
    feed_image = models.ForeignKey('wagtailimages.Image',
                                   null=True,
                                   blank=True,
                                   on_delete=models.SET_NULL,
                                   related_name='+')

    # Search index configuraiton

    search_fields = Page.search_fields + (
        index.SearchField('body'),
        index.FilterField('date'),
    )

    # Editor panels configuration

    content_panels = Page.content_panels + [
        FieldPanel('nav_title'),
        FieldPanel('date'),
        StreamFieldPanel('body'),
    ]

    promote_panels = [
        MultiFieldPanel(Page.promote_panels, "Common page configuration"),
        ImageChooserPanel('feed_image'),
    ]

    # Parent page / subpage type rules

    parent_page_types = ['SectionPage']
Beispiel #30
0
class PageMixin(Page):
    date = models.DateField(_('Post Date'))
    intro = RichTextField(max_length=250)
    body = RichTextField()
    ##tags = ClusterTaggableManager(through=BlogPageTag, blank=True)
    categories = ParentalManyToManyField(BlogCategory, blank=True)

    search_fields = Page.search_fields + [
        index.SearchField('intro'),
        index.SearchField('body'),
    ]

    content_panels = Page.content_panels + [
        MultiFieldPanel(
            [
                #FieldPanel('tags'),
                FieldPanel('date'),
                FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
            ],
            heading='Basic Information'),
        FieldPanel('intro'),
        FieldPanel('body', classname='full'),
        InlinePanel('gallery_images', label='Gallery Images')
    ]

    def main_image(self):

        gallery_image = self.gallery_images.first()

        if gallery_image:
            return gallery_image.image

        return None

    class Meta:
        abstract = True