123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- from __future__ import unicode_literals
- from django.db import models
- from wagtail.wagtailcore.models import Page, Orderable, Collection
- from wagtail.wagtailsearch import index
- from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
- from wagtail.wagtailcore.fields import StreamField
- from wagtail.wagtailadmin.edit_handlers import (
- FieldPanel, InlinePanel, FieldRowPanel, StreamFieldPanel)
- from wagtail.wagtailsnippets.models import register_snippet
- from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
- from blocks import BaseStreamBlock
- @register_snippet
- class People(models.Model):
- first_name = models.CharField("First name", max_length=254)
- last_name = models.CharField("Last name", max_length=254)
- job_title = models.CharField("Job title", max_length=254)
- image = models.ForeignKey(
- 'wagtailimages.Image',
- null=True,
- blank=True,
- on_delete=models.SET_NULL,
- related_name='+'
- )
- panels = [
- FieldPanel('first_name', classname="col6"),
- FieldPanel('last_name', classname="col6"),
- FieldPanel('job_title'),
- ImageChooserPanel('image')
- ]
- def __str__(self):
- return self.first_name + " " + self.last_name
- class Meta:
- verbose_name = 'Person'
- verbose_name_plural = 'People'
- class AboutPage(Page):
- """
- The About Page
- """
- image = models.ForeignKey(
- 'wagtailimages.Image',
- null=True,
- blank=True,
- on_delete=models.SET_NULL,
- related_name='+',
- help_text='Location image'
- )
- body = StreamField(
- BaseStreamBlock(), verbose_name="About page detail", blank=True
- )
-
-
-
-
- content_panels = Page.content_panels + [
- ImageChooserPanel('image'),
- StreamFieldPanel('body'),
-
-
-
-
-
- ]
-
-
-
-
-
-
- subpage_types = []
-
- def getImageCollections():
-
- return [(
- collection.id, collection.name
- ) for collection in Collection.objects.all().exclude(
- name='Root'
- )]
- class GalleryPage(Page):
- """
- This is a page to list all the locations on the site
- """
- CHOICES_LIST = getImageCollections()
-
-
- choices = models.CharField(
- max_length=255, choices=CHOICES_LIST
- )
- image = models.ForeignKey(
- 'wagtailimages.Image',
- null=True,
- blank=True,
- on_delete=models.SET_NULL,
- related_name='+',
- help_text='Location listing image'
- )
- introduction = models.TextField(
- help_text='Text to describe the index page',
- blank=True)
- content_panels = Page.content_panels + [
- FieldPanel('choices'),
- ImageChooserPanel('image'),
- FieldPanel('introduction')
- ]
-
-
-
-
-
- subpage_types = [
- ]
-
|