From 7ab7723b9a06977ff1a526b9cd6d6ed54ca83ab6 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson <frjo@xdeb.org> Date: Thu, 30 Aug 2018 09:49:55 +0200 Subject: [PATCH] The address field is required in all application forms. --- opentech/apply/funds/management/commands/migration_base.py | 4 ++-- .../management/commands/seed_community_lab_application.py | 1 + opentech/apply/funds/management/commands/seed_fellowship.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/opentech/apply/funds/management/commands/migration_base.py b/opentech/apply/funds/management/commands/migration_base.py index e19e97e22..75cbf0f97 100644 --- a/opentech/apply/funds/management/commands/migration_base.py +++ b/opentech/apply/funds/management/commands/migration_base.py @@ -97,7 +97,7 @@ class MigrateCommand(BaseCommand): except TypeError: pass - if "value" not in form_data: + if "value" not in form_data or not form_data["value"]: form_data["value"] = 0 if "duration" not in form_data or not form_data["duration"]: @@ -109,7 +109,7 @@ class MigrateCommand(BaseCommand): else: form_data["email"] = f"user+{node['uid']}@exeample.com" - if "address" not in form_data: + if "address" not in form_data or not form_data["address"]: form_data["address"] = json.dumps({"country": "GB", "thoroughfare": "This is not a real address!", "premise": "", "localityname": "London", "administrativearea": "", "postalcode": "123"}) submission.form_data = form_data diff --git a/opentech/apply/funds/management/commands/seed_community_lab_application.py b/opentech/apply/funds/management/commands/seed_community_lab_application.py index e2b2fdebc..d61957552 100644 --- a/opentech/apply/funds/management/commands/seed_community_lab_application.py +++ b/opentech/apply/funds/management/commands/seed_community_lab_application.py @@ -28,6 +28,7 @@ class Command(BaseCommand): {"type": "title", "value": {"field_label": "What is your event name?", "help_text": "", "info": None}, "id": "690e7839-eedb-4c24-a438-91d09da88774"}, {"type": "full_name", "value": {"field_label": "Your name", "help_text": "", "info": None}, "id": "4926d94b-7e57-494a-a2e2-2331a8ee04a2"}, {"type": "email", "value": {"field_label": "E-mail", "help_text": "", "info": None}, "id": "f0b90755-dc11-4de7-89aa-7611bf698455"}, + {"type": "address", "value": {"field_label": "Address", "help_text": "", "info": None}, "id": "64a2f72a-9e3b-4b97-b69a-d0b9dbdd1cc7"}, {"type": "date", "value": {"field_label": "Date of event", "help_text": "", "required": "", "default_value": ""}, "id": "d3364b5b-976b-4cd6-85d5-4ccc0bb9b560"}, {"type": "value", "value": {"field_label": "Amount requested", "help_text": "", "info": None}, "id": "eadbd266-c825-45ea-8de9-deaa2aaa677b"}, {"type": "duration", "value": {"field_label": "Duration", "help_text": "", "info": None}, "id": "9af05779-8547-4a85-8f1c-3505d5778e94"}, diff --git a/opentech/apply/funds/management/commands/seed_fellowship.py b/opentech/apply/funds/management/commands/seed_fellowship.py index 612cae7bb..ede4f1dac 100644 --- a/opentech/apply/funds/management/commands/seed_fellowship.py +++ b/opentech/apply/funds/management/commands/seed_fellowship.py @@ -49,6 +49,7 @@ class Command(BaseCommand): {"type": "title", "value": {"field_label": "What is your project name?", "help_text": "", "info": None}, "id": "32c37ee8-7d5b-4fc0-b606-9697a1c7e5c2"}, {"type": "full_name", "value": {"field_label": "Your name", "help_text": "", "info": None}, "id": "3b051ef2-3c75-4a70-aae3-999d58852810"}, {"type": "email", "value": {"field_label": "E-mail", "help_text": "", "info": None}, "id": "bfc488d3-b77d-427d-825d-9000797e9576"}, + {"type": "address", "value": {"field_label": "Address", "help_text": "", "info": None}, "id": "2c0db01a-b5ab-4882-aad8-8c9a2ec05e8f"}, {"type": "value", "value": {"field_label": "If you are applying for direct funding, how much do you need?", "help_text": "Amount requested should be less than 50000 USD.", "info": None}, "id": "cfae89dc-f327-45f4-80e9-f267c3bd1ec7"}, {"type": "char", "value": {"field_label": "What is your current or most recent position and employer or research institution?", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "1282223d-77f5-4047-be03-4df4c4b2148a"}, {"type": "rich_text", "value": {"field_label": "What are (or were) your roles and responsibilities there?", "help_text": "", "required": "", "default_value": ""}, "id": "9c0256e4-42e1-41fe-9880-7f621d6c3458"}, @@ -96,6 +97,7 @@ class Command(BaseCommand): {"type": "title", "value": {"field_label": "Proposal title", "help_text": "", "info": None}, "id": ""}, {"type": "full_name", "value": {"field_label": "Your name", "help_text": "", "info": None}, "id": "c0c75948-b3c3-42be-8646-bc2a5d8521c3"}, {"type": "email", "value": {"field_label": "E-mail", "help_text": "", "info": None}, "id": "a607ec56-da2a-46d4-b0c9-7c8f3c351a6e"}, + {"type": "address", "value": {"field_label": "Address", "help_text": "", "info": None}, "id": "8d3cf1ac-928f-4ee2-ad12-2e5fb16b4748"}, {"type": "value", "value": {"field_label": "If you are applying for direct funding, how much do you need?", "help_text": "Amount requested should be less than 50000 USD.", "info": None}, "id": "cfae89dc-f327-45f4-80e9-f267c3bd1ec7"}, {"type": "duration", "value": {"field_label": "How long do you want to work on this fellowship?", "help_text": "", "info": None}, "id": "08b9b5c3-e01d-41ac-95be-600a4fee7d87"}, {"type": "char", "value": {"field_label": "Host organisation", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "bc03235e-3c78-4770-9fc2-97feb93c2c8c"}, -- GitLab