From f03ea893c4b0c3b952d462fa6d68f07847b5b644 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Wed, 21 Feb 2018 09:48:25 +0000 Subject: [PATCH] Ensure that title is included in the tests and full_name works on create --- opentech/apply/funds/tests/factories/blocks.py | 6 ++++++ opentech/apply/users/models.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/opentech/apply/funds/tests/factories/blocks.py b/opentech/apply/funds/tests/factories/blocks.py index 262c641f6..3a45e2d5b 100644 --- a/opentech/apply/funds/tests/factories/blocks.py +++ b/opentech/apply/funds/tests/factories/blocks.py @@ -35,6 +35,11 @@ class RadioFieldBlockFactory(FormFieldBlockFactory): model = stream_blocks.RadioButtonsFieldBlock +class TitleBlockFactory(FormFieldBlockFactory): + class Meta: + model = blocks.TitleBlock + + class EmailBlockFactory(FormFieldBlockFactory): class Meta: model = blocks.EmailBlock @@ -51,6 +56,7 @@ class RichTextFieldBlockFactory(FormFieldBlockFactory): CustomFormFieldsFactory = wagtail_factories.StreamFieldFactory({ + 'title': TitleBlockFactory, 'email': EmailBlockFactory, 'full_name': FullNameBlockFactory, 'char': CharFieldBlockFactory, diff --git a/opentech/apply/users/models.py b/opentech/apply/users/models.py index 67307d675..26a0c2c35 100644 --- a/opentech/apply/users/models.py +++ b/opentech/apply/users/models.py @@ -6,8 +6,9 @@ from .utils import send_activation_email def convert_full_name_to_parts(defaults): - full_name = defaults.pop('full_name') + full_name = defaults.pop('full_name', ' ') if not full_name: + # full_name was None full_name = ' ' first_name, *last_name = full_name.split(' ') if first_name: -- GitLab