From 4147dc7d323c6659b1b529cc97c401cbdc6ad834 Mon Sep 17 00:00:00 2001 From: Anna Sidwell Date: Sat, 31 Mar 2018 16:29:25 +1100 Subject: [PATCH] Add contact fields. Closes #30. --- apps/map/forms.py | 16 +++++++- apps/map/migrations/0044_auto_20180331.py | 46 +++++++++++++++++++++++ apps/map/models.py | 28 ++++++++++++++ requirements.txt | 4 +- 4 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 apps/map/migrations/0044_auto_20180331.py diff --git a/apps/map/forms.py b/apps/map/forms.py index fbda5b0..765601e 100644 --- a/apps/map/forms.py +++ b/apps/map/forms.py @@ -177,8 +177,7 @@ class LongCaseStudyForm(BaseCaseStudyForm): 'wants_conversation_with_ojuso', css_id="negative_case_questions" ), - Fieldset( - _("Common Questions"), + Div( 'key_actors_involved', css_id="common_questions" ), @@ -187,6 +186,19 @@ class LongCaseStudyForm(BaseCaseStudyForm): HTML(""+_("Next")+"") ) ), + Tab( + _("Contact details"), + 'contact_email', + 'contact_phone', + 'contact_website', + PrependedText('contact_twitter', '@', placeholder='username'), + 'contact_facebook', + 'contact_other', + FormActions( + HTML(""+_("Previous")+""), + HTML(""+_("Next")+"") + ) + ), Tab( _("Uploads"), 'official_project_documents', diff --git a/apps/map/migrations/0044_auto_20180331.py b/apps/map/migrations/0044_auto_20180331.py new file mode 100644 index 0000000..4c1d9ad --- /dev/null +++ b/apps/map/migrations/0044_auto_20180331.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2018-03-31 04:59 +from __future__ import unicode_literals + +from django.db import migrations, models +import phonenumber_field.modelfields + + +class Migration(migrations.Migration): + + dependencies = [ + ('map', '0043_auto_20180329_1044'), + ] + + operations = [ + migrations.AddField( + model_name='casestudy', + name='contact_email', + field=models.EmailField(blank=True, max_length=254, verbose_name='Email address'), + ), + migrations.AddField( + model_name='casestudy', + name='contact_facebook', + field=models.URLField(blank=True, verbose_name='Facebook page'), + ), + migrations.AddField( + model_name='casestudy', + name='contact_other', + field=models.TextField(blank=True, verbose_name='Other contact details'), + ), + migrations.AddField( + model_name='casestudy', + name='contact_phone', + field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, verbose_name='Phone number'), + ), + migrations.AddField( + model_name='casestudy', + name='contact_twitter', + field=models.CharField(blank=True, max_length=50, verbose_name='Twitter username'), + ), + migrations.AddField( + model_name='casestudy', + name='contact_website', + field=models.URLField(blank=True, verbose_name='Website'), + ), + ] diff --git a/apps/map/models.py b/apps/map/models.py index bcf70c6..028326e 100644 --- a/apps/map/models.py +++ b/apps/map/models.py @@ -7,6 +7,8 @@ from django_countries.fields import CountryField from django.utils.translation import ugettext as _ from django.template.defaultfilters import slugify from multiselectfield import MultiSelectField +from phonenumber_field.modelfields import PhoneNumberField + from . import validators @@ -815,16 +817,42 @@ class CaseStudy(models.Model): ) # 3.1.7.1 + 3.2.8.1 + contact_email = models.EmailField( + verbose_name=_('Email address'), + blank=True + ) # 3.1.7.2 + 3.2.8.1 + contact_phone = PhoneNumberField( + verbose_name=_('Phone number'), + help_text=_('Please include the international prefix, beginning with "+".'), + blank=True + ) # 3.1.7.3 + 3.2.8.1 + contact_website = models.URLField( + verbose_name=_('Website'), + blank=True + ) # 3.1.7.4 + 3.2.8.1 + contact_twitter = models.CharField( + verbose_name=_('Twitter username'), + max_length=50, + blank=True + ) # 3.1.7.5 + 3.2.8.1 + contact_facebook = models.URLField( + verbose_name=_('Facebook page'), + blank=True + ) # 3.1.7.6 + 3.2.8.1 + contact_other = models.TextField( + verbose_name=_('Other contact details'), + blank=True + ) # 3.2.1 negative_case_reasons = MultiSelectField( diff --git a/requirements.txt b/requirements.txt index 123a96a..ef609ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,10 +14,10 @@ django-crispy-forms==1.6.1 django-envelope==1.3 django-extensions==1.7.9 django-geojson==2.10.0 -#django-leaflet==0.22.0 --e git://github.com/makinacorpus/django-leaflet.git@a43acc5fed6674b413a6fab0feeb7c44e67c2ca8#egg=django-leaflet +django-leaflet==0.23.0 django-multiselectfield==0.1.8 django-multiupload==0.5.2 +django-phonenumber-field==2.0.0 django-registration-redux==1.6 django-storages==1.6.5 djangorestframework==3.6.3