Skip to content
Snippets Groups Projects
Commit 983a29d8 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add icons and related pages to labs

parent 196b603e
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-12 15:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
('public_funds', '0002_labindex_labpage'),
]
operations = [
migrations.AddField(
model_name='labpage',
name='icon',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='images.CustomImage'),
),
migrations.CreateModel(
name='LabPageRelatedPage',
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)),
('page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.Page')),
('source_page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_pages', to='public_funds.LabPage')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
]
......@@ -3,15 +3,21 @@ from django.core.exceptions import ValidationError
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
PageChooserPanel,
StreamFieldPanel,
)
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from opentech.public.utils.models import BasePage
from opentech.public.utils.models import (
BasePage,
RelatedPage,
)
from .blocks import FundBlock
......@@ -59,6 +65,10 @@ class FundIndex(BasePage):
return context
class LabPageRelatedPage(RelatedPage):
source_page = ParentalKey('LabPage', related_name='related_pages')
class LabPage(BasePage):
subpage_types = []
parent_page_types = ['LabIndex']
......@@ -83,7 +93,7 @@ class LabPage(BasePage):
body = StreamField(FundBlock())
content_panels = BasePage.content_panels + [
FieldPanel('icon'),
ImageChooserPanel('icon'),
FieldPanel('introduction'),
MultiFieldPanel([
# Limit to lab pages once created
......@@ -92,6 +102,7 @@ class LabPage(BasePage):
FieldPanel('link_text'),
], heading='Link for lab application'),
StreamFieldPanel('body'),
InlinePanel('related_pages', label="Related pages"),
]
@property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment