remove wagtaildemo
|
|
@ -1,27 +0,0 @@
|
|||
Copyright (c) 2014 Torchbox Ltd and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Torchbox nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -1 +0,0 @@
|
|||
web: uwsgi --http :$PORT --module wagtaildemo.heroku_wsgi --master --processes 2 --static-map /media/=/app/media/ --offload-threads 1
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
[](https://heroku.com/deploy?template=https://github.com/torchbox/wagtaildemo)
|
||||
|
||||
Wagtail demo project
|
||||
=======================
|
||||
|
||||
This is a demonstration project for [Wagtail CMS](http://wagtail.io).
|
||||
|
||||
*We do __not__ recommend using this project to start your own site*. This project is only to provide some examples of implementing common features, it is not an exemplar of Django or Wagtail best practice.
|
||||
|
||||
If you're reasonably new to Python/Django, we suggest you run this project on a Virtual Machine using Vagrant, which helps resolve common software dependency issues. However for more experienced developers, instructions to start this project without Vagrant follow below.
|
||||
|
||||
Once you're familiar with the examples in this project and you want to start a real site, we strongly recommend running the ``wagtail start`` command in a fresh virtual environment, explained in the [Wagtail CMS Documentation](http://wagtail.readthedocs.org/en/latest/getting_started/).
|
||||
|
||||
Setup with Vagrant
|
||||
------------------
|
||||
|
||||
### Dependencies
|
||||
* [VirtualBox](https://www.virtualbox.org/)
|
||||
* [Vagrant 1.5+](http://www.vagrantup.com)
|
||||
|
||||
### Installation
|
||||
Run the following commands:
|
||||
|
||||
git clone https://github.com/torchbox/wagtaildemo.git
|
||||
cd wagtaildemo
|
||||
vagrant up
|
||||
vagrant ssh
|
||||
(then, within the SSH session:)
|
||||
./manage.py runserver 0.0.0.0:8000
|
||||
|
||||
The demo site will now be accessible at [http://localhost:8000/](http://localhost:8000/) and the Wagtail admin interface at [http://localhost:8000/admin/](http://localhost:8000/admin/) . Log into the admin with the credentials ``admin / changeme``.
|
||||
|
||||
Setup without Vagrant
|
||||
-----
|
||||
Don't want to set up a whole VM to try out Wagtail? No problem.
|
||||
|
||||
### Dependencies
|
||||
* [PostgreSQL](http://www.postgresql.org)
|
||||
* [PIP](https://github.com/pypa/pip)
|
||||
|
||||
### Installation
|
||||
|
||||
With PostgreSQL running (and configured to allow you to connect as the 'postgres' user - if not, you'll need to adjust the `createdb` line and the database settings in wagtaildemo/settings/base.py accordingly), run the following commands:
|
||||
|
||||
git clone https://github.com/torchbox/wagtaildemo.git
|
||||
cd wagtaildemo
|
||||
pip install -r requirements.txt
|
||||
createdb -Upostgres wagtaildemo
|
||||
./manage.py migrate
|
||||
./manage.py load_initial_data
|
||||
./manage.py createsuperuser
|
||||
./manage.py runserver
|
||||
|
||||
### SQLite support
|
||||
|
||||
SQLite is supported as an alternative to PostgreSQL. Before running the `pip install -r requirements.txt` step above, delete the `psycopg2` line in requirements.txt; then, in wagtaildemo/settings/base.py, update the `DATABASES` setting to use `'django.db.backends.sqlite3'` and set `NAME` to be the full path of your database file, as you would with a regular Django project.
|
||||
85
examples/wagtaildemo/Vagrantfile
vendored
|
|
@ -1,85 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure(2) do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://atlas.hashicorp.com/search.
|
||||
config.vm.box = "torchbox/wagtail"
|
||||
config.vm.box_version = "~> 1.0"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8000" will access port 8000 on the guest machine.
|
||||
config.vm.network "forwarded_port", guest: 8000, host: 8000
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network"
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||
|
||||
config.vm.synced_folder ".", "/home/vagrant/wagtaildemo"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
# config.vm.provider "virtualbox" do |vb|
|
||||
# # Display the VirtualBox GUI when booting the machine
|
||||
# vb.gui = true
|
||||
#
|
||||
# # Customize the amount of memory on the VM:
|
||||
# vb.memory = "1024"
|
||||
# end
|
||||
#
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options.
|
||||
|
||||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
||||
# such as FTP and Heroku are also available. See the documentation at
|
||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
||||
# config.push.define "atlas" do |push|
|
||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
||||
# end
|
||||
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
# config.vm.provision "shell", inline: <<-SHELL
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y apache2
|
||||
# SHELL
|
||||
config.vm.provision :shell, :path => "vagrant/provision.sh"
|
||||
|
||||
# Enable agent forwarding over SSH connections.
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
# If a 'Vagrantfile.local' file exists, import any configuration settings
|
||||
# defined there into here. Vagrantfile.local is ignored in version control,
|
||||
# so this can be used to add configuration specific to this computer.
|
||||
if File.exist? "Vagrantfile.local"
|
||||
instance_eval File.read("Vagrantfile.local"), "Vagrantfile.local"
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# Creating a Vagrantfile.local file allows you to extend the Vagrant configuration
|
||||
# with options specific to this local machine.
|
||||
|
||||
|
||||
# The default setup is geared towards trying out the demo site, and building your
|
||||
# own Wagtail-powered sites based on it. If you wish to develop Wagtail itself,
|
||||
# you'll want to have an editable copy of the Wagtail code on your host machine,
|
||||
# and share this with the virtual machine to be used instead of the packaged
|
||||
# copy of Wagtail.
|
||||
#
|
||||
# Clone https://github.com/torchbox/wagtail somewhere convenient, and replace
|
||||
# "../wagtail" below with the correct path:
|
||||
|
||||
config.vm.synced_folder "../wagtail", "/home/vagrant/wagtail"
|
||||
|
||||
|
||||
# You'll also need to configure your Python environment within the VM to pick up this
|
||||
# instance of Wagtail rather than the packaged one; usually this is done by running
|
||||
# `./setup.py develop` within the checked-out Wagtail codebase.
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "Wagtaildemo",
|
||||
"description": "Wagtaildemo",
|
||||
"repository": "https://github.com/torchbox/wagtaildemo",
|
||||
"logo": "http://wagtail.io/static/wagtailsite/images/navlogo2.png",
|
||||
"keywords": ["wagtail", "django"],
|
||||
"env": {
|
||||
"DJANGO_SETTINGS_MODULE": "wagtaildemo.settings.heroku"
|
||||
},
|
||||
"scripts": {
|
||||
"postdeploy": "django-admin.py migrate && django-admin.py load_initial_data && echo 'from wagtail.wagtailimages.models import Rendition; Rendition.objects.all().delete()' | django-admin.py shell"
|
||||
},
|
||||
"addons": [
|
||||
"heroku-postgresql:hobby-dev"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# Copy image files into media folder
|
||||
mkdir -p media/original_images
|
||||
cp demo/fixtures/images/* media/original_images/
|
||||
|
||||
# dj shortcut
|
||||
if ! command -v dj; then
|
||||
ln -s /app/.heroku/python/bin/django-admin /app/.heroku/python/bin/dj
|
||||
fi
|
||||
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 208 KiB |
|
Before Width: | Height: | Size: 331 KiB |
|
Before Width: | Height: | Size: 214 KiB |
|
Before Width: | Height: | Size: 398 KiB |
|
Before Width: | Height: | Size: 315 KiB |
|
Before Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 334 KiB |
|
Before Width: | Height: | Size: 266 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
|
@ -1,21 +0,0 @@
|
|||
import os, shutil
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.core.management import call_command
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, **options):
|
||||
fixtures_dir = os.path.join(settings.PROJECT_ROOT, 'demo', 'fixtures')
|
||||
fixture_file = os.path.join(fixtures_dir, 'demo.json')
|
||||
image_src_dir = os.path.join(fixtures_dir, 'images')
|
||||
image_dest_dir = os.path.join(settings.MEDIA_ROOT, 'original_images')
|
||||
|
||||
call_command('loaddata', fixture_file, verbosity=0)
|
||||
|
||||
if not os.path.isdir(image_dest_dir):
|
||||
os.makedirs(image_dest_dir)
|
||||
|
||||
for filename in os.listdir(image_src_dir):
|
||||
shutil.copy(os.path.join(image_src_dir, filename), image_dest_dir)
|
||||
|
|
@ -1,585 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.db.models.deletion
|
||||
import modelcluster.fields
|
||||
import wagtail.wagtailcore.fields
|
||||
import modelcluster.tags
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wagtailimages', '0002_initial_data'),
|
||||
('wagtaildocs', '0002_initial_data'),
|
||||
('wagtailcore', '0002_initial_data'),
|
||||
('taggit', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Advert',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('url', models.URLField(null=True, blank=True)),
|
||||
('text', models.CharField(max_length=255)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AdvertPlacement',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('advert', models.ForeignKey(related_name=b'+', to='demo.Advert')),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BlogIndexPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BlogIndexPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BlogPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('body', wagtail.wagtailcore.fields.RichTextField()),
|
||||
('date', models.DateField(verbose_name=b'Post date')),
|
||||
('feed_image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BlogPageCarouselItem',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('embed_url', models.URLField(verbose_name=b'Embed URL', blank=True)),
|
||||
('caption', models.CharField(max_length=255, blank=True)),
|
||||
('image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BlogPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BlogPageTag',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('content_object', modelcluster.fields.ParentalKey(related_name=b'tagged_items', to='demo.BlogPage')),
|
||||
('tag', models.ForeignKey(related_name='demo_blogpagetag_items', to='taggit.Tag')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ContactPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('telephone', models.CharField(max_length=20, blank=True)),
|
||||
('email', models.EmailField(max_length=75, blank=True)),
|
||||
('address_1', models.CharField(max_length=255, blank=True)),
|
||||
('address_2', models.CharField(max_length=255, blank=True)),
|
||||
('city', models.CharField(max_length=255, blank=True)),
|
||||
('country', models.CharField(max_length=255, blank=True)),
|
||||
('post_code', models.CharField(max_length=10, blank=True)),
|
||||
('body', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('feed_image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page', models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventIndexPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventIndexPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('date_from', models.DateField(verbose_name=b'Start date')),
|
||||
('date_to', models.DateField(help_text=b'Not required if event is on a single day', null=True, verbose_name=b'End date', blank=True)),
|
||||
('time_from', models.TimeField(null=True, verbose_name=b'Start time', blank=True)),
|
||||
('time_to', models.TimeField(null=True, verbose_name=b'End time', blank=True)),
|
||||
('audience', models.CharField(max_length=255, choices=[(b'public', b'Public'), (b'private', b'Private')])),
|
||||
('location', models.CharField(max_length=255)),
|
||||
('body', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('cost', models.CharField(max_length=255)),
|
||||
('signup_link', models.URLField(blank=True)),
|
||||
('feed_image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventPageCarouselItem',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('embed_url', models.URLField(verbose_name=b'Embed URL', blank=True)),
|
||||
('caption', models.CharField(max_length=255, blank=True)),
|
||||
('image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventPageSpeaker',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('first_name', models.CharField(max_length=255, verbose_name=b'Name', blank=True)),
|
||||
('last_name', models.CharField(max_length=255, verbose_name=b'Surname', blank=True)),
|
||||
('image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='FormField',
|
||||
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)),
|
||||
('label', models.CharField(help_text='The label of the form field', max_length=255)),
|
||||
('field_type', models.CharField(max_length=16, choices=[(b'singleline', 'Single line text'), (b'multiline', 'Multi-line text'), (b'email', 'Email'), (b'number', 'Number'), (b'url', 'URL'), (b'checkbox', 'Checkbox'), (b'checkboxes', 'Checkboxes'), (b'dropdown', 'Drop down'), (b'radio', 'Radio buttons'), (b'date', 'Date'), (b'datetime', 'Date/time')])),
|
||||
('required', models.BooleanField(default=True)),
|
||||
('choices', models.CharField(help_text='Comma separated list of choices. Only applicable in checkboxes, radio and dropdown.', max_length=512, blank=True)),
|
||||
('default_value', models.CharField(help_text='Default value. Comma separated values supported for checkboxes.', max_length=255, blank=True)),
|
||||
('help_text', models.CharField(max_length=255, blank=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='FormPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('to_address', models.CharField(help_text='Optional - form submissions will be emailed to this address', max_length=255, blank=True)),
|
||||
('from_address', models.CharField(max_length=255, blank=True)),
|
||||
('subject', models.CharField(max_length=255, blank=True)),
|
||||
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('thank_you_text', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HomePage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('body', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Homepage',
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HomePageCarouselItem',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('embed_url', models.URLField(verbose_name=b'Embed URL', blank=True)),
|
||||
('caption', models.CharField(max_length=255, blank=True)),
|
||||
('image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HomePageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PersonPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('telephone', models.CharField(max_length=20, blank=True)),
|
||||
('email', models.EmailField(max_length=75, blank=True)),
|
||||
('address_1', models.CharField(max_length=255, blank=True)),
|
||||
('address_2', models.CharField(max_length=255, blank=True)),
|
||||
('city', models.CharField(max_length=255, blank=True)),
|
||||
('country', models.CharField(max_length=255, blank=True)),
|
||||
('post_code', models.CharField(max_length=10, blank=True)),
|
||||
('first_name', models.CharField(max_length=255)),
|
||||
('last_name', models.CharField(max_length=255)),
|
||||
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('biography', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('feed_image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
('image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page', models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PersonPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StandardIndexPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('feed_image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StandardIndexPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StandardPage',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('body', wagtail.wagtailcore.fields.RichTextField(blank=True)),
|
||||
('feed_image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StandardPageCarouselItem',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('embed_url', models.URLField(verbose_name=b'Embed URL', blank=True)),
|
||||
('caption', models.CharField(max_length=255, blank=True)),
|
||||
('image', models.ForeignKey(related_name=b'+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
('link_page', models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True)),
|
||||
('page', modelcluster.fields.ParentalKey(related_name=b'carousel_items', to='demo.StandardPage')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StandardPageRelatedLink',
|
||||
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)),
|
||||
('link_external', models.URLField(verbose_name=b'External link', blank=True)),
|
||||
('title', models.CharField(help_text=b'Link title', max_length=255)),
|
||||
('link_document', models.ForeignKey(related_name=b'+', blank=True, to='wagtaildocs.Document', null=True)),
|
||||
('link_page', models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True)),
|
||||
('page', modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.StandardPage')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='standardindexpagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='standardindexpagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.StandardIndexPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='personpagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='personpagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.PersonPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='homepagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='homepagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.HomePage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='homepagecarouselitem',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='homepagecarouselitem',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'carousel_items', to='demo.HomePage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='formfield',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'form_fields', to='demo.FormPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventpagespeaker',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventpagespeaker',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'speakers', to='demo.EventPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventpagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventpagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.EventPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventpagecarouselitem',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventpagecarouselitem',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'carousel_items', to='demo.EventPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventindexpagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='eventindexpagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.EventIndexPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogpagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogpagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.BlogPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogpagecarouselitem',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogpagecarouselitem',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'carousel_items', to='demo.BlogPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogpage',
|
||||
name='tags',
|
||||
field=modelcluster.tags.ClusterTaggableManager(to='taggit.Tag', through='demo.BlogPageTag', blank=True, help_text='A comma-separated list of tags.', verbose_name='Tags'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogindexpagerelatedlink',
|
||||
name='link_page',
|
||||
field=models.ForeignKey(related_name=b'+', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='blogindexpagerelatedlink',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'related_links', to='demo.BlogIndexPage'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='advertplacement',
|
||||
name='page',
|
||||
field=modelcluster.fields.ParentalKey(related_name=b'advert_placements', to='wagtailcore.Page'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='advert',
|
||||
name='page',
|
||||
field=models.ForeignKey(related_name=b'adverts', blank=True, to='wagtailcore.Page', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import demo.models
|
||||
import wagtail.wagtaildocs.blocks
|
||||
import wagtail.wagtailimages.blocks
|
||||
import wagtail.wagtailcore.fields
|
||||
import wagtail.wagtailcore.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('demo', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='homepage',
|
||||
name='body',
|
||||
field=wagtail.wagtailcore.fields.StreamField([(b'h2', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', icon=b'title')), (b'h3', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', icon=b'title')), (b'h4', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', icon=b'title')), (b'intro', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'pilcrow')), (b'paragraph', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'pilcrow')), (b'aligned_image', wagtail.wagtailcore.blocks.StructBlock([(b'image', wagtail.wagtailimages.blocks.ImageChooserBlock()), (b'caption', wagtail.wagtailcore.blocks.RichTextBlock()), (b'alignment', demo.models.ImageFormatChoiceBlock())], icon=b'image', label=b'Aligned image')), (b'pullquote', wagtail.wagtailcore.blocks.StructBlock([(b'quote', wagtail.wagtailcore.blocks.TextBlock(b'quote title')), (b'attribution', wagtail.wagtailcore.blocks.CharBlock())])), (b'aligned_html', wagtail.wagtailcore.blocks.StructBlock([(b'html', wagtail.wagtailcore.blocks.RawHTMLBlock()), (b'alignment', demo.models.HTMLAlignmentChoiceBlock())], label=b'Raw HTML', icon=b'code')), (b'document', wagtail.wagtaildocs.blocks.DocumentChooserBlock(icon=b'doc-full-inverse'))]),
|
||||
)
|
||||
]
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import demo.models
|
||||
import wagtail.wagtaildocs.blocks
|
||||
import wagtail.wagtailimages.blocks
|
||||
import wagtail.wagtailcore.fields
|
||||
import wagtail.wagtailcore.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('demo', '0002_auto_20150917_1037'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='blogpage',
|
||||
name='body',
|
||||
field=wagtail.wagtailcore.fields.StreamField([(b'h2', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', icon=b'title')), (b'h3', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', icon=b'title')), (b'h4', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', icon=b'title')), (b'intro', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'pilcrow')), (b'paragraph', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'pilcrow')), (b'aligned_image', wagtail.wagtailcore.blocks.StructBlock([(b'image', wagtail.wagtailimages.blocks.ImageChooserBlock()), (b'caption', wagtail.wagtailcore.blocks.RichTextBlock()), (b'alignment', demo.models.ImageFormatChoiceBlock())], icon=b'image', label=b'Aligned image')), (b'pullquote', wagtail.wagtailcore.blocks.StructBlock([(b'quote', wagtail.wagtailcore.blocks.TextBlock(b'quote title')), (b'attribution', wagtail.wagtailcore.blocks.CharBlock())])), (b'aligned_html', wagtail.wagtailcore.blocks.StructBlock([(b'html', wagtail.wagtailcore.blocks.RawHTMLBlock()), (b'alignment', demo.models.HTMLAlignmentChoiceBlock())], label=b'Raw HTML', icon=b'code')), (b'document', wagtail.wagtaildocs.blocks.DocumentChooserBlock(icon=b'doc-full-inverse'))]),
|
||||
)
|
||||
]
|
||||
|
|
@ -1,249 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import wagtail.wagtailimages.blocks
|
||||
import wagtail.wagtailcore.blocks
|
||||
import wagtail.wagtailcore.fields
|
||||
import wagtail.wagtaildocs.blocks
|
||||
import demo.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('demo', '0003_auto_20150917_1200'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='blogindexpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogindexpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogpage',
|
||||
name='body',
|
||||
field=wagtail.wagtailcore.fields.StreamField((('h2', wagtail.wagtailcore.blocks.CharBlock(icon='title', classname='title')), ('h3', wagtail.wagtailcore.blocks.CharBlock(icon='title', classname='title')), ('h4', wagtail.wagtailcore.blocks.CharBlock(icon='title', classname='title')), ('intro', wagtail.wagtailcore.blocks.RichTextBlock(icon='pilcrow')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock(icon='pilcrow')), ('aligned_image', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('caption', wagtail.wagtailcore.blocks.RichTextBlock()), ('alignment', demo.models.ImageFormatChoiceBlock())), label='Aligned image', icon='image')), ('pullquote', wagtail.wagtailcore.blocks.StructBlock((('quote', wagtail.wagtailcore.blocks.TextBlock('quote title')), ('attribution', wagtail.wagtailcore.blocks.CharBlock())))), ('aligned_html', wagtail.wagtailcore.blocks.StructBlock((('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('alignment', demo.models.HTMLAlignmentChoiceBlock())), label='Raw HTML', icon='code')), ('document', wagtail.wagtaildocs.blocks.DocumentChooserBlock(icon='doc-full-inverse')))),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogpage',
|
||||
name='date',
|
||||
field=models.DateField(verbose_name='Post date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogpagecarouselitem',
|
||||
name='embed_url',
|
||||
field=models.URLField(verbose_name='Embed URL', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogpagecarouselitem',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contactpage',
|
||||
name='email',
|
||||
field=models.EmailField(max_length=254, blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventindexpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventindexpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpage',
|
||||
name='audience',
|
||||
field=models.CharField(max_length=255, choices=[('public', 'Public'), ('private', 'Private')]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpage',
|
||||
name='date_from',
|
||||
field=models.DateField(verbose_name='Start date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpage',
|
||||
name='date_to',
|
||||
field=models.DateField(help_text='Not required if event is on a single day', verbose_name='End date', null=True, blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpage',
|
||||
name='time_from',
|
||||
field=models.TimeField(verbose_name='Start time', null=True, blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpage',
|
||||
name='time_to',
|
||||
field=models.TimeField(verbose_name='End time', null=True, blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagecarouselitem',
|
||||
name='embed_url',
|
||||
field=models.URLField(verbose_name='Embed URL', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagecarouselitem',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagespeaker',
|
||||
name='first_name',
|
||||
field=models.CharField(max_length=255, verbose_name='Name', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagespeaker',
|
||||
name='last_name',
|
||||
field=models.CharField(max_length=255, verbose_name='Surname', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventpagespeaker',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='choices',
|
||||
field=models.CharField(max_length=512, help_text='Comma separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='Choices', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='default_value',
|
||||
field=models.CharField(max_length=255, help_text='Default value. Comma separated values supported for checkboxes.', verbose_name='Default value', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='field_type',
|
||||
field=models.CharField(max_length=16, choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time')], verbose_name='Field type'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='help_text',
|
||||
field=models.CharField(max_length=255, verbose_name='Help text', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='label',
|
||||
field=models.CharField(max_length=255, help_text='The label of the form field', verbose_name='Label'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='required',
|
||||
field=models.BooleanField(verbose_name='Required', default=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='from_address',
|
||||
field=models.CharField(max_length=255, verbose_name='From address', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='subject',
|
||||
field=models.CharField(max_length=255, verbose_name='Subject', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='to_address',
|
||||
field=models.CharField(max_length=255, help_text='Optional - form submissions will be emailed to this address', verbose_name='To address', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='homepage',
|
||||
name='body',
|
||||
field=wagtail.wagtailcore.fields.StreamField((('h2', wagtail.wagtailcore.blocks.CharBlock(icon='title', classname='title')), ('h3', wagtail.wagtailcore.blocks.CharBlock(icon='title', classname='title')), ('h4', wagtail.wagtailcore.blocks.CharBlock(icon='title', classname='title')), ('intro', wagtail.wagtailcore.blocks.RichTextBlock(icon='pilcrow')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock(icon='pilcrow')), ('aligned_image', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('caption', wagtail.wagtailcore.blocks.RichTextBlock()), ('alignment', demo.models.ImageFormatChoiceBlock())), label='Aligned image', icon='image')), ('pullquote', wagtail.wagtailcore.blocks.StructBlock((('quote', wagtail.wagtailcore.blocks.TextBlock('quote title')), ('attribution', wagtail.wagtailcore.blocks.CharBlock())))), ('aligned_html', wagtail.wagtailcore.blocks.StructBlock((('html', wagtail.wagtailcore.blocks.RawHTMLBlock()), ('alignment', demo.models.HTMLAlignmentChoiceBlock())), label='Raw HTML', icon='code')), ('document', wagtail.wagtaildocs.blocks.DocumentChooserBlock(icon='doc-full-inverse')))),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='homepagecarouselitem',
|
||||
name='embed_url',
|
||||
field=models.URLField(verbose_name='Embed URL', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='homepagecarouselitem',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='homepagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='homepagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='personpage',
|
||||
name='email',
|
||||
field=models.EmailField(max_length=254, blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='personpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='personpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='standardindexpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='standardindexpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='standardpagecarouselitem',
|
||||
name='embed_url',
|
||||
field=models.URLField(verbose_name='Embed URL', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='standardpagecarouselitem',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='standardpagerelatedlink',
|
||||
name='link_external',
|
||||
field=models.URLField(verbose_name='External link', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='standardpagerelatedlink',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, help_text='Link title'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('demo', '0004_auto_20151019_1351'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='choices',
|
||||
field=models.CharField(blank=True, max_length=512, verbose_name='choices', help_text='Comma separated list of choices. Only applicable in checkboxes, radio and dropdown.'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='default_value',
|
||||
field=models.CharField(blank=True, max_length=255, verbose_name='default value', help_text='Default value. Comma separated values supported for checkboxes.'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='field_type',
|
||||
field=models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time')], max_length=16, verbose_name='field type'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='help_text',
|
||||
field=models.CharField(blank=True, max_length=255, verbose_name='help text'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='label',
|
||||
field=models.CharField(help_text='The label of the form field', max_length=255, verbose_name='label'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='required',
|
||||
field=models.BooleanField(verbose_name='required', default=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='from_address',
|
||||
field=models.CharField(blank=True, max_length=255, verbose_name='from address'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='subject',
|
||||
field=models.CharField(blank=True, max_length=255, verbose_name='subject'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='to_address',
|
||||
field=models.CharField(blank=True, max_length=255, verbose_name='to address', help_text='Optional - form submissions will be emailed to this address'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.1 on 2016-09-02 11:04
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('demo', '0005_auto_20160531_1736'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='formfield',
|
||||
name='choices',
|
||||
field=models.TextField(blank=True, help_text='Comma separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formpage',
|
||||
name='to_address',
|
||||
field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,686 +0,0 @@
|
|||
from datetime import date
|
||||
|
||||
from django.db import models
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.http import HttpResponse
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django import forms
|
||||
|
||||
from wagtail.wagtailcore.models import Page, Orderable
|
||||
from wagtail.wagtailcore.fields import RichTextField, StreamField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, FieldRowPanel, MultiFieldPanel, \
|
||||
InlinePanel, PageChooserPanel, StreamFieldPanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtaildocs.edit_handlers import DocumentChooserPanel
|
||||
from wagtail.wagtailsnippets.models import register_snippet
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
from wagtail.wagtailsearch import index
|
||||
|
||||
from wagtail.wagtailcore.blocks import TextBlock, StructBlock, StreamBlock, FieldBlock, CharBlock, RichTextBlock, RawHTMLBlock
|
||||
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
||||
from wagtail.wagtaildocs.blocks import DocumentChooserBlock
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
from modelcluster.tags import ClusterTaggableManager
|
||||
from taggit.models import TaggedItemBase
|
||||
|
||||
from demo.utils import export_event
|
||||
|
||||
|
||||
EVENT_AUDIENCE_CHOICES = (
|
||||
('public', "Public"),
|
||||
('private', "Private"),
|
||||
)
|
||||
|
||||
# Global Streamfield definition
|
||||
|
||||
|
||||
class PullQuoteBlock(StructBlock):
|
||||
quote = TextBlock("quote title")
|
||||
attribution = CharBlock()
|
||||
|
||||
class Meta:
|
||||
icon = "openquote"
|
||||
|
||||
|
||||
class ImageFormatChoiceBlock(FieldBlock):
|
||||
field = forms.ChoiceField(choices=(
|
||||
('left', 'Wrap left'), ('right', 'Wrap right'), ('mid', 'Mid width'), ('full', 'Full width'),
|
||||
))
|
||||
|
||||
|
||||
class HTMLAlignmentChoiceBlock(FieldBlock):
|
||||
field = forms.ChoiceField(choices=(
|
||||
('normal', 'Normal'), ('full', 'Full width'),
|
||||
))
|
||||
|
||||
|
||||
class ImageBlock(StructBlock):
|
||||
image = ImageChooserBlock()
|
||||
caption = RichTextBlock()
|
||||
alignment = ImageFormatChoiceBlock()
|
||||
|
||||
|
||||
class AlignedHTMLBlock(StructBlock):
|
||||
html = RawHTMLBlock()
|
||||
alignment = HTMLAlignmentChoiceBlock()
|
||||
|
||||
class Meta:
|
||||
icon = "code"
|
||||
|
||||
|
||||
class DemoStreamBlock(StreamBlock):
|
||||
h2 = CharBlock(icon="title", classname="title")
|
||||
h3 = CharBlock(icon="title", classname="title")
|
||||
h4 = CharBlock(icon="title", classname="title")
|
||||
intro = RichTextBlock(icon="pilcrow")
|
||||
paragraph = RichTextBlock(icon="pilcrow")
|
||||
aligned_image = ImageBlock(label="Aligned image", icon="image")
|
||||
pullquote = PullQuoteBlock()
|
||||
aligned_html = AlignedHTMLBlock(icon="code", label='Raw HTML')
|
||||
document = DocumentChooserBlock(icon="doc-full-inverse")
|
||||
|
||||
|
||||
# A couple of abstract classes that contain commonly used fields
|
||||
|
||||
class LinkFields(models.Model):
|
||||
link_external = models.URLField("External link", blank=True)
|
||||
link_page = models.ForeignKey(
|
||||
'wagtailcore.Page',
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name='+'
|
||||
)
|
||||
link_document = models.ForeignKey(
|
||||
'wagtaildocs.Document',
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
if self.link_page:
|
||||
return self.link_page.url
|
||||
elif self.link_document:
|
||||
return self.link_document.url
|
||||
else:
|
||||
return self.link_external
|
||||
|
||||
panels = [
|
||||
FieldPanel('link_external'),
|
||||
PageChooserPanel('link_page'),
|
||||
DocumentChooserPanel('link_document'),
|
||||
]
|
||||
|
||||
api_fields = ['link_external', 'link_page', 'link_document']
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class ContactFields(models.Model):
|
||||
telephone = models.CharField(max_length=20, blank=True)
|
||||
email = models.EmailField(blank=True)
|
||||
address_1 = models.CharField(max_length=255, blank=True)
|
||||
address_2 = models.CharField(max_length=255, blank=True)
|
||||
city = models.CharField(max_length=255, blank=True)
|
||||
country = models.CharField(max_length=255, blank=True)
|
||||
post_code = models.CharField(max_length=10, blank=True)
|
||||
|
||||
panels = [
|
||||
FieldPanel('telephone'),
|
||||
FieldPanel('email'),
|
||||
FieldPanel('address_1'),
|
||||
FieldPanel('address_2'),
|
||||
FieldPanel('city'),
|
||||
FieldPanel('country'),
|
||||
FieldPanel('post_code'),
|
||||
]
|
||||
|
||||
api_fields = ['telephone', 'email', 'address_1', 'address_2', 'city', 'country', 'post_code']
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
# Carousel items
|
||||
|
||||
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
|
||||
|
||||
|
||||
# Related links
|
||||
|
||||
class RelatedLink(LinkFields):
|
||||
title = models.CharField(max_length=255, help_text="Link title")
|
||||
|
||||
panels = [
|
||||
FieldPanel('title'),
|
||||
MultiFieldPanel(LinkFields.panels, "Link"),
|
||||
]
|
||||
|
||||
api_fields = ['title'] + LinkFields.api_fields
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
# Advert Snippet
|
||||
|
||||
class AdvertPlacement(models.Model):
|
||||
page = ParentalKey('wagtailcore.Page', related_name='advert_placements')
|
||||
advert = models.ForeignKey('demo.Advert', related_name='+')
|
||||
|
||||
api_fields = ['advert']
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Advert(models.Model):
|
||||
page = models.ForeignKey(
|
||||
'wagtailcore.Page',
|
||||
related_name='adverts',
|
||||
null=True,
|
||||
blank=True
|
||||
)
|
||||
url = models.URLField(null=True, blank=True)
|
||||
text = models.CharField(max_length=255)
|
||||
|
||||
panels = [
|
||||
PageChooserPanel('page'),
|
||||
FieldPanel('url'),
|
||||
FieldPanel('text'),
|
||||
]
|
||||
|
||||
api_fields = ['page', 'url', 'text']
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
register_snippet(Advert)
|
||||
|
||||
|
||||
# Home Page
|
||||
|
||||
class HomePageCarouselItem(Orderable, CarouselItem):
|
||||
page = ParentalKey('demo.HomePage', related_name='carousel_items')
|
||||
|
||||
|
||||
class HomePageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.HomePage', related_name='related_links')
|
||||
|
||||
|
||||
class HomePage(Page):
|
||||
body = StreamField(DemoStreamBlock())
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('body'),
|
||||
]
|
||||
|
||||
api_fields = ['body', 'carousel_items', 'related_links']
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Homepage"
|
||||
|
||||
HomePage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
StreamFieldPanel('body'),
|
||||
InlinePanel('carousel_items', label="Carousel items"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
HomePage.promote_panels = Page.promote_panels
|
||||
|
||||
|
||||
# Standard index page
|
||||
|
||||
class StandardIndexPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.StandardIndexPage', related_name='related_links')
|
||||
|
||||
|
||||
class StandardIndexPage(Page):
|
||||
intro = RichTextField(blank=True)
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('intro'),
|
||||
]
|
||||
|
||||
api_fields = ['intro', 'feed_image']
|
||||
|
||||
StandardIndexPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('intro', classname="full"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
StandardIndexPage.promote_panels = Page.promote_panels + [
|
||||
ImageChooserPanel('feed_image'),
|
||||
]
|
||||
|
||||
|
||||
# Standard page
|
||||
|
||||
class StandardPageCarouselItem(Orderable, CarouselItem):
|
||||
page = ParentalKey('demo.StandardPage', related_name='carousel_items')
|
||||
|
||||
|
||||
class StandardPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.StandardPage', related_name='related_links')
|
||||
|
||||
|
||||
class StandardPage(Page):
|
||||
intro = RichTextField(blank=True)
|
||||
body = RichTextField(blank=True)
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('intro'),
|
||||
index.SearchField('body'),
|
||||
]
|
||||
|
||||
api_fields = ['intro', 'body', 'feed_image', 'carousel_items', 'related_links']
|
||||
|
||||
StandardPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('intro', classname="full"),
|
||||
InlinePanel('carousel_items', label="Carousel items"),
|
||||
FieldPanel('body', classname="full"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
StandardPage.promote_panels = Page.promote_panels + [
|
||||
ImageChooserPanel('feed_image'),
|
||||
]
|
||||
|
||||
|
||||
# Blog index page
|
||||
|
||||
class BlogIndexPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.BlogIndexPage', related_name='related_links')
|
||||
|
||||
|
||||
class BlogIndexPage(Page):
|
||||
intro = RichTextField(blank=True)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('intro'),
|
||||
]
|
||||
|
||||
api_fields = ['intro', 'related_links']
|
||||
|
||||
@property
|
||||
def blogs(self):
|
||||
# Get list of live blog pages that are descendants of this page
|
||||
blogs = BlogPage.objects.live().descendant_of(self)
|
||||
|
||||
# Order by most recent date first
|
||||
blogs = blogs.order_by('-date')
|
||||
|
||||
return blogs
|
||||
|
||||
def get_context(self, request):
|
||||
# Get blogs
|
||||
blogs = self.blogs
|
||||
|
||||
# Filter by tag
|
||||
tag = request.GET.get('tag')
|
||||
if tag:
|
||||
blogs = blogs.filter(tags__name=tag)
|
||||
|
||||
# Pagination
|
||||
page = request.GET.get('page')
|
||||
paginator = Paginator(blogs, 10) # Show 10 blogs per page
|
||||
try:
|
||||
blogs = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
blogs = paginator.page(1)
|
||||
except EmptyPage:
|
||||
blogs = paginator.page(paginator.num_pages)
|
||||
|
||||
# Update template context
|
||||
context = super(BlogIndexPage, self).get_context(request)
|
||||
context['blogs'] = blogs
|
||||
return context
|
||||
|
||||
BlogIndexPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('intro', classname="full"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
BlogIndexPage.promote_panels = Page.promote_panels
|
||||
|
||||
|
||||
# Blog page
|
||||
|
||||
class BlogPageCarouselItem(Orderable, CarouselItem):
|
||||
page = ParentalKey('demo.BlogPage', related_name='carousel_items')
|
||||
|
||||
|
||||
class BlogPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.BlogPage', related_name='related_links')
|
||||
|
||||
|
||||
class BlogPageTag(TaggedItemBase):
|
||||
content_object = ParentalKey('demo.BlogPage', related_name='tagged_items')
|
||||
|
||||
|
||||
class BlogPage(Page):
|
||||
body = StreamField(DemoStreamBlock())
|
||||
tags = ClusterTaggableManager(through=BlogPageTag, blank=True)
|
||||
date = models.DateField("Post date")
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('body'),
|
||||
]
|
||||
|
||||
api_fields = ['body', 'tags', 'date', 'feed_image', 'carousel_items', 'related_links']
|
||||
|
||||
@property
|
||||
def blog_index(self):
|
||||
# Find closest ancestor which is a blog index
|
||||
return self.get_ancestors().type(BlogIndexPage).last()
|
||||
|
||||
BlogPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('date'),
|
||||
StreamFieldPanel('body'),
|
||||
InlinePanel('carousel_items', label="Carousel items"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
BlogPage.promote_panels = Page.promote_panels + [
|
||||
ImageChooserPanel('feed_image'),
|
||||
FieldPanel('tags'),
|
||||
]
|
||||
|
||||
|
||||
# Person page
|
||||
|
||||
class PersonPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.PersonPage', related_name='related_links')
|
||||
|
||||
|
||||
class PersonPage(Page, ContactFields):
|
||||
first_name = models.CharField(max_length=255)
|
||||
last_name = models.CharField(max_length=255)
|
||||
intro = RichTextField(blank=True)
|
||||
biography = RichTextField(blank=True)
|
||||
image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('first_name'),
|
||||
index.SearchField('last_name'),
|
||||
index.SearchField('intro'),
|
||||
index.SearchField('biography'),
|
||||
]
|
||||
|
||||
api_fields = ['first_name', 'last_name', 'intro', 'biography', 'image', 'feed_image'] + ContactFields.api_fields + ['related_links']
|
||||
|
||||
PersonPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('first_name'),
|
||||
FieldPanel('last_name'),
|
||||
FieldPanel('intro', classname="full"),
|
||||
FieldPanel('biography', classname="full"),
|
||||
ImageChooserPanel('image'),
|
||||
MultiFieldPanel(ContactFields.panels, "Contact"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
PersonPage.promote_panels = Page.promote_panels + [
|
||||
ImageChooserPanel('feed_image'),
|
||||
]
|
||||
|
||||
|
||||
# Contact page
|
||||
|
||||
class ContactPage(Page, ContactFields):
|
||||
body = RichTextField(blank=True)
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('body'),
|
||||
]
|
||||
|
||||
api_fields = ['body', 'feed_image'] + ContactFields.api_fields
|
||||
|
||||
ContactPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('body', classname="full"),
|
||||
MultiFieldPanel(ContactFields.panels, "Contact"),
|
||||
]
|
||||
|
||||
ContactPage.promote_panels = Page.promote_panels + [
|
||||
ImageChooserPanel('feed_image'),
|
||||
]
|
||||
|
||||
|
||||
# Event index page
|
||||
|
||||
class EventIndexPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.EventIndexPage', related_name='related_links')
|
||||
|
||||
|
||||
class EventIndexPage(Page):
|
||||
intro = RichTextField(blank=True)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('intro'),
|
||||
]
|
||||
|
||||
api_fields = ['intro', 'related_links']
|
||||
|
||||
@property
|
||||
def events(self):
|
||||
# Get list of live event pages that are descendants of this page
|
||||
events = EventPage.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=date.today())
|
||||
|
||||
# Order by date
|
||||
events = events.order_by('date_from')
|
||||
|
||||
return events
|
||||
|
||||
EventIndexPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('intro', classname="full"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
EventIndexPage.promote_panels = Page.promote_panels
|
||||
|
||||
|
||||
# Event page
|
||||
|
||||
class EventPageCarouselItem(Orderable, CarouselItem):
|
||||
page = ParentalKey('demo.EventPage', related_name='carousel_items')
|
||||
|
||||
|
||||
class EventPageRelatedLink(Orderable, RelatedLink):
|
||||
page = ParentalKey('demo.EventPage', related_name='related_links')
|
||||
|
||||
|
||||
class EventPageSpeaker(Orderable, LinkFields):
|
||||
page = ParentalKey('demo.EventPage', related_name='speakers')
|
||||
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"),
|
||||
]
|
||||
|
||||
api_fields = ['first_name', 'last_name', 'image']
|
||||
|
||||
|
||||
class EventPage(Page):
|
||||
date_from = models.DateField("Start date")
|
||||
date_to = models.DateField(
|
||||
"End date",
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Not required if event is on a single day"
|
||||
)
|
||||
time_from = models.TimeField("Start time", null=True, blank=True)
|
||||
time_to = models.TimeField("End time", null=True, blank=True)
|
||||
audience = models.CharField(max_length=255, choices=EVENT_AUDIENCE_CHOICES)
|
||||
location = models.CharField(max_length=255)
|
||||
body = RichTextField(blank=True)
|
||||
cost = models.CharField(max_length=255)
|
||||
signup_link = models.URLField(blank=True)
|
||||
feed_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('get_audience_display'),
|
||||
index.SearchField('location'),
|
||||
index.SearchField('body'),
|
||||
]
|
||||
|
||||
api_fields = ['date_from', 'date_to', 'time_from', 'time_to', 'audience', 'location', 'body', 'cost', 'signup_link', 'feed_image', 'speakers', 'carousel_items', 'related_links']
|
||||
|
||||
@property
|
||||
def event_index(self):
|
||||
# Find closest ancestor which is an event index
|
||||
return self.get_ancestors().type(EventIndexPage).last()
|
||||
|
||||
def serve(self, request):
|
||||
if "format" in request.GET:
|
||||
if request.GET['format'] == 'ical':
|
||||
# Export to ical format
|
||||
response = HttpResponse(
|
||||
export_event(self, 'ical'),
|
||||
content_type='text/calendar',
|
||||
)
|
||||
response['Content-Disposition'] = 'attachment; filename=' + self.slug + '.ics'
|
||||
return response
|
||||
else:
|
||||
# Unrecognised format error
|
||||
message = 'Could not export event\n\nUnrecognised format: ' + request.GET['format']
|
||||
return HttpResponse(message, content_type='text/plain')
|
||||
else:
|
||||
# Display event page as usual
|
||||
return super(EventPage, self).serve(request)
|
||||
|
||||
EventPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('date_from'),
|
||||
FieldPanel('date_to'),
|
||||
FieldPanel('time_from'),
|
||||
FieldPanel('time_to'),
|
||||
FieldPanel('location'),
|
||||
FieldPanel('audience'),
|
||||
FieldPanel('cost'),
|
||||
FieldPanel('signup_link'),
|
||||
InlinePanel('carousel_items', label="Carousel items"),
|
||||
FieldPanel('body', classname="full"),
|
||||
InlinePanel('speakers', label="Speakers"),
|
||||
InlinePanel('related_links', label="Related links"),
|
||||
]
|
||||
|
||||
EventPage.promote_panels = Page.promote_panels + [
|
||||
ImageChooserPanel('feed_image'),
|
||||
]
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
page = ParentalKey('FormPage', related_name='form_fields')
|
||||
|
||||
|
||||
class FormPage(AbstractEmailForm):
|
||||
intro = RichTextField(blank=True)
|
||||
thank_you_text = RichTextField(blank=True)
|
||||
|
||||
FormPage.content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('intro', classname="full"),
|
||||
InlinePanel('form_fields', label="Form fields"),
|
||||
FieldPanel('thank_you_text', classname="full"),
|
||||
MultiFieldPanel([
|
||||
FieldRowPanel([
|
||||
FieldPanel('from_address', classname="col6"),
|
||||
FieldPanel('to_address', classname="col6"),
|
||||
]),
|
||||
FieldPanel('subject'),
|
||||
], "Email"),
|
||||
]
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/* Example styling for an intro field */
|
||||
|
||||
.fieldname-intro input,
|
||||
.fieldname-intro textarea,
|
||||
.fieldname-intro .richtext{
|
||||
font-size:1.4em;
|
||||
}
|
||||
|
||||
/* Example styling for a blockquote block, where labels aren't required */
|
||||
|
||||
.blockname-pullquote .fields label{
|
||||
display:none;
|
||||
}
|
||||
|
||||
.blockname-pullquote .fields input,
|
||||
.blockname-pullquote .fields textarea{
|
||||
border:0;
|
||||
background-color:transparent;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.fieldname-quote .input{
|
||||
position: relative;
|
||||
padding-left: 3em;
|
||||
padding-right: 3em;
|
||||
}
|
||||
|
||||
.fieldname-quote .input:before,
|
||||
.fieldname-quote .input:after{
|
||||
content: "\201C";
|
||||
position: absolute;
|
||||
font-family: Bitter, Georgia, Serif;
|
||||
font-size: 5em;
|
||||
line-height: 1em;
|
||||
color :#CCC;
|
||||
}
|
||||
|
||||
.fieldname-quote .input:before{
|
||||
left: 0;
|
||||
}
|
||||
.fieldname-quote .input:after{
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.fieldname-quote textarea{
|
||||
font-size: 2em;
|
||||
font-family: Bitter, Georgia, Serif;
|
||||
}
|
||||
|
||||
.fieldname-attribution .field-content{
|
||||
margin-left:2em;
|
||||
}
|
||||
.fieldname-attribution .input{
|
||||
padding-left:1em;
|
||||
position:relative;
|
||||
}
|
||||
.fieldname-attribution .input:before{
|
||||
content: "—";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
$navbar-height: 51px;
|
||||
$padding-vertical: 15px;
|
||||
$wagtail-color: rgb(0, 127, 127);
|
||||
$html-background-color: whitesmoke;
|
||||
|
||||
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);
|
||||
|
||||
html {
|
||||
background-color: $html-background-color;
|
||||
}
|
||||
|
||||
/* fonts */
|
||||
body {
|
||||
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* body image styles - classes supplied by rich text editor */
|
||||
.body-content {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
margin-bottom: 1em;
|
||||
img {
|
||||
margin-bottom: 2%;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
img.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
img.left{
|
||||
width: 45%;
|
||||
margin-right: 5%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
img.right{
|
||||
width: 45%;
|
||||
margin-left: 5%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.img-wrapper {
|
||||
margin-bottom: 1em;
|
||||
position: relative;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
&.left {
|
||||
float:left;
|
||||
width: 45%;
|
||||
margin-right: 5%;
|
||||
}
|
||||
&.right {
|
||||
float:right;
|
||||
width: 45%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
}
|
||||
|
||||
.intro{
|
||||
font-size:1.4em;
|
||||
}
|
||||
|
||||
.caption {
|
||||
padding: 0.2em 1em 0.2em 0.5em;
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
background: #F2f2f2;
|
||||
font-style: italic;
|
||||
display: inline-block;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
left: 5px;
|
||||
font-size: 0.9em;
|
||||
max-width: calc(100% - 10px);
|
||||
|
||||
p{
|
||||
margin:0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
blockquote{
|
||||
margin:2em 0;
|
||||
|
||||
span{
|
||||
display:block;
|
||||
color: #AAA;
|
||||
font-size:0.8em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* List styling - tweaks to include images */
|
||||
|
||||
a.list-group-item {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
.list-group-item-text {
|
||||
margin-top: 1%;
|
||||
img {
|
||||
float: left;
|
||||
margin-right: 2%;
|
||||
margin-bottom: 1%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Style pager */
|
||||
.col-sm-4.pages {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.col-sm-4.next {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.main {
|
||||
padding-top: $navbar-height + $padding-vertical;
|
||||
min-height: 700px;
|
||||
}
|
||||
|
||||
.carousel {
|
||||
margin-bottom: $padding-vertical;
|
||||
.carousel-caption {
|
||||
background-color: transparentize($wagtail-color, 0.4);
|
||||
padding-top: 0;
|
||||
.btn {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.advert-list {
|
||||
margin-top: $padding-vertical;
|
||||
margin-bottom: 0;
|
||||
padding: $padding-vertical 0;
|
||||
background-color: $html-background-color;
|
||||
border-top: 1px solid darken($html-background-color, 25%);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
|
|
@ -1,7 +0,0 @@
|
|||
$(document).ready(function(){
|
||||
// Initializes tooltips
|
||||
$('[title]').tooltip({container: 'body'});
|
||||
|
||||
//Apply img-thumbnail class to body-content images
|
||||
$('.body-content img').addClass("img-thumbnail");
|
||||
});
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
# FluidVids.js [](https://travis-ci.org/toddmotto/fluidvids)
|
||||
|
||||
FluidVids is a raw JavaScript solution for responsive and fluid YouTube and Vimeo video embeds. It's extremely lightweight, and comes with a minified version for production environments. FluidVids comes preconfigured to make YouTube and Vimeo videos fluid, but you can add more as you please. You don't need to call FluidVids, it will just work its magic on video embeds automatically.
|
||||
|
||||
## Demo
|
||||
Check out a [demo of FluidVids](http://toddmotto.com/labs/fluidvids).
|
||||
|
||||
## Installing with Bower
|
||||
To install FluidVids into your project using Bower, use the GitHub repository hook:
|
||||
|
||||
```
|
||||
bower install https://github.com/toddmotto/fluidvids.git
|
||||
```
|
||||
|
||||
## Manual installation
|
||||
Drop your files into your required folders, make sure you're using the files from the `dist` folder, which is the compiled production-ready code. Ensure you place the script before the closing `</body>` tag so the DOM tree is populated when the script runs.
|
||||
|
||||
```html
|
||||
<body>
|
||||
<!-- html content above -->
|
||||
<script src="dist/fluidvids.js"></script>
|
||||
</body>
|
||||
```
|
||||
|
||||
## Scaffolding
|
||||
Project files and folder structure.
|
||||
|
||||
```
|
||||
├── dist/
|
||||
│ ├── fluidvids.js
|
||||
│ └── fluidvids.min.js
|
||||
├── src/
|
||||
│ └── fluidvids.js
|
||||
├── .editorconfig
|
||||
├── .gitignore
|
||||
├── .jshintrc
|
||||
├── .travis.yml
|
||||
├── Gruntfile.js
|
||||
├── config.json
|
||||
└── package.json
|
||||
```
|
||||
|
||||
## Grunt tasks
|
||||
FluidVids comes pre-configured with `Gruntfile.js` which contains all of Grunt's tasks. These tasks are `grunt-contrib-concat` for concatenating files, `grunt-contrib-jshint` for JSHinting the project files, `grunt-contrib-uglify` for minifying the code. The hidden file `.jshintrc` contains the configuration for the JSHint tests.
|
||||
|
||||
## Adding more video players
|
||||
FluidVids use a Regular Expression and searches the `src=""` attribute of any `iframe` tags on the page. If the RegExp matches the attribute, FluidVids will then do it's thing and make your videos responsive.
|
||||
|
||||
Here's the line you'll need to change:
|
||||
|
||||
```javascript
|
||||
players = /www.youtube.com|player.vimeo.com/;
|
||||
```
|
||||
|
||||
The dividing `|` operator is essentially 'or' in RegExp. For instance, if you wanted to add the no cookies version of YouTube, you could action the following:
|
||||
|
||||
```javascript
|
||||
players = /www.youtube.com|www.youtube-nocookie.com|player.vimeo.com/;
|
||||
```
|
||||
|
||||
## License
|
||||
MIT license
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
window.Fluidvids = (function (window, document, undefined) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var players, obj;
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var css = '.fluidvids-elem{position:absolute;top:0px;left:0px;width:100%;' +
|
||||
'height:100%;}.fluidvids{width:100%;position:relative;}';
|
||||
|
||||
var _matchesPlayer = function (source) {
|
||||
players = new RegExp('^(https?:)?\/\/(?:' + obj.join('|') + ').*$', 'i');
|
||||
return players.test(source);
|
||||
};
|
||||
|
||||
var _render = function (elem) {
|
||||
var wrap = document.createElement('div');
|
||||
var thisParent = elem.parentNode;
|
||||
var ratio = (parseInt(elem.height ? elem.height : elem.offsetHeight, 10) /
|
||||
(parseInt(elem.width ? elem.width : elem.offsetWidth, 10)) * 100);
|
||||
|
||||
thisParent.insertBefore(wrap, elem);
|
||||
elem.className += ' fluidvids-elem';
|
||||
wrap.className += ' fluidvids';
|
||||
wrap.style.paddingTop = ratio + '%';
|
||||
wrap.appendChild(elem);
|
||||
};
|
||||
|
||||
var _appendStyles = function () {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '<p>x</p><style>' + css + '</style>';
|
||||
head.appendChild(div.childNodes[1]);
|
||||
};
|
||||
|
||||
var init = function (object) {
|
||||
var options = object || {};
|
||||
var selector = options.selector || 'iframe';
|
||||
obj = options.players || ['www.youtube.com', 'player.vimeo.com'];
|
||||
var nodes = document.querySelectorAll(selector);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var self = nodes[i];
|
||||
if (_matchesPlayer(self.src)) {
|
||||
_render(self);
|
||||
}
|
||||
}
|
||||
_appendStyles();
|
||||
};
|
||||
|
||||
return {
|
||||
init: init
|
||||
};
|
||||
|
||||
})(window, document);
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
{% load demo_tags cache compress static wagtailuserbar %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>{% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_postfix %} | Wagtail Demo{% endblock %}</title>
|
||||
|
||||
<meta name="description" content="{% if self.search_description %}{{ self.search_description }}{% endif %}">
|
||||
|
||||
{# External stylesheets #}
|
||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
|
||||
|
||||
{# Local static assets such as css, images and javascrpt should be stored at [yourapp]/static/[yourapp]/... #}
|
||||
{% compress css %}
|
||||
{# Custom stylesheets #}
|
||||
{# SCSS compilation relies on django compressor #}
|
||||
<link rel="stylesheet" type="text/x-scss" href="{% static "demo/css/main.scss" %}" />
|
||||
{% endcompress %}
|
||||
|
||||
{% block extra_css %}{% endblock %} {# Override this block in individual templates in order to add stylesheets on a template by template basis #}
|
||||
|
||||
{# Javascript that needs to be called from head e.g. google analytics snippet and bootstrap shivs #}
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class="{% block body_class %}{% endblock %}"> {# Override this block to set custom body classes on a template by template basis #}
|
||||
|
||||
{% wagtailuserbar %}
|
||||
|
||||
{% block menu %}
|
||||
{% get_site_root as site_root %}
|
||||
{% top_menu parent=site_root calling_page=self %}
|
||||
{% endblock %}
|
||||
|
||||
<div class="main container">
|
||||
|
||||
{% breadcrumbs %}
|
||||
|
||||
{% block heading %}
|
||||
<div class="page-header">
|
||||
<h1>{{ self.title }}</h1>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
{% include 'demo/includes/prev_next.html' %}
|
||||
|
||||
</div>
|
||||
|
||||
{% adverts %}
|
||||
|
||||
{# External javascript #}
|
||||
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
|
||||
|
||||
{% compress js %}
|
||||
<script src="{% static "demo/js/vendor/fluidvids.js" %}"></script>
|
||||
{# Custom javascript #}
|
||||
{# Local static assets such as css, images and javascrpt should be stored at [yourapp]/static/[yourapp]/... #}
|
||||
<script src="{% static "demo/js/main.js" %}"></script>
|
||||
{% endcompress %}
|
||||
|
||||
{% block extra_js %}{% endblock %} {# Override this block in individual templates in order to add javascript on a template by template basis #}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/intro.html" with intro=self.intro only %}
|
||||
|
||||
{% if request.GET.tag|length %}
|
||||
<h4>Showing posts tagged as {{ request.GET.tag }} <a href=" {% pageurl self %} ">Show all</a></h4>
|
||||
{% endif %}
|
||||
|
||||
<div class="list-group">
|
||||
{# Uses serve method defined in models.py - allows for paging if required #}
|
||||
{# See also standard index for creating a listing with a tag #}
|
||||
{% for blog in blogs %}
|
||||
{% include "demo/includes/blog_list_item.html" %}
|
||||
{% empty %}
|
||||
No blogs found
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{# Pagination - uses django.core.paginator #}
|
||||
{# Append any other url query string variables to the next and previous links - allows tag to be passed through #}
|
||||
<div class="row">
|
||||
<div class="col-sm-4 previous">
|
||||
{% if blogs.has_previous %}
|
||||
<a href="?page={{ blogs.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">Previous</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-4 pages">
|
||||
Page {{ blogs.number }} of {{ blogs.paginator.num_pages }}
|
||||
</div>
|
||||
<div class="col-sm-4 next">
|
||||
{% if blogs.has_next %}
|
||||
<a href="?page={{ blogs.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">Next</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
|
||||
{% block heading %}
|
||||
<div class="page-header">
|
||||
|
||||
<div class="pull-right">
|
||||
{% for tag in self.tags.all %}
|
||||
<a href="{% pageurl self.blog_index %}?tag={{ tag }}"
|
||||
class="btn btn-primary btn-xs">
|
||||
<i class="glyphicon glyphicon-tag"></i> {{ tag }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<h2>
|
||||
{{ self.title }}
|
||||
{% if self.date %}<small>{{ self.date }}</small>{% endif %}
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/carousel.html" with carousel_items=self.carousel_items.all only %}
|
||||
|
||||
{% if self.body %}
|
||||
<div class="body-content">
|
||||
{% include "demo/includes/streamfield.html" with content=self.body %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
|
||||
{% load demo_tags wagtailcore_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% if self.body %}
|
||||
<div class="body-content">
|
||||
{{ self.body|richtext }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include "demo/includes/contact.html" with contact=self only %}
|
||||
|
||||
{% if self.post_code %}
|
||||
|
||||
{% get_google_maps_key as google_maps_key %}
|
||||
|
||||
<div class="page-header"><h3>Map</h3></div>
|
||||
|
||||
<img src="http://maps.googleapis.com/maps/api/staticmap?center={{ self.post_code }}&zoom=13&size=800x400&maptype=roadmap&sensor=false&markers=color:green|{{ self.post_code }}{% if google_maps_key %}&key={{ google_maps_key }}{% endif %}" />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/intro.html" with intro=self.intro only %}
|
||||
|
||||
{# Uses method defined in models.py to retrieve all upcoming events #}
|
||||
{# See also standard index for creating a listing with a tag #}
|
||||
{% with self.events.all as events %}
|
||||
{% if events %}
|
||||
<div class="list-group">
|
||||
{% for event in events %}
|
||||
{% include "demo/includes/event_list_item.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load demo_tags wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="well">
|
||||
<p><strong>
|
||||
{{ self.date_from }}{% if self.date_to %} to {{ self.date_to }}{% endif %}
|
||||
{% if self.time_from %}{{ self.time_from|time }}{% endif %}{% if self.time_to %} to {{ self.time_to|time }}{% endif %}
|
||||
</strong></p>
|
||||
{% if self.location %}<p>Location: {{ self.location }}</p>{% endif %}
|
||||
{% if self.audience %}
|
||||
<p>Audience:
|
||||
{# From EVENT_AUDIENCE_CHOICES in models.py #}
|
||||
{{ self.get_audience_display }}</p>
|
||||
{% endif %}
|
||||
{% if self.cost %}
|
||||
<p>Cost: {{ self.cost }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if self.signup_link %}
|
||||
<p>Sign up: <a href="{{ self.signup_link }}">{{ self.signup_link }}</a></p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<a class='calendar' href= "{{ self.url }}?format=ical">
|
||||
Add to calendar
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% include "demo/includes/carousel.html" with carousel_items=self.carousel_items.all only %}
|
||||
|
||||
{% if self.body %}
|
||||
<div class="body-content">
|
||||
{{ self.body|richtext }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% with self.speakers.all as speakers %}
|
||||
{% if speakers %}
|
||||
<div class="page-header"><h3>Speakers</h3></div>
|
||||
{% for speaker in speakers %}
|
||||
{% cycle '<div class="row">' '' '' %} {# Open row div before first speaker then every 3 loops #}
|
||||
<div class="col-sm-4">
|
||||
|
||||
{% if speaker.link %}
|
||||
<a href="{{ speaker.link }}">
|
||||
{% endif %}
|
||||
|
||||
{# Speaker name_display fields concatenates first_name and last_name fields #}
|
||||
<h4>{{ speaker.name_display }}</h4>
|
||||
{% if speaker.image %}
|
||||
<div class="image">{% image speaker.image width-200 %}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if speaker.link %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% cycle '' '' '</div>' %} {# Close row div before every 3rd speaker #}
|
||||
{% endfor %}
|
||||
{% if not speakers|length|divisibleby:'3' %}</div>{% endif %} {# Last close of row div if speakers list not exactly divisble by 3 #}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/intro.html" with intro=self.intro only %}
|
||||
|
||||
<form action="{% pageurl self %}" method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% block content %}
|
||||
{{ self.thank_you_text|richtext }}
|
||||
{% endblock %}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load demo_tags %}
|
||||
|
||||
|
||||
{% block heading %}
|
||||
<div class="jumbotron">
|
||||
<h1>Wagtail Demo</h1>
|
||||
<p>A set of demo templates to show you what Wagtail can do.</p>
|
||||
{% block search_box %}
|
||||
{% include "demo/includes/search_box.html" only %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/carousel.html" with carousel_items=self.carousel_items.all only %}
|
||||
|
||||
{% if self.body %}
|
||||
<div class="body-content">
|
||||
{% include "demo/includes/streamfield.html" with content=self.body %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% person_listing_homepage %}
|
||||
|
||||
{% blog_listing_homepage %}
|
||||
|
||||
{% event_listing_homepage %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{# Individual blog item in a list - used on blog index and home page #}
|
||||
<a class="list-group-item" href="{% pageurl blog %}">
|
||||
<div class="media">
|
||||
{% if blog.feed_image %}
|
||||
<div class="media-left">
|
||||
{% image blog.feed_image width-200 as img %}
|
||||
<img class="media-object" src="{{ img.url }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading">{{ blog.title }}</h4>
|
||||
<p><strong>{{ blog.date }}</strong></p>
|
||||
{% if blog.search_description %}
|
||||
<p>{{ blog.search_description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
{% load wagtailimages_tags wagtailembeds_tags %}
|
||||
|
||||
|
||||
{% if carousel_items %}
|
||||
<div id="carousel" class="carousel slide" data-ride="carousel">
|
||||
{% if carousel_items|length > 1 %}
|
||||
<ol class="carousel-indicators">
|
||||
{% for carousel_item in carousel_items %}
|
||||
<li data-target="#carousel" data-slide-to="{{ forloop.counter0 }}"{% if forloop.first %} class="active"{% endif %}></li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
|
||||
<div class="carousel-inner" role="listbox">
|
||||
{% for carousel_item in carousel_items %}
|
||||
<div class="item{% if forloop.first %} active{% endif %}">
|
||||
{% if carousel_item.embed_url %}
|
||||
{# Embedded video - requires an embedly key to be stored in wagtaildemo/settings/local.py #}
|
||||
<div class="text-center">
|
||||
{% embed carousel_item.embed_url 1000 %}
|
||||
</div>
|
||||
{% else %}
|
||||
{# Carousel image - first store image as a variable in order to construct an image tag with a title applied (title is used by bxslider js to construct the caption) #}
|
||||
{% image carousel_item.image width-1000 as carouselimagedata %}
|
||||
<img src="{{ carouselimagedata.url }}" style="width: 100%; min-height: {{ carouselimagedata.height }}px;" alt="{{ carouselimagedata.alt }}" />
|
||||
{% endif %}
|
||||
{% if carousel_item.caption or carousel_item.link %}
|
||||
<div class="carousel-caption">
|
||||
<h3>{{ carousel_item.caption }}</h3>
|
||||
{% if carousel_item.link %}
|
||||
<a href="{{ carousel_item.link }}" class="btn btn-primary">Open</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if carousel_items|length > 1 %}
|
||||
<a class="left carousel-control" href="#carousel" role="button" data-slide="prev">
|
||||
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="right carousel-control" href="#carousel" role="button" data-slide="next">
|
||||
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<div class="page-header"><h3>Contact</h3></div>
|
||||
<div class="row">
|
||||
<dl>
|
||||
<div class="col-sm-4">
|
||||
{% if contact.address_1 %}
|
||||
<dt>Address 1</dt>
|
||||
<dd>{{ contact.address_1 }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if contact.address_2 %}
|
||||
<dt>Address 2</dt>
|
||||
<dd>{{ contact.address_2 }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if contact.city %}
|
||||
<dt>City</dt>
|
||||
<dd>{{ contact.city }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if contact.country %}
|
||||
<dt>Country</dt>
|
||||
<dd>{{ contact.country }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if contact.post_code %}
|
||||
<dt>Post code</dt>
|
||||
<dd>{{ contact.post_code }}</dd>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{% if contact.telephone %}
|
||||
<dt>Telephone</dt>
|
||||
<dd>{{ contact.telephone }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if contact.email %}
|
||||
<dt>Email</dt>
|
||||
<dd>{{ contact.email }}</dd>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{# Individual event item in a list - used on event index and home page #}
|
||||
<a class="list-group-item" href="{% pageurl event %}">
|
||||
<div class="media">
|
||||
{% if event.feed_image %}
|
||||
<div class="media-left">
|
||||
{% image event.feed_image width-200 as img %}
|
||||
<img class="media-object" src="{{ img.url }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading">{{ event.title }}</h4>
|
||||
<p><strong>{{ event.date_from }}{% if event.date_to %} to {{ event.date_to }}{% endif %}</strong></p>
|
||||
{% if event.search_description %}
|
||||
<p>{{ event.search_description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{% load wagtailcore_tags %}
|
||||
|
||||
{% if intro %}
|
||||
<div class="well">
|
||||
{{ intro|richtext }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{# Individual person item in a list - used on people index and home page #}
|
||||
<a class="list-group-item" href="{% pageurl person %}">
|
||||
<div class="media">
|
||||
{% if person.feed_image %}
|
||||
<div class="media-left">
|
||||
{% image person.feed_image width-200 as img %}
|
||||
<img class="media-object" src="{{ img.url }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading">{{ person.first_name }} {{ person.last_name }}</h4>
|
||||
{% if person.search_description %}
|
||||
<p>{{ person.search_description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{% load wagtailcore_tags %}
|
||||
|
||||
{% if self.depth > 3 %}{# Previous and next buttons are not relevant for the home page and categories #}
|
||||
{% with prev=self.get_prev_siblings.live.first next=self.get_next_siblings.live.first %}
|
||||
<nav>
|
||||
<ul class="pager">
|
||||
<li class="previous{% if not prev %} disabled{% endif %}">
|
||||
<a href="{% if prev %}{% pageurl prev %}{% else %}#{% endif %}"
|
||||
{% if prev %}title="{{ prev }}"{% endif %}>
|
||||
<i class="glyphicon glyphicon-menu-left" aria-hidden="true"></i> Previous
|
||||
</a>
|
||||
</li>
|
||||
<li class="next{% if not next %} disabled{% endif %}">
|
||||
<a href="{% if next %}{% pageurl next %}{% else %}#{% endif %}"
|
||||
{% if next %}title="{{ next }}"{% endif %}>
|
||||
Next <i class="glyphicon glyphicon-menu-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{% if related_links %}
|
||||
<div class="page-header"></div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Related links</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul>
|
||||
{% for related_link in related_links %}
|
||||
<li><a href="{{ related_link.link }}">{{ related_link.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<form action="{% url 'search' %}" class="form-inline" method="get">
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="input-group">
|
||||
<input type="text" name="query" class="form-control" />
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="glyphicon glyphicon-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
<div class="stream-field">
|
||||
{% for child in content %}
|
||||
{% if child.block_type == 'h2' %}
|
||||
<h2>{{ child }}</h2>
|
||||
{% elif child.block_type == 'h3' %}
|
||||
<h3>{{ child }}</h3>
|
||||
{% elif child.block_type == 'h4' %}
|
||||
<h4>{{ child }}</h4>
|
||||
{% elif child.block_type == 'intro' %}
|
||||
<div class="intro">{{ child }}</div>
|
||||
{% elif child.block_type == 'aligned_html' %}
|
||||
{% if child.value.alignment == 'normal' %}
|
||||
{{ child.value.bound_blocks.html.render }}
|
||||
{% else %}
|
||||
{{ child.value.bound_blocks.html.render }}
|
||||
{% endif %}
|
||||
{% elif child.block_type == 'pullquote' %}
|
||||
<blockquote>
|
||||
{{ child.value.quote }}
|
||||
{% if child.value.attribution %}<span>- {{ child.value.attribution }}</span>{% endif %}
|
||||
</blockquote>
|
||||
{% elif child.block_type == 'paragraph' %}
|
||||
{{ child.value|richtext }}
|
||||
{% elif child.block_type == 'aligned_image' %}
|
||||
<div class="img-wrapper {{ child.value.alignment }}">
|
||||
{% if child.value.alignment == "left" or child.value.alignment == "right" %}
|
||||
{% image child.value.image width-300 as theimage %}
|
||||
{% else %}
|
||||
{% image child.value.image width-1280 as theimage %}
|
||||
{% endif %}
|
||||
|
||||
<img src="{{ theimage.url }}" width="{{ theimage.width }}" height="{{ theimage.height }}" alt="{{ theimage.alt }}" />
|
||||
|
||||
{% if child.value.caption %}
|
||||
<div class="caption">
|
||||
{{ child.value.caption|richtext }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ child }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/intro.html" with intro=self.intro only %}
|
||||
|
||||
{% if self.image %}
|
||||
{% image self.image width-300 class="img-thumbnail" %}
|
||||
{% endif %}
|
||||
|
||||
{% if self.biography %}
|
||||
<div class="page-header"><h3>Biography</h3></div>
|
||||
{% endif %}
|
||||
|
||||
{% if self.body %}
|
||||
<div class="body-content">
|
||||
{{ self.body|richtext }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include "demo/includes/contact.html" with contact=self only %}
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% block title %}Search{% if search_results %} results{% endif %}{% endblock %}
|
||||
|
||||
{% block heading %}
|
||||
<h1 class="page-header">
|
||||
Search results{% if request.GET.query %} for “{{ request.GET.query }}”{% endif %}
|
||||
</h1>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% if search_picks %}
|
||||
<div class="well">
|
||||
<h3>Editors picks</h3>
|
||||
<ul>
|
||||
{% for pick in search_picks %}
|
||||
<li>
|
||||
<h4><a href="{% pageurl pick.page %}">{{ pick.page.title }}</a></h4>
|
||||
<p>{{ pick.description }}</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if search_results %}
|
||||
<ul>
|
||||
{% for result in search_results %}
|
||||
<li>
|
||||
<h4><a href="{% pageurl result.specific %}">{{ result.specific }}</a></h4>
|
||||
{% if result.specific.search_description %}
|
||||
{{ result.specific.search_description }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% elif search_query %}
|
||||
No results found
|
||||
{% else %}
|
||||
You didn’t search anything!
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
{% load wagtailcore_tags demo_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/intro.html" with intro=self.intro only %}
|
||||
|
||||
{# Listing created with a tag - allows filtering by whether the page is live #}
|
||||
{# See also the blog index or events index where the listing is created from a method defined in models.py #}
|
||||
{% standard_index_listing calling_page=self %}
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
{% extends "demo/base.html" %}
|
||||
|
||||
{% load wagtailcore_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% include "demo/includes/intro.html" with intro=self.intro only %}
|
||||
|
||||
{% include "demo/includes/carousel.html" with carousel_items=self.carousel_items.all only %}
|
||||
|
||||
{% if self.body %}
|
||||
<div class="body-content">
|
||||
{{ self.body|richtext }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include "demo/includes/related_links.html" with related_links=self.related_links.all only %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{% load wagtailcore_tags %}
|
||||
|
||||
{% if adverts %}
|
||||
<ul class="advert-list list-inline text-center">
|
||||
{% for advert in adverts %}
|
||||
<li>
|
||||
{% if advert.url %}
|
||||
<a href="{{ advert.url }}">
|
||||
{% elif advert.page %}
|
||||
<a href="{% pageurl advert.page %}">
|
||||
{% endif %}
|
||||
{{ advert.text }}
|
||||
{% if advert.url or advert.page %}</a>{% endif %}
|
||||
</li>
|
||||
{% if not forloop.last %}<li><strong>·</strong></li>{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{% if blogs %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title">Recent blog posts</h3></div>
|
||||
<div class="list-group">
|
||||
{% for blog in blogs %}
|
||||
{% include "demo/includes/blog_list_item.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
{% load wagtailcore_tags %}
|
||||
|
||||
{% if ancestors %}
|
||||
<ol class="breadcrumb">
|
||||
{% for ancestor in ancestors %}
|
||||
{% if forloop.last %}
|
||||
<li class="active">{{ ancestor }}</li>
|
||||
{% else %}
|
||||
<li><a href="{% pageurl ancestor %}">{{ ancestor }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{% if events %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title">Upcoming events</h3></div>
|
||||
<div class="list-group">
|
||||
{% for event in events %}
|
||||
{% include "demo/includes/event_list_item.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{% if people %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title">People</h3></div>
|
||||
<div class="list-group">
|
||||
{% for person in people %}
|
||||
{% include "demo/includes/person_list_item.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
{% load wagtailcore_tags %}
|
||||
{% if pages %}
|
||||
<div class="list-group">
|
||||
{% for page in pages %}
|
||||
<a class="list-group-item" href="{% pageurl page %}">
|
||||
<h4 class="list-group-item-heading">{{ page.title }}</h4>
|
||||
{% if page.search_description %}
|
||||
<p class="list-group-item-text">{{ page.search_description }}</p>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
{% load demo_tags wagtailcore_tags %}
|
||||
{% get_site_root as site_root %}
|
||||
|
||||
{# Implementation of bootstrap theme dropdown menu - shows top level links and their children #}
|
||||
<div role="navigation" class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
{# Link to home page #}
|
||||
<a href="{% pageurl site_root %}" class="navbar-brand" title="{{ site_root.title }}" data-placement="bottom">
|
||||
<i class="glyphicon glyphicon-home"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
{% for menuitem in menuitems %}
|
||||
<li class="{% if menuitem.show_dropdown %}dropdown{% endif %}{% if menuitem.active %} active{% endif %}">
|
||||
{% if menuitem.show_dropdown %}
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">{{ menuitem.title }} <b class="caret"></b></a>
|
||||
{% top_menu_children parent=menuitem %}
|
||||
{% else %}
|
||||
<a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<form class="navbar-form navbar-right" role="search" action="{% url 'search' %}" method="get">
|
||||
<div class="input-group">
|
||||
<input type="text" name="query" class="form-control" placeholder="Search…" value="{{ search_query }}" />
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{% load demo_tags wagtailcore_tags %}
|
||||
|
||||
<ul class="dropdown-menu">
|
||||
{# Include link to parent because the parent link is a drop down #}
|
||||
<li><a href="{% pageurl parent %}">{{ parent.title }}</a></li>
|
||||
{% for child in menuitems_children %}
|
||||
<li><a href="{% pageurl child %}">{{ child.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
from datetime import date
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
|
||||
from demo.models import PersonPage, BlogPage, EventPage, Advert, Page
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
# settings value
|
||||
@register.assignment_tag
|
||||
def get_google_maps_key():
|
||||
return getattr(settings, 'GOOGLE_MAPS_KEY', "")
|
||||
|
||||
|
||||
@register.assignment_tag(takes_context=True)
|
||||
def get_site_root(context):
|
||||
# NB this returns a core.Page, not the implementation-specific model used
|
||||
# so object-comparison to self will return false as objects would differ
|
||||
return context['request'].site.root_page
|
||||
|
||||
|
||||
def has_menu_children(page):
|
||||
return page.get_children().live().in_menu().exists()
|
||||
|
||||
|
||||
# Retrieves the top menu items - the immediate children of the parent page
|
||||
# The has_menu_children method is necessary because the bootstrap menu requires
|
||||
# a dropdown class to be applied to a parent
|
||||
@register.inclusion_tag('demo/tags/top_menu.html', takes_context=True)
|
||||
def top_menu(context, parent, calling_page=None):
|
||||
menuitems = parent.get_children().live().in_menu()
|
||||
for menuitem in menuitems:
|
||||
menuitem.show_dropdown = has_menu_children(menuitem)
|
||||
# We don't directly check if calling_page is None since the template
|
||||
# engine can pass an empty string to calling_page
|
||||
# if the variable passed as calling_page does not exist.
|
||||
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
||||
if calling_page else False)
|
||||
return {
|
||||
'calling_page': calling_page,
|
||||
'menuitems': menuitems,
|
||||
# required by the pageurl tag that we want to use within this template
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
# Retrieves the children of the top menu items for the drop downs
|
||||
@register.inclusion_tag('demo/tags/top_menu_children.html', takes_context=True)
|
||||
def top_menu_children(context, parent):
|
||||
menuitems_children = parent.get_children()
|
||||
menuitems_children = menuitems_children.live().in_menu()
|
||||
return {
|
||||
'parent': parent,
|
||||
'menuitems_children': menuitems_children,
|
||||
# required by the pageurl tag that we want to use within this template
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
# Retrieves all live pages which are children of the calling page
|
||||
#for standard index listing
|
||||
@register.inclusion_tag(
|
||||
'demo/tags/standard_index_listing.html',
|
||||
takes_context=True
|
||||
)
|
||||
def standard_index_listing(context, calling_page):
|
||||
pages = calling_page.get_children().live()
|
||||
return {
|
||||
'pages': pages,
|
||||
# required by the pageurl tag that we want to use within this template
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
# Person feed for home page
|
||||
@register.inclusion_tag(
|
||||
'demo/tags/person_listing_homepage.html',
|
||||
takes_context=True
|
||||
)
|
||||
def person_listing_homepage(context, count=2):
|
||||
people = PersonPage.objects.live().order_by('?')
|
||||
return {
|
||||
'people': people[:count].select_related('feed_image'),
|
||||
# required by the pageurl tag that we want to use within this template
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
# Blog feed for home page
|
||||
@register.inclusion_tag(
|
||||
'demo/tags/blog_listing_homepage.html',
|
||||
takes_context=True
|
||||
)
|
||||
def blog_listing_homepage(context, count=2):
|
||||
blogs = BlogPage.objects.live().order_by('-date')
|
||||
return {
|
||||
'blogs': blogs[:count].select_related('feed_image'),
|
||||
# required by the pageurl tag that we want to use within this template
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
# Events feed for home page
|
||||
@register.inclusion_tag(
|
||||
'demo/tags/event_listing_homepage.html',
|
||||
takes_context=True
|
||||
)
|
||||
def event_listing_homepage(context, count=2):
|
||||
events = EventPage.objects.live()
|
||||
events = events.filter(date_from__gte=date.today()).order_by('date_from')
|
||||
return {
|
||||
'events': events[:count].select_related('feed_image'),
|
||||
# required by the pageurl tag that we want to use within this template
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
# Advert snippets
|
||||
@register.inclusion_tag('demo/tags/adverts.html', takes_context=True)
|
||||
def adverts(context):
|
||||
return {
|
||||
'adverts': Advert.objects.select_related('page'),
|
||||
'request': context['request'],
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('demo/tags/breadcrumbs.html', takes_context=True)
|
||||
def breadcrumbs(context):
|
||||
self = context.get('self')
|
||||
if self is None or self.depth <= 2:
|
||||
# When on the home page, displaying breadcrumbs is irrelevant.
|
||||
ancestors = ()
|
||||
else:
|
||||
ancestors = Page.objects.ancestor_of(
|
||||
self, inclusive=True).filter(depth__gt=2)
|
||||
return {
|
||||
'ancestors': ancestors,
|
||||
'request': context['request'],
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
from datetime import datetime, time, timedelta
|
||||
import hashlib
|
||||
|
||||
|
||||
def export_event(event, format='ical'):
|
||||
# Only ical format supported at the moment
|
||||
if format != 'ical':
|
||||
return
|
||||
|
||||
# Begin event
|
||||
# VEVENT format: http://www.kanzaki.com/docs/ical/vevent.html
|
||||
ical_components = [
|
||||
'BEGIN:VCALENDAR',
|
||||
'VERSION:2.0',
|
||||
'PRODID:-//Torchbox//wagtail//EN',
|
||||
]
|
||||
|
||||
# Work out number of days the event lasts
|
||||
if event.date_to is not None:
|
||||
days = (event.date_to - event.date_from).days + 1
|
||||
else:
|
||||
days = 1
|
||||
|
||||
for day in range(days):
|
||||
# Get date
|
||||
date = event.date_from + timedelta(days=day)
|
||||
|
||||
# Get times
|
||||
if event.time_from is not None:
|
||||
start_time = event.time_from
|
||||
else:
|
||||
start_time = time.min
|
||||
if event.time_to is not None:
|
||||
end_time = event.time_to
|
||||
else:
|
||||
end_time = time.max
|
||||
|
||||
# Combine dates and times
|
||||
start_datetime = datetime.combine(
|
||||
date,
|
||||
start_time
|
||||
)
|
||||
end_datetime = datetime.combine(date, end_time)
|
||||
|
||||
def add_slashes(string):
|
||||
string.replace('"', '\\"')
|
||||
string.replace('\\', '\\\\')
|
||||
string.replace(',', '\\,')
|
||||
string.replace(':', '\\:')
|
||||
string.replace(';', '\\;')
|
||||
string.replace('\n', '\\n')
|
||||
return string
|
||||
|
||||
# Make a uid
|
||||
event_string = event.url + str(start_datetime)
|
||||
uid = hashlib.sha1(event_string.encode('utf-8')).hexdigest() + '@wagtaildemo'
|
||||
|
||||
# Make event
|
||||
ical_components.extend([
|
||||
'BEGIN:VEVENT',
|
||||
'UID:' + add_slashes(uid),
|
||||
'URL:' + add_slashes(event.url),
|
||||
'DTSTAMP:' + start_time.strftime('%Y%m%dT%H%M%S'),
|
||||
'SUMMARY:' + add_slashes(event.title),
|
||||
'DESCRIPTION:' + add_slashes(event.search_description),
|
||||
'LOCATION:' + add_slashes(event.location),
|
||||
'DTSTART;TZID=Europe/London:' + start_datetime.strftime('%Y%m%dT%H%M%S'),
|
||||
'DTEND;TZID=Europe/London:' + end_datetime.strftime('%Y%m%dT%H%M%S'),
|
||||
'END:VEVENT',
|
||||
])
|
||||
|
||||
# Finish event
|
||||
ical_components.extend([
|
||||
'END:VCALENDAR',
|
||||
])
|
||||
|
||||
# Join components
|
||||
return '\r'.join(ical_components)
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
from django.shortcuts import render
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailsearch.models import Query
|
||||
|
||||
try:
|
||||
# Wagtail >= 1.1
|
||||
from wagtail.contrib.wagtailsearchpromotions.models import SearchPromotion
|
||||
except ImportError:
|
||||
# Wagtail < 1.1
|
||||
from wagtail.wagtailsearch.models import EditorsPick as SearchPromotion
|
||||
|
||||
|
||||
def search(request):
|
||||
# Search
|
||||
search_query = request.GET.get('query', None)
|
||||
if search_query:
|
||||
search_results = Page.objects.live().search(search_query)
|
||||
query = Query.get(search_query)
|
||||
|
||||
# Record hit
|
||||
query.add_hit()
|
||||
|
||||
# Get search picks
|
||||
search_picks = query.editors_picks.all()
|
||||
else:
|
||||
search_results = Page.objects.none()
|
||||
search_picks = SearchPromotion.objects.none()
|
||||
|
||||
# Pagination
|
||||
page = request.GET.get('page', 1)
|
||||
paginator = Paginator(search_results, 10)
|
||||
try:
|
||||
search_results = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
search_results = paginator.page(1)
|
||||
except EmptyPage:
|
||||
search_results = paginator.page(paginator.num_pages)
|
||||
|
||||
return render(request, 'demo/search_results.html', {
|
||||
'search_query': search_query,
|
||||
'search_results': search_results,
|
||||
'search_picks': search_picks,
|
||||
})
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
from django.utils.html import format_html
|
||||
from django.conf import settings
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
|
||||
@hooks.register('insert_editor_css')
|
||||
def editor_css():
|
||||
return format_html('<link rel="stylesheet" href="' + settings.STATIC_URL + 'demo/css/admin-streamfield-styles.css">')
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wagtaildemo.settings")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
Django>=1.10,<1.11
|
||||
psycopg2==2.6
|
||||
django-compressor>=1.4
|
||||
django-modelcluster>=0.6
|
||||
wagtail>=1.10,<1.11
|
||||
django-taggit>=0.14.0
|
||||
django-libsass>=0.2
|
||||
libsass==0.8.2
|
||||
Pillow==3.2.0
|
||||
html5lib==0.999999
|
||||
|
||||
# Dependencies for hosting
|
||||
django-redis==3.8.2
|
||||
elasticsearch==1.2.0
|
||||
|
||||
# Dependencies for Heroku deployment
|
||||
dj-database-url==0.3.0
|
||||
whitenoise>=3.1,<4.0
|
||||
uwsgi>=2.0,<2.1
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PROJECT_NAME="wagtaildemo"
|
||||
|
||||
PROJECT_DIR=/home/vagrant/wagtaildemo
|
||||
VIRTUALENV_DIR=/home/vagrant/.virtualenvs/$PROJECT_NAME
|
||||
|
||||
PYTHON=$VIRTUALENV_DIR/bin/python
|
||||
PIP=$VIRTUALENV_DIR/bin/pip
|
||||
|
||||
|
||||
# Create database
|
||||
su - vagrant -c "createdb $PROJECT_NAME"
|
||||
|
||||
|
||||
# Virtualenv setup for project
|
||||
su - vagrant -c "pyvenv $VIRTUALENV_DIR"
|
||||
# Replace previous line with this if you are using Python 2
|
||||
# su - vagrant -c "/usr/local/bin/virtualenv $VIRTUALENV_DIR"
|
||||
|
||||
su - vagrant -c "echo $PROJECT_DIR > $VIRTUALENV_DIR/.project"
|
||||
|
||||
#Update pip
|
||||
su - vagrant -c "$PIP install -U pip"
|
||||
|
||||
# Install PIP requirements
|
||||
su - vagrant -c "$PIP install -r $PROJECT_DIR/requirements.txt -f /home/vagrant/wheelhouse"
|
||||
|
||||
|
||||
# Set execute permissions on manage.py as they get lost if we build from a zip file
|
||||
chmod a+x $PROJECT_DIR/manage.py
|
||||
|
||||
|
||||
# Run migrate/update_index/load_initial_data
|
||||
su - vagrant -c "$PYTHON $PROJECT_DIR/manage.py migrate --noinput && \
|
||||
$PYTHON $PROJECT_DIR/manage.py load_initial_data && \
|
||||
$PYTHON $PROJECT_DIR/manage.py update_index"
|
||||
|
||||
|
||||
# Add a couple of aliases to manage.py into .bashrc
|
||||
cat << EOF >> /home/vagrant/.bashrc
|
||||
export PYTHONPATH=$PROJECT_DIR
|
||||
export DJANGO_SETTINGS_MODULE=$PROJECT_NAME.settings.dev
|
||||
|
||||
alias dj="django-admin"
|
||||
alias djrun="dj runserver 0.0.0.0:8000"
|
||||
|
||||
source $VIRTUALENV_DIR/bin/activate
|
||||
export PS1="[$PROJECT_NAME \W]\\$ "
|
||||
cd $PROJECT_DIR
|
||||
EOF
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
from whitenoise.django import DjangoWhiteNoise
|
||||
|
||||
from .wsgi import application as _application
|
||||
|
||||
|
||||
application = DjangoWhiteNoise(_application)
|
||||
|
|
@ -1 +0,0 @@
|
|||
from .dev import *
|
||||
|
|
@ -1,340 +0,0 @@
|
|||
# Django settings for wagtaildemo project.
|
||||
|
||||
import os
|
||||
|
||||
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..', '..')
|
||||
BASE_DIR = PROJECT_ROOT
|
||||
|
||||
DEBUG = True
|
||||
|
||||
ADMINS = (
|
||||
# ('Your Name', 'your_email@example.com'),
|
||||
)
|
||||
|
||||
# Default to dummy email backend. Configure dev/production/local backend
|
||||
# as per https://docs.djangoproject.com/en/dev/topics/email/#email-backends
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'wagtaildemo',
|
||||
}
|
||||
}
|
||||
|
||||
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
||||
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# On Unix systems, a value of None will cause Django to use the same
|
||||
# timezone as the operating system.
|
||||
# If running in a Windows environment this must be set to the same as your
|
||||
# system time zone.
|
||||
TIME_ZONE = 'Europe/London'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en-gb'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale.
|
||||
USE_L10N = True
|
||||
|
||||
# If you set this to False, Django will not use timezone-aware datetimes.
|
||||
USE_TZ = True
|
||||
|
||||
DATE_FORMAT = 'j F Y'
|
||||
|
||||
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||
# Example: "/home/media/media.lawrence.com/media/"
|
||||
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
# Absolute path to the directory static files should be collected to.
|
||||
# Don't put anything in this directory yourself; store your static files
|
||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||
# Example: "/home/media/media.lawrence.com/static/"
|
||||
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
|
||||
|
||||
# URL prefix for static files.
|
||||
# Example: "http://media.lawrence.com/static/"
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
'compressor.finders.CompressorFinder',
|
||||
)
|
||||
|
||||
# ** You would never normally put the SECRET_KEY in a public repository,
|
||||
# ** however this is a demo app so we're using the default settings.
|
||||
# ** Don't use this key in any non-demo usage!
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = 'wq21wtjo3@d_qfjvd-#td!%7gfy2updj2z+nev^k$iy%=m4_tr'
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'wagtaildemo.urls'
|
||||
|
||||
# Python dotted path to the WSGI application used by Django's runserver.
|
||||
WSGI_APPLICATION = 'wagtaildemo.wsgi.application'
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
# 'django.contrib.sites', # Wagtail uses its own site management logic
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
'compressor',
|
||||
'taggit',
|
||||
'modelcluster',
|
||||
'rest_framework',
|
||||
'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtaildocs',
|
||||
'wagtail.wagtailsnippets',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.contrib.wagtailapi',
|
||||
|
||||
'demo',
|
||||
|
||||
# Third party apps used in the project
|
||||
# 'south', # Database migration app
|
||||
# 'tinymce', # TinyMCE
|
||||
'easy_thumbnails', # Thumbnailer
|
||||
'registration', # Auth views and registration app
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# **************************** Fobi core ********************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
'fobi',
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# ************************* Fobi form elements **************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
|
||||
# ***********************************************************************
|
||||
# **************************** Form fields ******************************
|
||||
# ***********************************************************************
|
||||
# 'fobi.contrib.plugins.form_elements.fields.birthday',
|
||||
'fobi.contrib.plugins.form_elements.fields.boolean',
|
||||
'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple',
|
||||
'fobi.contrib.plugins.form_elements.fields.date',
|
||||
'fobi.contrib.plugins.form_elements.fields.date_drop_down',
|
||||
'fobi.contrib.plugins.form_elements.fields.datetime',
|
||||
'fobi.contrib.plugins.form_elements.fields.decimal',
|
||||
'fobi.contrib.plugins.form_elements.fields.email',
|
||||
'fobi.contrib.plugins.form_elements.fields.file',
|
||||
'fobi.contrib.plugins.form_elements.fields.float',
|
||||
'fobi.contrib.plugins.form_elements.fields.hidden',
|
||||
# 'fobi.contrib.plugins.form_elements.fields.hidden_model_object',
|
||||
'fobi.contrib.plugins.form_elements.fields.input',
|
||||
'fobi.contrib.plugins.form_elements.fields.integer',
|
||||
'fobi.contrib.plugins.form_elements.fields.ip_address',
|
||||
'fobi.contrib.plugins.form_elements.fields.null_boolean',
|
||||
'fobi.contrib.plugins.form_elements.fields.password',
|
||||
'fobi.contrib.plugins.form_elements.fields.radio',
|
||||
'fobi.contrib.plugins.form_elements.fields.range_select',
|
||||
'fobi.contrib.plugins.form_elements.fields.regex',
|
||||
'fobi.contrib.plugins.form_elements.fields.select',
|
||||
'fobi.contrib.plugins.form_elements.fields.select_model_object',
|
||||
'fobi.contrib.plugins.form_elements.fields.select_multiple',
|
||||
'fobi.contrib.plugins.form_elements.fields.select_multiple_with_max',
|
||||
'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
|
||||
'fobi.contrib.plugins.form_elements.fields.slider',
|
||||
'fobi.contrib.plugins.form_elements.fields.slug',
|
||||
'fobi.contrib.plugins.form_elements.fields.text',
|
||||
'fobi.contrib.plugins.form_elements.fields.textarea',
|
||||
'fobi.contrib.plugins.form_elements.fields.time',
|
||||
'fobi.contrib.plugins.form_elements.fields.url',
|
||||
|
||||
# ***********************************************************************
|
||||
# ************************ Security elements ****************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.plugins.form_elements.security.honeypot',
|
||||
|
||||
# ***********************************************************************
|
||||
# ************************* Testing elements ****************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.plugins.form_elements.test.dummy',
|
||||
|
||||
# ***********************************************************************
|
||||
# ************************* Content elements ****************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.plugins.form_elements.content.content_image',
|
||||
'fobi.contrib.plugins.form_elements.content.content_text',
|
||||
'fobi.contrib.plugins.form_elements.content.content_video',
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# ************************* Fobi form handlers **************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.plugins.form_handlers.db_store',
|
||||
'fobi.contrib.plugins.form_handlers.http_repost',
|
||||
'fobi.contrib.plugins.form_handlers.mail',
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# ************************* Fobi form importers *************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.plugins.form_importers.mailchimp_importer',
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# ************************** Fobi themes ********************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
|
||||
# ***********************************************************************
|
||||
# ************************ Bootstrap 3 theme ****************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.themes.bootstrap3', # Bootstrap 3 theme
|
||||
# DateTime widget
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.'
|
||||
'datetime_bootstrap3_widget',
|
||||
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.'
|
||||
'date_bootstrap3_widget',
|
||||
|
||||
# SliderPercentage widget
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.'
|
||||
'slider_bootstrap3_widget',
|
||||
|
||||
# ***********************************************************************
|
||||
# ************************ Foundation 5 theme ***************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.themes.foundation5', # Foundation 5 theme
|
||||
|
||||
'fobi.contrib.themes.foundation5.widgets.form_handlers.'
|
||||
'db_store_foundation5_widget',
|
||||
|
||||
# ***********************************************************************
|
||||
# **************************** Simple theme *****************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.themes.simple', # Simple theme
|
||||
)
|
||||
|
||||
# Add wagtail.contrib.wagtailsearchpromotions to INSTALLED_APPS
|
||||
# if we're on Wagtail 1.1 or later.
|
||||
# NB this is a quick-and-dirty version check that won't work with
|
||||
# full generality (double-digit versions, alpha/beta releases)
|
||||
from wagtail.wagtailcore import __version__
|
||||
if __version__.split('.') > ['1', '0']:
|
||||
INSTALLED_APPS = list(INSTALLED_APPS) + ['wagtail.contrib.wagtailsearchpromotions']
|
||||
|
||||
|
||||
EMAIL_SUBJECT_PREFIX = '[wagtaildemo] '
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1', '10.0.2.2')
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.static',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
"fobi.context_processors.theme", # Important!
|
||||
"fobi.context_processors.dynamic_values", # Optional
|
||||
"context_processors.testing", # Testing
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
# django-compressor settings
|
||||
COMPRESS_PRECOMPILERS = (
|
||||
('text/x-scss', 'django_libsass.SassCompiler'),
|
||||
)
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'filters': {
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# WAGTAIL SETTINGS
|
||||
|
||||
WAGTAIL_SITE_NAME = 'wagtaildemo'
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
from .base import *
|
||||
|
||||
DEBUG = True
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
# BASE_URL required for notification emails
|
||||
BASE_URL = 'http://localhost:8000'
|
||||
|
||||
try:
|
||||
from .local import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import dj_database_url
|
||||
import os
|
||||
|
||||
from .base import *
|
||||
|
||||
|
||||
DEBUG = True
|
||||
|
||||
# Accept all hostnames, since we don't know in advance which hostname will be used for any given Heroku instance.
|
||||
# IMPORTANT: Set this to a real hostname when using this in production!
|
||||
# See https://docs.djangoproject.com/en/1.10/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
# BASE_URL required for notification emails
|
||||
BASE_URL = 'http://localhost:8000'
|
||||
|
||||
DATABASES = {'default': dj_database_url.config(default='postgres://postgres@localhost:5432/wagtaildemo')}
|
||||
|
||||
|
||||
try:
|
||||
from .local import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
# If local.py is present, any settings in it will override those in base.py and dev.py.
|
||||
# Use this for any settings that are specific to this one installation, such as developer API keys.
|
||||
# local.py should not be checked in to version control.
|
||||
|
||||
EMBEDLY_KEY = 'get-one-from-http://embed.ly/'
|
||||
# GOOGLE_MAPS_KEY = 'get-one-from-https://code.google.com/apis/console/?noredirect'
|
||||
|
||||
# It is strongly recommended that you define a SECRET_KEY here, where it won't be visible
|
||||
# in your version control system.
|
||||
SECRET_KEY = 'enter-a-long-unguessable-string-here'
|
||||
|
||||
|
||||
# When developing Wagtail templates, we recommend django-debug-toolbar
|
||||
# for keeping track of page rendering times. To use it:
|
||||
# pip install django-debug-toolbar
|
||||
# uncomment the lines below, and uncomment the corresponding lines in urls.py
|
||||
|
||||
# from .base import INSTALLED_APPS, MIDDLEWARE_CLASSES
|
||||
# INSTALLED_APPS += (
|
||||
# 'debug_toolbar',
|
||||
# )
|
||||
# MIDDLEWARE_CLASSES = [
|
||||
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
# ] + list(MIDDLEWARE_CLASSES)
|
||||
# # django-debug-toolbar settings
|
||||
# DEBUG_TOOLBAR_CONFIG = {
|
||||
# 'INTERCEPT_REDIRECTS': False,
|
||||
# }
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
from .base import *
|
||||
|
||||
DEBUG = False
|
||||
|
||||
|
||||
WAGTAILSEARCH_BACKENDS = {
|
||||
'default': {
|
||||
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
|
||||
'INDEX': 'wagtaildemo'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'redis_cache.cache.RedisCache',
|
||||
'LOCATION': '127.0.0.1:6379',
|
||||
'KEY_PREFIX': 'wagtaildemo',
|
||||
'OPTIONS': {
|
||||
'CLIENT_CLASS': 'redis_cache.client.DefaultClient',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Use the cached template loader
|
||||
TEMPLATE_LOADERS = (
|
||||
('django.template.loaders.cached.Loader', (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)),
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
from .local import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
|
||||
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailcore import urls as wagtail_urls
|
||||
from wagtail.contrib.wagtailapi import urls as wagtailapi_urls
|
||||
from wagtail.api.v2.router import WagtailAPIRouter
|
||||
from wagtail.api.v2.endpoints import PagesAPIEndpoint
|
||||
from wagtail.wagtaildocs.api.v2.endpoints import DocumentsAPIEndpoint
|
||||
from wagtail.wagtailimages.api.v2.endpoints import ImagesAPIEndpoint
|
||||
|
||||
from demo import views
|
||||
|
||||
|
||||
api = WagtailAPIRouter('api')
|
||||
api.register_endpoint('pages', PagesAPIEndpoint)
|
||||
api.register_endpoint('images', ImagesAPIEndpoint)
|
||||
api.register_endpoint('documents', DocumentsAPIEndpoint)
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^django-admin/', include(admin.site.urls)),
|
||||
|
||||
url(r'^admin/', include(wagtailadmin_urls)),
|
||||
url(r'^documents/', include(wagtaildocs_urls)),
|
||||
|
||||
url(r'search/$', views.search, name='search'),
|
||||
url(r'^api/', include(wagtailapi_urls)),
|
||||
url(r'^api/v2/', include(api.urls)),
|
||||
]
|
||||
|
||||
|
||||
if settings.DEBUG:
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.views.generic.base import RedirectView
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns += [
|
||||
url(r'^favicon\.ico$', RedirectView.as_view(url=settings.STATIC_URL + 'demo/images/favicon.ico'))
|
||||
]
|
||||
|
||||
# Uncomment the lines below to enable django-debug-toolbar (along with the
|
||||
# corresponding lines in settings/local.py):
|
||||
#import debug_toolbar
|
||||
|
||||
#urlpatterns += [
|
||||
# url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
#]
|
||||
|
||||
|
||||
# For anything not caught by a more specific rule above, hand over to
|
||||
# Wagtail's serving mechanism (must come last)
|
||||
urlpatterns += [
|
||||
url(r'', include(wagtail_urls)),
|
||||
]
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
"""
|
||||
WSGI config for wagtaildemo project.
|
||||
|
||||
This module contains the WSGI application used by Django's development server
|
||||
and any production WSGI deployments. It should expose a module-level variable
|
||||
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
|
||||
this application via the ``WSGI_APPLICATION`` setting.
|
||||
|
||||
Usually you will have the standard Django WSGI application here, but it also
|
||||
might make sense to replace the whole Django WSGI application with a custom one
|
||||
that later delegates to the Django one. For example, you could introduce WSGI
|
||||
middleware here, or combine a Django application with an application of another
|
||||
framework.
|
||||
|
||||
"""
|
||||
import os
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wagtaildemo.settings")
|
||||
|
||||
# This application object is used by any WSGI server configured to use this
|
||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
||||
# setting points here.
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
application = get_wsgi_application()
|
||||
|
||||
# Apply WSGI middleware here.
|
||||
# from helloworld.wsgi import HelloWorldApplication
|
||||
# application = HelloWorldApplication(application)
|
||||