Commit 112db6e9 authored by chris's avatar chris

unsorted commit, tbr

parent 3a01e541
......@@ -6,3 +6,4 @@ media
local_settings.py
docs/_build
.ropeproject
ext
from django.contrib import admin
# Register your models here.
from __future__ import unicode_literals
from django.apps import AppConfig
class FlyerstyleConfig(AppConfig):
name = 'flyerstyle'
from __future__ import unicode_literals
from django.db import models
# Create your models here.
This diff is collapsed.
{% extends "base.html" %}
{% block body_class %}template-404{% endblock %}
{% block content %}
<h1>Page not found</h1>
<h2>Sorry, this page could not be found.</h2>
{% endblock %}
<!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 charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Internal server error</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<h1>Internal server error</h1>
<h2>Sorry, there seems to be an error. Please try again soon.</h2>
</body>
</html>
{% load 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 charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
{% block title %}
{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}
{% endblock %}
{% block title_suffix %}
{% with self.get_site.site_name as site_name %}
{% if site_name %}- {{ site_name }}{% endif %}
{% endwith %}
{% endblock %}
</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{# Global stylesheets #}
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
{% block extra_css %}
{# Override this in templates to add extra stylesheets #}
{% endblock %}
</head>
<body class="{% block body_class %}{% endblock %}">
{% wagtailuserbar %}
<div class="wrap">
{% block content %}{% endblock %}
</div>
{# Global javascript #}
{% block extra_js %}
{# Override this in templates to add extra javascript #}
{% endblock %}
</body>
</html>
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
......@@ -32,6 +32,9 @@ DATABASES = {
}
INSTALLED_APPS = (
'ext.wagtail_simple_gallery',
'flyers.website',
'flyers.flystyle',
'flyers.content',
'flyers.general',
'wagtail.wagtailforms',
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0029_unicode_slugfield_dj19'),
]
operations = [
migrations.CreateModel(
name='WebPage',
fields=[
('page_ptr', models.OneToOneField(on_delete=models.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_webpage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
WebPage = apps.get_model('website.WebPage')
# Delete the default webpage
# If migration is run multiple times, it may have already been deleted
Page.objects.filter(id=2).delete()
# Create content type for webpage model
webpage_content_type, __ = ContentType.objects.get_or_create(
model='webpage', app_label='website')
# Create a new webpage
webpage = WebPage.objects.create(
title="Homepage",
slug='website',
content_type=webpage_content_type,
path='00010001',
depth=2,
numchild=0,
url_path='/',
)
# Create a site with the new webpage set as the root
Site.objects.create(
hostname='localhost', root_page=webpage, is_default_site=True)
def remove_webpage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
WebPage = apps.get_model('website.WebPage')
# Delete the default webpage
# Page and Site objects CASCADE
WebPage.objects.filter(slug='website', depth=2).delete()
# Delete content type for webpage model
ContentType.objects.filter(model='webpage', app_label='website').delete()
class Migration(migrations.Migration):
dependencies = [
('website', '0001_initial'),
]
operations = [
migrations.RunPython(create_webpage, remove_webpage),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-17 13:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('website', '0002_create_webpage'),
]
operations = [
migrations.CreateModel(
name='GalleryImage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('caption', models.CharField(blank=True, max_length=250)),
('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.Image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.AddField(
model_name='webpage',
name='body',
field=wagtail.wagtailcore.fields.RichTextField(blank=True, null=True),
),
migrations.AddField(
model_name='webpage',
name='date',
field=models.DateField(blank=True, null=True, verbose_name='Post date'),
),
migrations.AddField(
model_name='webpage',
name='feed_image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'),
),
migrations.AddField(
model_name='galleryimage',
name='page',
field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='gallery_images', to='website.WebPage'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-17 14:03
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('website', '0003_auto_20170217_1340'),
]
operations = [
migrations.AddField(
model_name='webpage',
name='intro',
field=wagtail.wagtailcore.fields.RichTextField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0029_unicode_slugfield_dj19'),
]
operations = [
migrations.CreateModel(
name='WebPage',
fields=[
('page_ptr', models.OneToOneField(on_delete=models.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_webpage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
WebPage = apps.get_model('website.WebPage')
# Delete the default webpage
# If migration is run multiple times, it may have already been deleted
Page.objects.filter(id=2).delete()
# Create content type for webpage model
webpage_content_type, __ = ContentType.objects.get_or_create(
model='webpage', app_label='website')
# Create a new webpage
webpage = WebPage.objects.create(
title="Homepage",
slug='website',
content_type=webpage_content_type,
path='00010001',
depth=2,
numchild=0,
url_path='/',
)
# Create a site with the new webpage set as the root
Site.objects.create(
hostname='localhost', root_page=webpage, is_default_site=True)
def remove_webpage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
WebPage = apps.get_model('website.WebPage')
# Delete the default webpage
# Page and Site objects CASCADE
WebPage.objects.filter(slug='website', depth=2).delete()
# Delete content type for webpage model
ContentType.objects.filter(model='webpage', app_label='website').delete()
class Migration(migrations.Migration):
dependencies = [
('website', '0001_initial'),
]
operations = [
migrations.RunPython(create_webpage, remove_webpage),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-03 08:46
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('website', '0002_create_webpage'),
]
operations = [
migrations.AddField(
model_name='webpage',
name='body',
field=wagtail.wagtailcore.fields.RichTextField(blank=True),
),
]
from __future__ import absolute_import, unicode_literals
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.models import Orderable
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailadmin.edit_handlers import InlinePanel
from wagtail.wagtailadmin.edit_handlers import MultiFieldPanel
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailsearch import index
from modelcluster.fields import ParentalKey
class WebPage(Page):
intro = RichTextField(null=True, blank=True)
body = RichTextField(null=True, blank=True)
date = models.DateField("Post date", null=True, blank=True)
feed_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
def get_context(self, request):
# Update context to include only published posts, ordered by
# reverse-chron
context = super(WebPage, self).get_context(request)
context['children'] = WebPage.objects.child_of(
self).live().order_by('-first_published_at')
gallery_item = self.gallery_images.first()
if gallery_item:
context['main_image'] = gallery_item.image
else:
context['main_image'] = None
return context
# Search index configuration
search_fields = Page.search_fields + [
index.SearchField('intro'),
index.SearchField('body'),
index.FilterField('date'),
]
# Editor panels configuration
content_panels = Page.content_panels + [
FieldPanel('intro'),
FieldPanel('body', classname="full"),
FieldPanel('date'),
# InlinePanel('related_links', label="Related links"),
InlinePanel('gallery_images', label="Gallery images"),
]
"""
promote_panels = [
MultiFieldPanel(Page.promote_panels, "Common page configuration"),
ImageChooserPanel('feed_image'),
]
"""
# Parent page / subpage type rules
#parent_page_types = ['website.WebPage']
# subpage_types = []
class GalleryImage(Orderable):
page = ParentalKey(WebPage, related_name='gallery_images')
image = models.ForeignKey(
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
)
caption = models.CharField(blank=True, max_length=250)
panels = [
ImageChooserPanel('image'),
FieldPanel('caption'),
]
{% extends "base.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% block body_class %}template-webpage{% endblock %}
{% block extra_css %}
<style TYPE="text/css">
.mainimage {
width: 150px;
height: 100px;
background-image: url("http://i.stack.imgur.com/2OrtT.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
}
</style>
{% endblock %}
{% block content %}
<h1>{{ page.title }}</h1>
<p class="meta">{{ page.date }}</p>
{% if main_image %}{% image main_image width-600 %}{% endif %}
<div class="intro">{{ page.intro }}</div>
{{ page.body|richtext }}
{% for item in page.gallery_images.all %}
<div style="float: left; margin: 10px">
{% image item.image fill-320x240 %}
<p>{{ item.caption }}</p>
</div>
{% endfor %}
<p><a href="{{ page.get_parent.url }}">Return to blog</a></p>
<p>You can access the admin interface <a href="{% url 'wagtailadmin_home' %}">here</a> (make sure you have run "./manage.py createsuperuser" in the console first).</p>
<p>If you haven't already given the documentation a read, head over to <a href="http://docs.wagtail.io/">http://docs.wagtail.io</a> to start building on Wagtail</p>
{% for post in children %}
{% with post=post.specific %}
<h2><a href="{% pageurl post %}">{{ post.title }}</a></h2>
<p>{{ post.intro }}</p>
{{ post.intro|richtext }}
{% endwith %}
{% endfor %}
{% endblock %}
......@@ -7,6 +7,12 @@ test -d venv || virtualenv venv/
# install required dependencies
./venv/bin/pip install -U -r requirements.txt
# use `source venv/bin/activate`
# Use `source venv/bin/activate`
# We do not use pip for the following apps because they require django/wagtail downgrades
test -d ext || mkdir ext
test -f ext/__init__.py || touch ext/__init__.py
test -d ext/wagtail-simple-gallery || (cd ext; git clone https://github.com/Temeez/wagtail-simple-gallery.git)
test -d ext/wagtail_simple_gallery || (cd ext; ln -s wagtail-simple-gallery/wagtail_simple_gallery .)
./venv/bin/python manage.py migrate --no-input
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment