From 53b101ec091b287e8df9b1146740c74f5a6c4530 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Fri, 31 Aug 2018 20:40:34 +0100 Subject: [PATCH] Add missing introduction to person index --- .../0012_personindexpage_introduction.py | 18 ++++++++++++++++++ opentech/public/people/models.py | 10 ++++++++++ .../templates/people/person_index_page.html | 4 ++++ 3 files changed, 32 insertions(+) create mode 100644 opentech/public/people/migrations/0012_personindexpage_introduction.py diff --git a/opentech/public/people/migrations/0012_personindexpage_introduction.py b/opentech/public/people/migrations/0012_personindexpage_introduction.py new file mode 100644 index 000000000..1a4b6015c --- /dev/null +++ b/opentech/public/people/migrations/0012_personindexpage_introduction.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.2 on 2018-08-31 19:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('people', '0011_change_the_contact_keys'), + ] + + operations = [ + migrations.AddField( + model_name='personindexpage', + name='introduction', + field=models.TextField(blank=True), + ), + ] diff --git a/opentech/public/people/models.py b/opentech/public/people/models.py index 27fae2502..7a85671d4 100644 --- a/opentech/public/people/models.py +++ b/opentech/public/people/models.py @@ -184,6 +184,16 @@ class PersonIndexPage(BasePage): subpage_types = ['PersonPage'] parent_page_types = ['standardpages.IndexPage'] + introduction = models.TextField(blank=True) + + content_panels = BasePage.content_panels + [ + FieldPanel('introduction'), + ] + + search_fields = BasePage.search_fields + [ + index.SearchField('introduction'), + ] + def get_context(self, request, *args, **kwargs): people = PersonPage.objects.live().public().descendant_of(self).order_by( 'title', diff --git a/opentech/public/people/templates/people/person_index_page.html b/opentech/public/people/templates/people/person_index_page.html index 9713a67b4..87101a091 100644 --- a/opentech/public/people/templates/people/person_index_page.html +++ b/opentech/public/people/templates/people/person_index_page.html @@ -3,6 +3,10 @@ {% block body_class %}light-grey-bg{% endblock %} {% block content %} <div class="wrapper wrapper--small wrapper--inner-space-medium"> + {% if page.introduction %} + <h4 class="heading heading--listings-introduction">{{ page.introduction }}</h4> + {% endif %} + <form class="form" method="GET"> <div class="form__group form__group--checkbox"> <div class="form__select form__select--narrow form__select--inline"> -- GitLab