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

Add funding to the person model

parent d982cc0a
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-10 16:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),
('people', '0003_update_contact_information'),
]
operations = [
migrations.CreateModel(
name='Funding',
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)),
('value', models.PositiveIntegerField()),
('year', models.PositiveIntegerField()),
('duration', models.PositiveIntegerField(help_text='In months')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='funding', to='people.PersonPage')),
('source', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='wagtailcore.Page')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
]
......@@ -13,6 +13,7 @@ from wagtail.wagtailadmin.edit_handlers import (
FieldRowPanel,
InlinePanel,
MultiFieldPanel,
PageChooserPanel,
StreamFieldPanel
)
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
......@@ -71,6 +72,29 @@ class PersonPagePersonType(models.Model):
return self.person_type.title
class Funding(Orderable):
page = ParentalKey('PersonPage', related_name='funding')
value = models.PositiveIntegerField()
year = models.PositiveIntegerField()
duration = models.PositiveIntegerField(help_text='In months')
source = models.ForeignKey(
'wagtailcore.Page',
blank=True,
null=True,
on_delete=models.SET_NULL
)
panels = [
FieldRowPanel([
FieldPanel('year'),
FieldPanel('value'),
FieldPanel('duration'),
]),
# This is stubbed as we need to be able to select from multiple
PageChooserPanel('source'),
]
class PersonContactInfomation(Orderable):
methods = (
('irc', 'IRC'),
......@@ -144,7 +168,8 @@ class PersonPage(BasePage):
], heading='Contact information'),
InlinePanel('person_types', label='Person types'),
FieldPanel('introduction'),
StreamFieldPanel('biography')
StreamFieldPanel('biography'),
InlinePanel('funding', label='Funding'),
]
......
......@@ -23,7 +23,7 @@ class LinkFields(models.Model):
"""
link_page = models.ForeignKey(
'wagtailcore.Page',
'wagtailcore.FieldPanelPage',
blank=True,
null=True,
on_delete=models.SET_NULL
......
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