From 0fea450332b670b6ecc8b24a0b9b0340066ffcc1 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Date: Fri, 8 Sep 2023 13:39:55 +0530 Subject: [PATCH] Update code-style using 'pre-commit run --all-files' --- .github/release-drafter.yml | 64 +- .github/workflows/codeql-analysis.yml | 22 +- .github/workflows/deploy-docs.yml | 4 +- .github/workflows/hypha-ci.yml | 15 +- .jscsrc | 10 +- .stylelintrc.yaml | 14 +- .vscode/extensions.json | 4 +- .vscode/launch.json | 31 +- .vscode/settings.json | 18 +- addressfield/fields.py | 30 +- addressfield/static/address_form.js | 39 +- addressfield/static/addressfield.min.json | 5034 ++++++- .../widgets/nested_with_label.html | 6 +- addressfield/tests.py | 32 +- addressfield/widgets.py | 46 +- app.json | 7 +- docker/docker-compose.yaml | 2 +- docs/assets/extra.css | 2 +- .../apply/activity/adapters/activity_feed.py | 163 +- hypha/apply/activity/adapters/base.py | 99 +- .../activity/adapters/django_messages.py | 79 +- hypha/apply/activity/adapters/emails.py | 236 +- hypha/apply/activity/adapters/slack.py | 250 +- hypha/apply/activity/adapters/utils.py | 40 +- hypha/apply/activity/admin.py | 8 +- hypha/apply/activity/apps.py | 2 +- hypha/apply/activity/context_processors.py | 8 +- hypha/apply/activity/filters.py | 53 +- hypha/apply/activity/forms.py | 14 +- .../management/commands/migrate_comments.py | 32 +- .../commands/send_staff_email_digest.py | 40 +- hypha/apply/activity/messaging.py | 9 +- .../apply/activity/migrations/0001_initial.py | 40 +- .../activity/migrations/0002_activity_type.py | 13 +- .../migrations/0003_activity_visibility.py | 17 +- .../0004_update_on_delete_django2.py | 11 +- hypha/apply/activity/migrations/0005_event.py | 55 +- .../apply/activity/migrations/0006_message.py | 28 +- .../migrations/0007_message_status.py | 9 +- .../migrations/0008_message_external_id.py | 7 +- .../migrations/0009_add_private_option.py | 18 +- .../migrations/0011_add_new_event_type.py | 26 +- .../0012_add_generic_relation_to_activity.py | 20 +- .../0013_add_new_event_type_screening.py | 27 +- .../0014_add_batch_reviewer_message.py | 28 +- .../migrations/0015_add_batch_transition.py | 29 +- .../migrations/0016_add_batch_ready.py | 30 +- .../migrations/0017_add_review_opinion.py | 31 +- .../migrations/0018_add_batch_determine.py | 32 +- .../migrations/0019_partner_field_event.py | 33 +- .../migrations/0020_add_delete_event.py | 34 +- .../0021_add_review_delete_event.py | 35 +- .../0022_add_versioning_to_comments.py | 25 +- .../migrations/0023_notify_partners.py | 36 +- .../migrations/0024_add_review_edit_event.py | 37 +- .../migrations/0025_add_batch_lead_event.py | 38 +- .../0026_add_created_project_event.py | 39 +- .../0026_update_visibility_options.py | 29 +- .../0027_add_update_project_lead.py | 40 +- .../0027_update_visibility_options_2.py | 9 +- .../0028_add_new_generic_relation.py | 56 +- .../0028_migrate_messages_with_visibility.py | 17 +- .../0029_migrate_old_submission_relation.py | 25 +- .../migrations/0030_remove_old_relation.py | 7 +- .../0031_add_generic_fk_to_event.py | 31 +- ...032_migrate_submission_to_generic_event.py | 25 +- .../0033_remove_old_submission_fk_event.py | 7 +- .../migrations/0034_add_send_for_approval.py | 41 +- .../migrations/0035_add_approve_project.py | 42 +- .../migrations/0036_add_reject_project.py | 43 +- .../migrations/0037_add_upload_document.py | 44 +- .../migrations/0038_auto_20190808_1142.py | 44 +- .../migrations/0039_add_remove_document.py | 45 +- ...e_activity_update_and_generic_relations.py | 8 +- .../migrations/0041_add_upload_contract.py | 46 +- .../migrations/0042_add_approve_contract.py | 47 +- .../migrations/0043_add_request_payment.py | 48 +- .../0044_add_update_payment_request_status.py | 49 +- .../0045_add_delete_payment_request.py | 50 +- .../migrations/0046_add_sent_to_compliance.py | 51 +- .../0047_add_update_payment_request.py | 52 +- .../migrations/0048_add_project_transition.py | 53 +- .../migrations/0049_auto_20191112_1227.py | 7 +- .../migrations/0050_add_submit_report.py | 54 +- .../0051_add_report_skipping_activity.py | 55 +- .../0052_report_frequency_change.py | 56 +- .../0053_nullable_by_report_notify.py | 67 +- ...der_delete_reminder_and_review_reminder.py | 60 +- .../0055_add_batch_delete_submission.py | 61 +- .../migrations/0056_add_updated_vendor.py | 62 +- .../activity/migrations/0057_add_invoices.py | 63 +- .../migrations/0058_add_project_invoicing.py | 66 +- .../migrations/0059_rename_team_staff.py | 19 +- .../0060_contracting_name_update.py | 66 +- .../0061_payment_requests_cleanup.py | 62 +- ...0062_remove_payment_requests_activities.py | 8 +- .../migrations/0063_alter_event_type.py | 62 +- .../migrations/0064_alter_event_type.py | 63 +- .../migrations/0065_auto_20221006_1115.py | 70 +- .../migrations/0066_alter_event_type.py | 67 +- .../migrations/0067_add_draft_submission.py | 68 +- .../migrations/0068_add_archive_unarchive.py | 70 +- ..._alter_event_type_add_disable_reporting.py | 71 +- .../migrations/0070_alter_event_type.py | 72 +- .../migrations/0071_alter_event_type.py | 71 +- .../migrations/0072_alter_event_type.py | 72 +- .../migrations/0073_add_approve_invoice.py | 73 +- .../migrations/0074_alter_event_type.py | 74 +- .../0075_alter_activity_visibility.py | 19 +- hypha/apply/activity/models.py | 123 +- hypha/apply/activity/options.py | 128 +- hypha/apply/activity/services.py | 8 +- hypha/apply/activity/signals.py | 4 +- hypha/apply/activity/tasks.py | 27 +- .../activity/include/action_list.html | 2 +- .../activity/include/listing_base.html | 20 +- .../include/notifications_dropdown.html | 12 +- .../templates/activity/notifications.html | 98 +- .../messages/email/applicant_base.html | 6 +- .../messages/email/assign_paf_approvers.html | 10 +- .../templates/messages/email/base.html | 4 +- .../messages/email/batch_ready_to_review.html | 10 +- .../templates/messages/email/comment.html | 4 +- .../messages/email/contract_uploaded.html | 34 +- .../messages/email/determination.html | 4 +- .../messages/email/invited_to_proposal.html | 8 +- .../messages/email/invoice_approved.html | 10 +- .../email/invoice_status_updated.html | 20 +- .../messages/email/invoice_updated.html | 10 +- .../messages/email/paf_for_approval.html | 10 +- .../email/partners_update_applicant.html | 12 +- .../email/partners_update_partner.html | 6 +- .../email/project_final_approval.html | 10 +- .../email/project_request_change.html | 6 +- .../messages/email/ready_for_contracting.html | 12 +- .../messages/email/ready_for_invoicing.html | 6 +- .../messages/email/ready_to_review.html | 18 +- .../messages/email/report_frequency.html | 10 +- .../messages/email/report_notify.html | 6 +- .../messages/email/report_skipped.html | 12 +- .../messages/email/report_submitted.html | 8 +- .../messages/email/sent_to_compliance.html | 10 +- .../email/submission_confirmation.html | 16 +- .../messages/email/submission_edit.html | 2 +- .../email/submit_contract_documents.html | 8 +- .../templates/messages/email/transition.html | 2 +- .../messages/email/vendor_setup_needed.html | 10 +- .../messages/email/vendor_updated.html | 6 +- .../templates/messages/slack_message.html | 2 +- .../activity/templatetags/activity_tags.py | 8 +- hypha/apply/activity/tests/factories.py | 10 +- hypha/apply/activity/tests/test_messaging.py | 289 +- hypha/apply/activity/tests/test_tasks.py | 16 +- hypha/apply/activity/urls.py | 6 +- hypha/apply/activity/views.py | 22 +- hypha/apply/api/urls.py | 14 +- .../apply/api/v1/determination/permissions.py | 2 + .../apply/api/v1/determination/serializers.py | 18 +- hypha/apply/api/v1/determination/utils.py | 4 +- hypha/apply/api/v1/determination/views.py | 81 +- hypha/apply/api/v1/filters.py | 66 +- hypha/apply/api/v1/mixin.py | 12 +- hypha/apply/api/v1/pagination.py | 2 +- hypha/apply/api/v1/projects/serializers.py | 10 +- hypha/apply/api/v1/projects/views.py | 38 +- hypha/apply/api/v1/reminder/serializers.py | 15 +- hypha/apply/api/v1/reminder/views.py | 27 +- hypha/apply/api/v1/review/fields.py | 13 +- hypha/apply/api/v1/review/permissions.py | 43 +- hypha/apply/api/v1/review/serializers.py | 38 +- hypha/apply/api/v1/review/utils.py | 32 +- hypha/apply/api/v1/review/views.py | 114 +- hypha/apply/api/v1/screening/filters.py | 2 +- hypha/apply/api/v1/screening/serializers.py | 6 +- .../api/v1/screening/tests/test_views.py | 160 +- hypha/apply/api/v1/screening/views.py | 41 +- hypha/apply/api/v1/serializers.py | 259 +- hypha/apply/api/v1/stream_serializers.py | 74 +- hypha/apply/api/v1/tests/test_serializers.py | 38 +- hypha/apply/api/v1/tests/test_views.py | 72 +- hypha/apply/api/v1/urls.py | 58 +- hypha/apply/api/v1/utils.py | 86 +- hypha/apply/api/v1/views.py | 247 +- hypha/apply/categories/admin.py | 20 +- hypha/apply/categories/admin_helpers.py | 23 +- hypha/apply/categories/admin_views.py | 6 +- hypha/apply/categories/apps.py | 2 +- hypha/apply/categories/blocks.py | 36 +- hypha/apply/categories/categories_seed.py | 1868 +-- .../management/commands/seed_categories.py | 14 +- .../categories/migrations/0001_initial.py | 54 +- .../migrations/0002_metacategory.py | 39 +- ...03_rename_meta_categories_to_meta_terms.py | 60 +- ...04_rename_meta_categories_to_meta_terms.py | 7 +- .../0005_alter_is_archived_field_on_terms.py | 13 +- ...e_category_options_as_submission_filter.py | 11 +- hypha/apply/categories/models.py | 110 +- .../admin/includes/meta_term_list_header.html | 4 +- hypha/apply/categories/tests/factories.py | 6 +- hypha/apply/categories/tests/test_blocks.py | 20 +- hypha/apply/dashboard/apps.py | 2 +- .../static/js/django_select2-checkboxes.js | 66 +- .../static/js/select2.multi-checkboxes.js | 215 +- .../dashboard/applicant_dashboard.html | 112 +- .../dashboard/community_dashboard.html | 24 +- .../dashboard/contracting_dashboard.html | 28 +- .../templates/dashboard/dashboard.html | 168 +- .../dashboard/finance_dashboard.html | 58 +- .../includes/paf_waiting_for_approval.html | 24 +- .../includes/projects_in_contracting.html | 24 +- .../dashboard/partner_dashboard.html | 80 +- .../dashboard/reviewer_dashboard.html | 126 +- hypha/apply/dashboard/tests/test_views.py | 115 +- hypha/apply/dashboard/urls.py | 4 +- hypha/apply/dashboard/views.py | 671 +- hypha/apply/dashboard/wagtail_hooks.py | 8 +- hypha/apply/determinations/admin.py | 16 +- hypha/apply/determinations/admin_views.py | 2 - hypha/apply/determinations/apps.py | 2 +- hypha/apply/determinations/blocks.py | 40 +- hypha/apply/determinations/forms.py | 384 +- .../migrate_concept_determinations.py | 68 +- .../migrate_proposal_determinations.py | 73 +- .../determinations/migrations/0001_initial.py | 56 +- .../migrations/0002_add_fields.py | 49 +- .../0003_message_template_settings.py | 73 +- .../migrations/0004_change_labels.py | 49 +- .../0005_determination_drupal_id.py | 7 +- .../0006_allow_multiple_determinations.py | 13 +- .../0007_add_determinationformsettings.py | 260 +- .../migrations/0008_rename_more_info.py | 17 +- .../migrations/0009_add_send_notice_field.py | 11 +- ...10_add_determination_stream_field_forms.py | 719 +- .../migrations/0011_auto_20220111_1314.py | 15 +- .../migrations/0012_auto_20220509_1136.py | 63 +- .../migrations/0013_auto_20220722_0844.py | 685 +- ...ter_determination_formfield_send_notice.py | 679 +- ...alter_determinationformsettings_options.py | 7 +- .../0016_rename_section_text_field.py | 675 +- hypha/apply/determinations/models.py | 387 +- hypha/apply/determinations/options.py | 12 +- .../base_determination_form.html | 88 +- .../batch_determination_form.html | 56 +- .../batch_determination_confirmation.html | 12 +- .../templatetags/determination_tags.py | 4 +- hypha/apply/determinations/tests/factories.py | 41 +- .../determinations/tests/test_admin_views.py | 89 +- .../apply/determinations/tests/test_views.py | 421 +- hypha/apply/determinations/urls.py | 22 +- hypha/apply/determinations/utils.py | 9 +- hypha/apply/determinations/views.py | 289 +- hypha/apply/flags/migrations/0001_initial.py | 44 +- hypha/apply/flags/models.py | 12 +- hypha/apply/flags/templates/flags/flags.html | 2 +- hypha/apply/flags/urls.py | 8 +- hypha/apply/flags/views.py | 11 +- hypha/apply/funds/admin.py | 76 +- hypha/apply/funds/admin_forms.py | 62 +- hypha/apply/funds/admin_helpers.py | 66 +- hypha/apply/funds/admin_views.py | 68 +- hypha/apply/funds/apps.py | 2 +- hypha/apply/funds/blocks.py | 149 +- hypha/apply/funds/differ.py | 44 +- hypha/apply/funds/edit_handlers.py | 33 +- hypha/apply/funds/files.py | 19 +- hypha/apply/funds/forms.py | 305 +- .../commands/export_submissions_csv.py | 68 +- .../migrate_community_lab_applications.py | 1 - .../commands/migrate_fellowship_proposals.py | 2 - .../management/commands/migrate_proposals.py | 2 +- .../commands/migrate_rr_applications.py | 2 +- .../management/commands/migration_base.py | 120 +- .../seed_community_lab_application.py | 440 +- .../management/commands/seed_concept_note.py | 1162 +- .../management/commands/seed_fellowship.py | 674 +- .../commands/seed_rapid_response.py | 557 +- .../management/commands/send_reminders.py | 14 +- hypha/apply/funds/migrations/0001_initial.py | 23 +- .../migrations/0002_fundpage_workflow.py | 13 +- ...cationform_category_fundpageform_option.py | 455 +- .../0004_categoryblock_add_required_option.py | 399 +- .../migrations/0005_applicationsubmission.py | 36 +- .../0006_update_block_definitions.py | 437 +- hypha/apply/funds/migrations/0007_round.py | 23 +- .../migrations/0008_add_date_to_round.py | 11 +- .../migrations/0009_update_date_fields.py | 18 +- .../0010_update_for_rich_text_block.py | 467 +- ..._update_encoder_add_round_to_submission.py | 24 +- .../migrations/0012_create_lab_models.py | 71 +- ...0013_allow_nullable_round_on_submission.py | 14 +- .../funds/migrations/0014_add_meta_names.py | 11 +- .../0015_link_user_to_application.py | 583 +- .../apply/funds/migrations/0016_roundform.py | 41 +- .../funds/migrations/0017_round_workflow.py | 13 +- .../funds/migrations/0018_add_addressfield.py | 524 +- .../migrations/0019_protect_submission.py | 22 +- ...0_add_workflow_and_status_to_submission.py | 21 +- .../migrations/0021_rename_workflow_field.py | 71 +- .../0022_applicationsubmission_form_fields.py | 525 +- .../apply/funds/migrations/0023_round_lead.py | 13 +- .../0024_applicationsubmission_search_data.py | 9 +- .../0025_update_with_file_blocks.py | 1093 +- .../0026_add_leads_to_submission_and_lab.py | 25 +- .../0027_applicationsubmission_drupal_id.py | 7 +- .../0028_update_on_delete_django2.py | 59 +- .../0029_applicationsubmission_next.py | 14 +- .../funds/migrations/0030_add_reviewers.py | 44 +- .../migrations/0031_labtype_reviewers.py | 13 +- ...ake_reviewers_optional_in_all_instances.py | 47 +- .../funds/migrations/0033_use_django_fsm.py | 55 +- .../migrations/0034_create_revisions_model.py | 55 +- .../0035_author_timestamp_revision.py | 21 +- .../0036_fundreviewform_labreviewform.py | 81 +- .../migrations/0037_refactor_funds_models.py | 148 +- .../0038_recreate_objects_that_exist.py | 28 +- .../0039_add_rfps_and_sealed_rounds.py | 43 +- ...ration_stream_to_streamfield_definition.py | 1131 +- .../migrations/0041_roundbasereviewform.py | 43 +- .../migrations/0042_update_json_encoder.py | 19 +- .../migrations/0043_auto_20180926_0948.py | 1143 +- .../funds/migrations/0044_add_named_blocks.py | 1167 +- .../funds/migrations/0045_new_workflow.py | 63 +- .../funds/migrations/0046_rename_fields.py | 1171 +- .../funds/migrations/0047_add_markdown.py | 1231 +- .../0048_add_field_slack_channel.py | 23 +- .../funds/migrations/0049_screening_status.py | 31 +- .../funds/migrations/0050_roundsandlabs.py | 16 +- .../0051_applicationsubmission_partners.py | 14 +- .../funds/migrations/0052_reviewerrole.py | 39 +- .../migrations/0053_assigned_reviewers_pre.py | 70 +- .../migrations/0054_move_reviewer_data.py | 14 +- ..._remove_applicationsubmission_reviewers.py | 7 +- .../funds/migrations/0056_reviewers_rename.py | 9 +- .../0057_start_date_blank_null_roundbase.py | 7 +- .../funds/migrations/0058_add_group_toggle.py | 1293 +- .../0059_add_community_review_workflow.py | 67 +- ...060_add_duration_type_in_duration_block.py | 1313 +- ...e_assigned_reviewers_for_data_migration.py | 34 +- ...ata_migrate_type_for_assigned_reviewers.py | 33 +- .../0063_make_reviewer_type_required.py | 11 +- .../migrations/0064_group_toggle_end_block.py | 1325 +- ...5_applicationsubmission_meta_categories.py | 13 +- .../0066_add_stage_to_selected_forms.py | 27 +- ...7_data_migration_for_one_form_per_stage.py | 15 +- .../migrations/0068_add_help_link_field.py | 1601 +- .../0068_link_funds_and_labs_to_paf.py | 29 +- .../migrations/0069_merge_20190905_0403.py | 8 +- ...70_rename_meta_categories_to_meta_terms.py | 17 +- .../migrations/0071_update_field_reviewer.py | 15 +- .../migrations/0072_add_guide_link_field.py | 19 +- hypha/apply/funds/migrations/0073_reminder.py | 47 +- .../0074_add_word_limit_to_text_blocks.py | 1637 ++- .../migrations/0075_auto_20200629_1707.py | 13 +- .../migrations/0076_multi_input_char_block.py | 1749 ++- ...77_add_determination_stream_field_forms.py | 119 +- ..._add_heading_block_to_form_fields_block.py | 1799 ++- ...reviewer_settings_for_submission_access.py | 83 +- ..._and_default_fields_to_screening_status.py | 23 +- .../0081_add_screening_statuses_field.py | 11 +- ..._screening_status_to_screening_statuses.py | 19 +- .../0083_remove_screening_status_field.py | 7 +- ...cept_dismissed_outcome_reviewersettings.py | 18 +- .../0085_add_days_to_duration_block.py | 1801 ++- .../0086_applicationsubmission_summary.py | 9 +- .../migrations/0087_applicationsettings.py | 32 +- .../migrations/0088_auto_20210423_1257.py | 13 +- ..._remove_project_approval_form_refrences.py | 13 +- .../migrations/0090_auto_20220111_1314.py | 19 +- .../migrations/0091_category_block_label.py | 1803 ++- .../migrations/0092_auto_20220308_0827.py | 1815 ++- .../migrations/0093_set_duration_false.py | 16 +- .../migrations/0094_auto_20220406_0800.py | 1843 ++- .../0095_only_external_review_option.py | 18 +- .../migrations/0096_only_active_users.py | 93 +- ...lreviewform_roundbaseexternalreviewform.py | 119 +- ...alter_applicationsubmission_submit_time.py | 12 +- .../migrations/0099_auto_20220629_1339.py | 1843 ++- ...r_applicationbase_labbase_approval_form.py | 29 +- .../migrations/0101_auto_20220722_0844.py | 1885 ++- ...projectapprovalform_to_fundbase_labbase.py | 89 +- .../migrations/0103_alter_screeningstatus.py | 20 +- .../funds/migrations/0104_show_deadline.py | 11 +- ...onbase_activity_digest_recipient_emails.py | 19 +- .../0106_applicationsubmission_is_archive.py | 7 +- ...107_add_additional_fields_to_funds_labs.py | 63 +- ...aseprojectsowform_labbaseprojectsowform.py | 81 +- .../0109_rename_section_text_field.py | 1841 ++- .../migrations/0110_auto_20230418_0644.py | 1841 ++- ...tionsubmission_search_document_and_more.py | 46 +- .../migrations/0112_add_organization_name.py | 1903 ++- hypha/apply/funds/models/__init__.py | 28 +- .../funds/models/application_revisions.py | 41 +- hypha/apply/funds/models/applications.py | 486 +- .../apply/funds/models/assigned_reviewers.py | 95 +- hypha/apply/funds/models/forms.py | 89 +- hypha/apply/funds/models/mixins.py | 111 +- hypha/apply/funds/models/reminders.py | 31 +- hypha/apply/funds/models/reviewer_role.py | 59 +- hypha/apply/funds/models/screening.py | 10 +- hypha/apply/funds/models/submissions.py | 373 +- hypha/apply/funds/models/utils.py | 73 +- hypha/apply/funds/permissions.py | 14 +- hypha/apply/funds/reviewers/services.py | 10 +- hypha/apply/funds/services.py | 68 +- hypha/apply/funds/tables.py | 437 +- .../templates/funds/admin/parent_chooser.html | 44 +- .../funds/application_base_landing.html | 14 +- .../funds/applicationrevision_list.html | 34 +- .../applicationsubmission_admin_detail.html | 4 +- .../applicationsubmission_confirm_delete.html | 26 +- .../funds/applicationsubmission_detail.html | 314 +- .../funds/applicationsubmission_form.html | 58 +- ...plicationsubmission_simplified_detail.html | 4 +- .../funds/base_submissions_table.html | 4 +- .../funds/templates/funds/demo_workflow.html | 70 +- .../funds/grouped_application_list.html | 6 +- .../funds/includes/admin_primary_actions.html | 28 +- .../funds/includes/delegated_form_base.html | 16 +- .../includes/generic_primary_actions.html | 6 +- .../funds/includes/progress_form.html | 12 +- .../funds/includes/reminders_block.html | 28 +- .../funds/includes/rendered_answers.html | 32 +- .../funds/includes/review_sidebar.html | 2 +- .../funds/includes/review_sidebar_item.html | 20 +- .../funds/includes/revision_diff_table.html | 42 +- .../funds/includes/round-block-listing.html | 26 +- .../templates/funds/includes/round-block.html | 58 +- .../funds/includes/screening_form.html | 12 +- .../includes/screening_status_block.html | 12 +- .../funds/includes/status_bar_item.html | 12 +- .../includes/table_filter_and_search.html | 24 +- .../funds/reminder_confirm_delete.html | 6 +- .../templates/funds/reviewer_leaderboard.html | 18 +- hypha/apply/funds/templates/funds/rounds.html | 16 +- .../templates/funds/submission_sealed.html | 46 +- .../funds/templates/funds/submissions.html | 16 +- .../templates/funds/submissions_overview.html | 10 +- .../templates/funds/submissions_result.html | 30 +- .../funds/tables/column_reviews.html | 2 +- .../funds/templates/funds/tables/table.html | 34 +- .../funds/templates/submissions/all.html | 52 +- .../submenu/bulk-update-reviewers.html | 16 +- .../submissions/submenu/category.html | 22 +- .../submissions/submenu/change-status.html | 2 +- .../templates/submissions/submenu/funds.html | 14 +- .../templates/submissions/submenu/leads.html | 6 +- .../submissions/submenu/meta-terms.html | 22 +- .../submissions/submenu/reviewers.html | 22 +- .../templates/submissions/submenu/rounds.html | 50 +- .../funds/templatetags/primaryactions_tags.py | 4 +- .../funds/templatetags/statusbar_tags.py | 20 +- .../funds/templatetags/submission_tags.py | 8 +- hypha/apply/funds/templatetags/table_tags.py | 3 +- .../apply/funds/templatetags/workflow_tags.py | 6 +- hypha/apply/funds/tests/factories/blocks.py | 98 +- hypha/apply/funds/tests/factories/models.py | 137 +- .../funds/tests/models/test_roundsandlabs.py | 12 +- hypha/apply/funds/tests/test_admin_form.py | 158 +- hypha/apply/funds/tests/test_admin_views.py | 126 +- hypha/apply/funds/tests/test_forms.py | 14 +- hypha/apply/funds/tests/test_models.py | 165 +- hypha/apply/funds/tests/test_tags.py | 21 +- hypha/apply/funds/tests/test_views.py | 856 +- .../funds/tests/views/test_batch_progress.py | 76 +- .../funds/tests/views/test_batch_reviewers.py | 46 +- hypha/apply/funds/tests/views/test_rounds.py | 16 +- hypha/apply/funds/urls.py | 244 +- hypha/apply/funds/utils.py | 6 +- hypha/apply/funds/views.py | 675 +- hypha/apply/funds/views_beta.py | 160 +- hypha/apply/funds/views_partials.py | 152 +- hypha/apply/funds/wagtail_hooks.py | 22 +- hypha/apply/funds/widgets.py | 23 +- hypha/apply/funds/workflow.py | 1355 +- hypha/apply/home/apps.py | 4 +- hypha/apply/home/factories.py | 6 +- hypha/apply/home/migrations/0001_initial.py | 23 +- .../migrations/0002_add_apply_homepage.py | 25 +- hypha/apply/home/models.py | 26 +- .../templates/apply_home/apply_home_page.html | 36 +- .../apply_home/includes/apply_listing.html | 38 +- hypha/apply/home/wagtail_hooks.py | 6 +- hypha/apply/middleware.py | 6 +- hypha/apply/projects/admin.py | 44 +- hypha/apply/projects/admin_views.py | 2 - hypha/apply/projects/apps.py | 4 +- hypha/apply/projects/context_processors.py | 2 +- hypha/apply/projects/filters.py | 62 +- hypha/apply/projects/forms/__init__.py | 58 +- hypha/apply/projects/forms/payment.py | 105 +- hypha/apply/projects/forms/project.py | 156 +- hypha/apply/projects/forms/report.py | 58 +- hypha/apply/projects/forms/vendor.py | 42 +- .../management/commands/notify_report_due.py | 21 +- .../apply/projects/migrations/0001_initial.py | 25 +- .../0002_add_submission_fields_to_project.py | 25 +- .../migrations/0003_add_project_lead.py | 13 +- .../0004_project_rename_name_to_title.py | 9 +- .../migrations/0005_add_user_to_project.py | 25 +- .../migrations/0006_add_project_paf_fields.py | 45 +- ...0007_fix_proposed_end_date_verbose_name.py | 9 +- .../migrations/0008_add_value_validator.py | 14 +- .../projects/migrations/0009_add_approval.py | 65 +- .../migrations/0009_documentcategory.py | 23 +- .../0010_add_related_names_to_approval_fks.py | 23 +- .../migrations/0011_add_packet_file.py | 43 +- .../migrations/0012_adjust_storage_class.py | 12 +- .../projects/migrations/0013_add_contract.py | 45 +- .../0014_add_payment_related_models.py | 136 +- ...5_add_payment_request_changes_requested.py | 18 +- .../migrations/0016_add_project_settings.py | 30 +- .../0017_add_sent_to_compliance_at.py | 7 +- .../migrations/0018_projectapprovalform.py | 449 +- .../migrations/0019_add_form_to_projects.py | 437 +- .../0020_rename_value_to_requested_value.py | 9 +- .../migrations/0021_add_paid_value.py | 14 +- ...0022_update_field_definitions_for_forms.py | 1020 +- ...3_ensure_contracts_uses_private_storage.py | 12 +- .../0024_allow_no_comments_on_pr.py | 7 +- .../migrations/0025_add_report_models.py | 123 +- .../0026_data_contract_approved_date.py | 7 +- .../migrations/0027_report_current.py | 14 +- .../projects/migrations/0028_report_draft.py | 29 +- .../migrations/0029_report_submitted.py | 7 +- .../migrations/0030_report_skipped.py | 7 +- .../0031_add_public_private_content.py | 19 +- .../migrations/0032_report_notified.py | 7 +- .../0033_add_word_limit_to_text_blocks.py | 1032 +- .../migrations/0034_multi_input_char_block.py | 1144 +- ..._add_heading_block_to_form_fields_block.py | 1194 +- .../projects/migrations/0036_add_vendor.py | 503 +- .../migrations/0037_add_project_invoicing.py | 118 +- .../migrations/0038_project_translateble.py | 9 +- .../migrations/0039_add_deliverables.py | 84 +- ...040_remove_deliverable_invoice_quantity.py | 7 +- .../0041_payment_requests_cleanup.py | 21 +- .../0042_delete_project_approval_form.py | 3 +- .../0043_remove_project_approval_form.py | 5 +- .../migrations/0044_add_resubmitted_status.py | 21 +- .../0045_use_fsm_field_for_status.py | 24 +- .../0046_add_required_checks_field.py | 17 +- .../0047_alter_project_form_data.py | 12 +- .../migrations/0048_alter_project_value.py | 7 +- ...049_add_fields_for_finance_integrations.py | 41 +- .../migrations/0050_add_new_invoice_status.py | 25 +- ..._remove_unnecessary_fields_from_invoice.py | 15 +- .../0052_alter_project_form_fields.py | 599 +- .../migrations/0053_projectapprovalform.py | 625 +- .../0054_alter_project_form_fields.py | 600 +- ...ter_project_status_add_pafreviewersrole.py | 59 +- .../migrations/0056_packetfile_created_at.py | 7 +- .../migrations/0057_alter_report_config.py | 21 +- .../0058_project_ready_for_final_approval.py | 7 +- .../0059_set_ready_for_final_approval.py | 25 +- .../migrations/0060_auto_20230116_0712.py | 31 +- .../projects/migrations/0061_remove_checks.py | 11 +- .../migrations/0062_auto_20230228_1218.py | 76 +- ...projectsettings_paf_approval_sequential.py | 11 +- .../0064_alter_pafapprovals_options.py | 7 +- ...remove_project_ready_for_final_approval.py | 7 +- .../migrations/0066_projectsowform.py | 628 +- .../projects/migrations/0067_projectsow.py | 648 +- .../0068_rename_section_text_field.py | 2381 ++- ...ractpacketfile_contractdocumentcategory.py | 91 +- .../migrations/0070_auto_20230327_1109.py | 15 +- ...071_add_customformfields_to_paf_and_sow.py | 2717 +++- .../0072_pafapprovals_approved_at.py | 7 +- .../migrations/0073_alter_project_status.py | 19 +- ...date_projects_status_committed_to_draft.py | 15 +- .../0075_alter_pafapprovals_user.py | 15 +- ...tdocument_and_contractdocument_category.py | 59 +- .../migrations/0077_alter_invoice_status.py | 27 +- .../0078_update_project_statuses.py | 29 +- .../0079_alter_invoice_add_fields.py | 23 +- hypha/apply/projects/models/__init__.py | 44 +- hypha/apply/projects/models/payment.py | 181 +- hypha/apply/projects/models/project.py | 377 +- hypha/apply/projects/models/report.py | 154 +- hypha/apply/projects/models/vendor.py | 390 +- hypha/apply/projects/permissions.py | 303 +- .../projects/services/sageintacct/__init__.py | 16 +- .../services/sageintacct/exceptions.py | 8 +- .../services/sageintacct/sageintacctsdk.py | 15 +- .../projects/services/sageintacct/utils.py | 114 +- .../services/sageintacct/wrapper/__init__.py | 8 +- .../services/sageintacct/wrapper/api_base.py | 362 +- .../services/sageintacct/wrapper/constants.py | 33 +- .../services/sageintacct/wrapper/invoice.py | 4 +- .../services/sageintacct/wrapper/project.py | 4 +- .../sageintacct/wrapper/purchasing.py | 4 +- hypha/apply/projects/tables.py | 149 +- .../includes/contracting_documents.html | 344 +- .../includes/deliverables_block.html | 16 +- .../includes/invoices.html | 122 +- .../includes/report_frequency_config.html | 16 +- .../includes/report_line.html | 18 +- .../includes/reports.html | 62 +- .../includes/supporting_documents.html | 478 +- .../invoice_admin_detail.html | 22 +- .../invoice_confirm_delete.html | 50 +- .../application_projects/invoice_detail.html | 132 +- .../application_projects/invoice_form.html | 52 +- .../application_projects/invoice_list.html | 18 +- .../application_projects/overview.html | 68 +- .../application_projects/paf_export.html | 234 +- .../project_admin_detail.html | 30 +- .../project_approval_detail.html | 194 +- .../project_approval_form.html | 132 +- .../application_projects/project_detail.html | 290 +- .../application_projects/project_form.html | 48 +- .../application_projects/project_list.html | 16 +- .../project_sow_detail.html | 76 +- .../application_projects/report_detail.html | 46 +- .../application_projects/report_form.html | 102 +- .../application_projects/report_list.html | 16 +- .../application_projects/sow_export.html | 152 +- .../application_projects/vendor_detail.html | 74 +- .../application_projects/vendor_form.html | 42 +- .../application_projects/vendor_success.html | 26 +- .../projects/templatetags/approval_tools.py | 56 +- .../projects/templatetags/contract_tools.py | 22 +- .../projects/templatetags/invoice_tools.py | 15 +- .../projects/templatetags/project_tags.py | 108 +- hypha/apply/projects/tests/factories.py | 78 +- hypha/apply/projects/tests/test_commands.py | 38 +- hypha/apply/projects/tests/test_forms.py | 346 +- hypha/apply/projects/tests/test_models.py | 149 +- hypha/apply/projects/tests/test_settings.py | 4 +- hypha/apply/projects/tests/test_views.py | 882 +- hypha/apply/projects/urls.py | 189 +- hypha/apply/projects/utils.py | 63 +- hypha/apply/projects/views/__init__.py | 78 +- hypha/apply/projects/views/payment.py | 98 +- hypha/apply/projects/views/project.py | 728 +- .../apply/projects/views/project_partials.py | 8 +- hypha/apply/projects/views/report.py | 69 +- hypha/apply/projects/views/vendor.py | 256 +- hypha/apply/review/admin.py | 16 +- hypha/apply/review/admin_helpers.py | 17 +- hypha/apply/review/admin_views.py | 2 - hypha/apply/review/apps.py | 2 +- hypha/apply/review/blocks.py | 92 +- hypha/apply/review/fields.py | 14 +- hypha/apply/review/forms.py | 40 +- .../management/commands/export_reviews_csv.py | 32 +- .../commands/fix_stream_field_ids.py | 11 +- .../commands/migration_review_base.py | 114 +- hypha/apply/review/migrations/0001_initial.py | 38 +- .../migrations/0002_add_common_fields.py | 49 +- .../migrations/0003_review_json_field.py | 19 +- .../review/migrations/0004_review_is_draft.py | 9 +- .../review/migrations/0005_streamform.py | 381 +- .../migrations/0006_remove_review_review.py | 7 +- .../review/migrations/0007_review_revision.py | 16 +- .../0008_update_fields_for_tweaks.py | 349 +- .../migrations/0009_auto_20180823_0918.py | 453 +- .../migrations/0010_review_drupal_id.py | 7 +- .../review/migrations/0011_add_date_fields.py | 19 +- .../migrations/0012_auto_20180926_0948.py | 465 +- .../review/migrations/0013_rename_fields.py | 465 +- .../review/migrations/0014_add_markdown.py | 525 +- .../review/migrations/0015_review_opinion.py | 41 +- .../migrations/0016_review_visibility.py | 574 +- .../migrations/0017_add_temp_author_field.py | 26 +- .../migrations/0018_migrate_author_data.py | 46 +- .../0019_replace_existing_author_field.py | 43 +- .../0020_review_score_calc_update.py | 7 +- .../migrations/0021_add_help_link_field.py | 683 +- .../0022_add_word_limit_to_text_blocks.py | 719 +- .../0023_add_score_without_text_block.py | 779 +- .../migrations/0024_auto_20220111_1314.py | 11 +- .../migrations/0025_auto_20220722_0844.py | 781 +- hypha/apply/review/models.py | 77 +- hypha/apply/review/options.py | 36 +- .../review/includes/review_opinions_list.html | 18 +- .../review/render_scored_answer_field.html | 10 +- .../review/review_confirm_delete.html | 24 +- .../templates/review/review_detail.html | 106 +- .../templates/review/review_edit_form.html | 64 +- .../review/templates/review/review_form.html | 70 +- .../review/templates/review/review_list.html | 34 +- .../apply/review/templatetags/review_tags.py | 24 +- hypha/apply/review/tests/factories/blocks.py | 41 +- hypha/apply/review/tests/factories/models.py | 22 +- hypha/apply/review/tests/test_admin.py | 1 - hypha/apply/review/tests/test_admin_views.py | 80 +- hypha/apply/review/tests/test_views.py | 334 +- hypha/apply/review/urls.py | 12 +- hypha/apply/review/views.py | 221 +- hypha/apply/review/wagtail_hooks.py | 6 +- hypha/apply/search/filters.py | 2 +- hypha/apply/search/query_parser.py | 10 +- hypha/apply/search/tests/test_filters.py | 51 +- hypha/apply/search/tests/test_query_parser.py | 61 +- hypha/apply/stream_forms/apps.py | 2 +- hypha/apply/stream_forms/blocks.py | 253 +- hypha/apply/stream_forms/fields.py | 48 +- hypha/apply/stream_forms/files.py | 29 +- hypha/apply/stream_forms/forms.py | 41 +- hypha/apply/stream_forms/models.py | 54 +- .../templates/stream_forms/render_field.html | 8 +- .../stream_forms/render_multi_file_field.html | 14 +- hypha/apply/stream_forms/testing/factories.py | 118 +- .../apply/templates/forms/includes/field.html | 108 +- .../templates/forms/includes/form_errors.html | 22 +- .../forms/includes/multi_input_field.html | 16 +- hypha/apply/urls.py | 24 +- hypha/apply/users/admin_views.py | 161 +- hypha/apply/users/decorators.py | 17 +- hypha/apply/users/forms.py | 50 +- hypha/apply/users/groups.py | 56 +- .../management/commands/accounts_cleanup.py | 7 +- .../management/commands/migrate_users.py | 42 +- hypha/apply/users/middleware.py | 19 +- hypha/apply/users/migrations/0001_initial.py | 127 +- .../users/migrations/0002_initial_data.py | 29 +- .../migrations/0003_make_email_username.py | 19 +- .../migrations/0004_drop_first_last_names.py | 19 +- .../users/migrations/0005_user_drupal_id.py | 7 +- .../0006_update_the_ordering_of_users.py | 7 +- .../apply/users/migrations/0007_user_slack.py | 14 +- .../migrations/0008_add_staff_permissions.py | 9 +- .../migrations/0009_add_partner_group.py | 18 +- .../0010_add_community_reviewer_group.py | 18 +- .../migrations/0011_add_applicant_group.py | 18 +- .../migrations/0012_set_applicant_group.py | 8 +- .../migrations/0013_add_approver_group.py | 17 +- .../users/migrations/0014_usersettings.py | 40 +- .../users/migrations/0015_login_extra_text.py | 23 +- .../migrations/0016_add_finance_group.py | 17 +- .../migrations/0017_rename_staff_admin.py | 12 +- .../migrations/0018_add_contracting_group.py | 17 +- .../0019_rename_usersettings_authsettings.py | 9 +- .../migrations/0020_auto_20230625_1825.py | 37 +- hypha/apply/users/models.py | 124 +- hypha/apply/users/pipeline.py | 2 +- .../templates/two_factor/_wizard_actions.html | 8 +- .../templates/two_factor/core/setup.html | 18 +- .../two_factor/core/setup_complete.html | 10 +- .../two_factor/core/two_factor_required.html | 4 +- .../templates/two_factor/profile/disable.html | 60 +- .../templates/two_factor/profile/profile.html | 2 +- .../apply/users/templates/users/account.html | 84 +- .../templates/users/activation/invalid.html | 18 +- .../templates/users/change_password.html | 60 +- .../users/email_change/confirm_password.html | 54 +- .../templates/users/email_change/done.html | 6 +- .../users/email_change/invalid_link.html | 14 +- hypha/apply/users/templates/users/oauth.html | 68 +- .../users/password_reset/confirm.html | 80 +- .../templates/users/password_reset/form.html | 2 +- .../templates/users/register-success.html | 8 +- .../templates/wagtailusers/users/results.html | 10 +- hypha/apply/users/templatetags/users_tags.py | 10 +- hypha/apply/users/tests/factories.py | 35 +- hypha/apply/users/tests/test_forms.py | 28 +- hypha/apply/users/tests/test_middleware.py | 16 +- hypha/apply/users/tests/test_oauth_access.py | 30 +- hypha/apply/users/tests/test_registration.py | 30 +- hypha/apply/users/tests/test_utils.py | 43 +- hypha/apply/users/tests/test_views.py | 38 +- hypha/apply/users/urls.py | 163 +- hypha/apply/users/utils.py | 70 +- hypha/apply/users/views.py | 349 +- hypha/apply/users/wagtail_hooks.py | 15 +- hypha/apply/utils/admin.py | 29 +- hypha/apply/utils/apps.py | 4 +- hypha/apply/utils/blocks.py | 108 +- hypha/apply/utils/image.py | 9 +- .../0001_add_pdf_page_size_setting.py | 40 +- hypha/apply/utils/models.py | 18 +- hypha/apply/utils/options.py | 50 +- hypha/apply/utils/pdfs.py | 255 +- hypha/apply/utils/storage.py | 3 +- hypha/apply/utils/templates/apply/404.html | 8 +- hypha/apply/utils/templatetags/apply_tags.py | 12 +- hypha/apply/utils/testing/tests.py | 30 +- hypha/apply/utils/tests/test_views.py | 2 +- hypha/apply/utils/views.py | 57 +- hypha/cookieconsent/apps.py | 2 +- hypha/cookieconsent/context_processors.py | 6 +- .../cookieconsent/migrations/0001_initial.py | 50 +- hypha/cookieconsent/models.py | 21 +- .../cookieconsent/static/js/cookieconsent.js | 46 +- .../templates/includes/banner.html | 20 +- .../templatetags/cookieconsent_tags.py | 15 +- hypha/core/apps.py | 2 +- hypha/core/components.py | 4 +- hypha/core/context_processors.py | 28 +- hypha/core/mail.py | 12 +- hypha/core/management/commands/initialize.py | 38 +- .../management/commands/wagtailsiteupdate.py | 18 +- ...01_wagtail_4_reference_index_dependency.py | 3 +- .../templates/components/dropdown-menu.html | 54 +- .../wagtail/panels/inline_panel_readonly.html | 8 +- hypha/core/templatetags/querystrings.py | 12 +- hypha/core/tests/test_utils.py | 4 +- hypha/core/utils.py | 4 +- hypha/core/wagtail_hooks.py | 8 +- hypha/images/migrations/0001_initial.py | 143 +- .../migrations/0002_customimage_file_hash.py | 7 +- .../migrations/0003_customimage_drupal_id.py | 7 +- .../0004_alter_customimage_file_hash.py | 11 +- .../migrations/0005_auto_20230214_0658.py | 24 +- hypha/images/models.py | 12 +- hypha/public/forms/apps.py | 4 +- hypha/public/forms/migrations/0001_initial.py | 199 +- .../migrations/0002_add_document_choice.py | 28 +- .../migrations/0003_formfield_clean_name.py | 15 +- .../migrations/0004_auto_20220722_0844.py | 43 +- hypha/public/forms/models.py | 55 +- .../templates/public_forms/form_page.html | 34 +- .../public_forms/form_page_landing.html | 10 +- hypha/public/forms/wagtail_hooks.py | 2 +- hypha/public/funds/apps.py | 4 +- hypha/public/funds/blocks.py | 16 +- hypha/public/funds/migrations/0001_initial.py | 240 +- .../funds/migrations/0002_labindex_labpage.py | 251 +- .../migrations/0003_icon_and_related_pages.py | 58 +- .../migrations/0004_fundpagerelatedpage.py | 46 +- .../migrations/0005_link_text_optional.py | 13 +- .../migrations/0006_fundindex_introduction.py | 7 +- .../0007_add_rfp_models_for_public.py | 72 +- .../funds/migrations/0008_recreate_pages.py | 25 +- .../0009_allow_mailto_in_linkfield.py | 14 +- .../0010_correct_related_page_required.py | 23 +- .../migrations/0011_opencallindexpage.py | 81 +- .../0012_add_box_apply_link_fields.py | 148 +- .../funds/migrations/0013_add_more_block.py | 184 +- .../migrations/0014_auto_20220722_0844.py | 186 +- hypha/public/funds/models.py | 167 +- .../public_funds/blocks/related_projects.html | 22 +- .../public_funds/includes/fund_apply_cta.html | 14 +- .../public_funds/includes/lab_apply_cta.html | 12 +- .../public_funds/open_call_index_page.html | 44 +- hypha/public/home/blocks.py | 4 +- .../commands/export_public_pages_json.py | 134 +- hypha/public/home/migrations/0001_initial.py | 81 +- .../home/migrations/0002_create_homepage.py | 25 +- .../migrations/0003_homepage_header_image.py | 17 +- .../0004_add_related_models_to_homepage.py | 101 +- .../home/migrations/0005_homepage_our_work.py | 21 +- .../migrations/0006_add_our_work_fields.py | 51 +- .../0007_add_labs_and_funds_homepage.py | 68 +- .../0008_add_intro_to_lab_and_funds.py | 11 +- .../home/migrations/0009_django2_update.py | 43 +- .../migrations/0010_add_rfp_to_homepage.py | 61 +- .../0011_correct_related_page_behaviour.py | 33 +- .../home/migrations/0012_add_news_homepage.py | 25 +- .../0013_alter_homepage_our_work.py | 27 +- hypha/public/home/models.py | 172 +- .../public/home/templates/home/home_page.html | 42 +- .../templates/home/includes/list_block.html | 94 +- hypha/public/home/templatetags/home_tags.py | 6 +- hypha/public/mailchimp/apps.py | 2 +- hypha/public/mailchimp/forms.py | 12 +- .../migrations/0001_add_newsletter_setting.py | 36 +- hypha/public/mailchimp/models.py | 8 +- .../mailchimp/newsletter_signup.html | 14 +- hypha/public/mailchimp/tests/test_views.py | 40 +- hypha/public/mailchimp/urls.py | 6 +- hypha/public/mailchimp/views.py | 42 +- .../navigation/migrations/0001_initial.py | 145 +- .../0002_remove_unused_navigation_elements.py | 15 +- ...r_navigationsettings_primary_navigation.py | 30 +- hypha/public/navigation/models.py | 16 +- .../navigation/includes/menu_item.html | 6 +- .../navigation/primarynav-apply.html | 28 +- .../templatetags/navigation_tags.py | 14 +- hypha/public/news/blocks.py | 4 +- hypha/public/news/feeds.py | 21 +- .../news/management/commands/migrate_news.py | 98 +- hypha/public/news/migrations/0001_initial.py | 298 +- .../news/migrations/0002_add_header_image.py | 29 +- .../news/migrations/0003_newspageauthor.py | 46 +- .../migrations/0004_make_author_required.py | 14 +- .../migrations/0005_newsprojectrelatedpage.py | 46 +- .../migrations/0006_newspage_drupal_id.py | 7 +- .../migrations/0007_newsindex_introduction.py | 7 +- .../0008_correct_related_page_behaviour.py | 23 +- .../0009_add_awesome_table_block.py | 73 +- .../news/migrations/0010_newsfeedsettings.py | 59 +- .../0011_add_box_apply_link_fields.py | 88 +- .../news/migrations/0012_add_more_block.py | 106 +- .../migrations/0013_alter_newspage_body.py | 107 +- .../0014_alter_newspagenewstype_news_type.py | 13 +- hypha/public/news/models.py | 126 +- .../news/templates/news/news_index.html | 10 +- .../public/news/templates/news/news_page.html | 80 +- hypha/public/partner/admin.py | 12 +- hypha/public/partner/admin_view.py | 24 +- hypha/public/partner/apps.py | 2 +- ...add_investments_table_and_partners_page.py | 307 +- .../0002_currency_symbol_setting.py | 14 +- hypha/public/partner/models.py | 87 +- hypha/public/partner/tables.py | 98 +- .../partner/base_investments_table.html | 4 +- .../includes/table_filter_and_search.html | 12 +- .../templates/partner/investments.html | 10 +- .../templates/partner/partner_page.html | 36 +- .../partner/templates/partner/table.html | 48 +- hypha/public/partner/views.py | 12 +- .../management/commands/migrate_people.py | 192 +- .../public/people/migrations/0001_initial.py | 335 +- .../migrations/0002_add_header_image.py | 29 +- .../0003_update_contact_information.py | 61 +- .../public/people/migrations/0004_funding.py | 49 +- .../people/migrations/0005_django2_update.py | 13 +- .../people/migrations/0006_fundreviewers.py | 46 +- .../migrations/0007_allow_blank_source.py | 14 +- .../migrations/0008_personpage_drupal_id.py | 7 +- ...0009_dont_insist_on_first_name_or_title.py | 11 +- .../migrations/0010_personpage_active.py | 7 +- .../0011_change_the_contact_keys.py | 19 +- .../0012_personindexpage_introduction.py | 7 +- .../0013_add_box_apply_link_fields.py | 75 +- .../people/migrations/0014_add_more_block.py | 93 +- .../0015_alter_personpage_biography.py | 94 +- hypha/public/people/models.py | 207 +- .../people/admin/js/update_person_title.js | 24 +- .../templates/people/person_index_page.html | 26 +- .../people/templates/people/person_page.html | 102 +- hypha/public/people/wagtail_hooks.py | 4 +- hypha/public/projects/apps.py | 2 +- .../management/commands/migrate_projects.py | 163 +- .../projects/migrations/0001_initial.py | 313 +- .../migrations/0002_projectfunding.py | 49 +- .../migrations/0003_projectpage_status.py | 18 +- .../migrations/0004_projectpage_categories.py | 9 +- .../migrations/0005_projectpage_drupal_id.py | 7 +- .../migrations/0006_allow_blank_source.py | 14 +- ...007_fix_related_page_required_behaviour.py | 13 +- .../0008_add_box_apply_link_fields.py | 74 +- .../migrations/0009_add_more_block.py | 92 +- .../migrations/0010_alter_projectpage_body.py | 93 +- hypha/public/projects/models.py | 122 +- .../templates/projects/project_page.html | 108 +- .../projects/widgets/options_widget.html | 26 +- hypha/public/projects/tests.py | 38 +- hypha/public/projects/widgets.py | 24 +- hypha/public/search/views.py | 41 +- .../standardpages/migrations/0001_initial.py | 246 +- .../migrations/0002_add_header_image.py | 29 +- .../0003_correct_related_page_behaviour.py | 13 +- .../0004_add_box_apply_link_fields.py | 74 +- .../migrations/0005_add_more_block.py | 92 +- .../0006_alter_informationpage_body.py | 93 +- hypha/public/standardpages/models.py | 20 +- .../templates/standardpages/index_page.html | 52 +- hypha/public/urls.py | 16 +- hypha/public/utils/blocks.py | 5 +- hypha/public/utils/cache.py | 2 +- hypha/public/utils/context_processors.py | 6 +- hypha/public/utils/migrations/0001_initial.py | 167 +- .../0002_add_footer_content_setting.py | 17 +- .../migrations/0003_add_site_logo_setting.py | 31 +- .../0004_add_setting_site_logo_link.py | 13 +- .../0005_alter_calltoactionsnippet_link.py | 34 +- ...06_alter_systemmessagessettings_options.py | 7 +- ...0007_remove_systemmessagessettings_site.py | 7 +- hypha/public/utils/models.py | 298 +- .../templates/utils/includes/funding.html | 2 +- .../utils/includes/login_button.html | 4 +- .../utils/templates/utils/listing_index.html | 82 +- hypha/public/utils/templatetags/util_tags.py | 6 +- hypha/public/utils/wagtail_hooks.py | 14 +- hypha/settings/base.py | 495 +- hypha/settings/dev.py | 152 +- hypha/settings/django.py | 338 +- hypha/settings/example.py | 4 +- hypha/settings/production.py | 17 +- hypha/settings/test.py | 8 +- .../src/images/favicons/site.webmanifest.json | 24 +- .../src/javascript/apply/all-reviews-table.js | 21 +- .../javascript/apply/all-submissions-table.js | 16 +- .../application-form-links-new-window.js | 10 +- .../src/javascript/apply/batch-actions.js | 123 +- .../src/javascript/apply/deliverables.js | 136 +- .../apply/determination-template.js | 52 +- .../src/javascript/apply/document-category.js | 7 +- .../src/javascript/apply/dropdown.js | 14 +- .../src/javascript/apply/edit-comment.js | 216 +- .../src/javascript/apply/fancybox-global.js | 28 +- .../src/javascript/apply/file-uploads.js | 55 +- hypha/static_src/src/javascript/apply/flag.js | 47 +- .../javascript/apply/multi-input-fields.js | 49 +- .../apply/past-reports-pagination.js | 17 +- .../src/javascript/apply/report-calculator.js | 63 +- .../src/javascript/apply/report-frequency.js | 22 +- .../src/javascript/apply/screening-status.js | 155 +- .../javascript/apply/submission-filters.js | 156 +- .../javascript/apply/submission-form-copy.js | 176 +- .../apply/submission-text-cleanup.js | 22 +- hypha/static_src/src/javascript/apply/tabs.js | 66 +- .../javascript/apply/tinymce-word-count.js | 53 +- .../javascript/apply/toggle-actions-panel.js | 10 +- .../javascript/apply/toggle-payment-block.js | 13 +- .../src/javascript/apply/toggle-related.js | 29 +- .../src/javascript/apply/two-factor-focus.js | 6 +- .../src/javascript/apply/url-search-params.js | 311 +- hypha/static_src/src/javascript/main-top.js | 6 +- hypha/static_src/src/javascript/main.js | 140 +- .../public/all-investments-table.js | 16 +- .../src/javascript/public/dataviz-iframe.js | 43 +- .../javascript/public/investment-filters.js | 145 +- .../javascript/public/investment-tooltips.js | 13 +- .../src/javascript/public/page-box.js | 12 +- .../src/javascript/public/protect-form.js | 30 +- .../src/sass/apply/abstracts/_functions.scss | 21 +- .../src/sass/apply/abstracts/_mixins.scss | 54 +- .../src/sass/apply/abstracts/_variables.scss | 69 +- .../static_src/src/sass/apply/base/_base.scss | 2 +- .../src/sass/apply/base/_typography.scss | 4 +- .../components/_activity-notifications.scss | 12 +- .../src/sass/apply/components/_admin-bar.scss | 2 +- .../src/sass/apply/components/_alert.scss | 2 +- .../src/sass/apply/components/_button.scss | 25 +- .../sass/apply/components/_data-block.scss | 6 +- .../sass/apply/components/_docs-block.scss | 8 +- .../src/sass/apply/components/_dropdown.scss | 8 +- .../src/sass/apply/components/_editor.scss | 4 +- .../src/sass/apply/components/_feed.scss | 10 +- .../src/sass/apply/components/_filters.scss | 2 +- .../sass/apply/components/_funding-block.scss | 4 +- .../src/sass/apply/components/_heading.scss | 14 +- .../src/sass/apply/components/_icon.scss | 8 +- .../sass/apply/components/_invoice-block.scss | 2 +- .../src/sass/apply/components/_link.scss | 11 +- .../src/sass/apply/components/_messages.scss | 2 +- .../src/sass/apply/components/_nav.scss | 4 +- .../src/sass/apply/components/_nprogress.scss | 4 +- .../apply/components/_projects-table.scss | 2 +- .../apply/components/_related-sidebar.scss | 8 +- .../apply/components/_reviews-sidebar.scss | 1 - .../src/sass/apply/components/_select2.scss | 16 +- .../src/sass/apply/components/_sidebar.scss | 9 +- .../sass/apply/components/_simplified.scss | 10 +- .../sass/apply/components/_stat-block.scss | 4 +- .../sass/apply/components/_status-bar.scss | 4 +- .../src/sass/apply/components/_table.scss | 4 +- .../src/sass/apply/components/_tabs.scss | 14 +- .../sass/apply/components/_two-factor.scss | 4 +- .../src/sass/apply/components/_wrapper.scss | 2 +- hypha/static_src/src/sass/apply/fancybox.scss | 561 +- .../src/sass/apply/layout/_header.scss | 4 +- hypha/static_src/src/sass/apply/main.scss | 138 +- .../static_src/src/sass/apply/styleguide.scss | 126 +- .../src/sass/apply/wagtail_editor.scss | 10 +- .../src/sass/apply/wagtail_users_list.scss | 8 +- hypha/static_src/src/sass/normalize.scss | 128 +- hypha/static_src/src/sass/print.scss | 10 +- .../src/sass/public/abstracts/_functions.scss | 21 +- .../src/sass/public/abstracts/_mixins.scss | 69 +- .../src/sass/public/abstracts/_variables.scss | 72 +- .../src/sass/public/base/_typography.scss | 38 +- .../sass/public/components/_apply-bar.scss | 3 +- .../src/sass/public/components/_button.scss | 15 +- .../src/sass/public/components/_editor.scss | 4 +- .../src/sass/public/components/_filters.scss | 2 +- .../src/sass/public/components/_form.scss | 97 +- .../src/sass/public/components/_icon.scss | 6 +- .../src/sass/public/components/_link.scss | 2 +- .../components/_list_straight_left.scss | 6 +- .../sass/public/components/_media-box.scss | 5 +- .../src/sass/public/components/_nav.scss | 6 +- .../src/sass/public/components/_page-box.scss | 10 +- .../sass/public/components/_rich-text.scss | 5 +- .../src/sass/public/components/_select2.scss | 16 +- .../src/sass/public/components/_table.scss | 4 +- .../src/sass/public/layout/_footer.scss | 10 +- .../src/sass/public/layout/_header.scss | 11 +- hypha/static_src/src/sass/public/main.scss | 90 +- hypha/static_src/src/tailwind/base/forms.css | 3 +- .../src/tailwind/base/variables.css | 8 +- .../src/tailwind/components/choices.css | 4 +- .../tailwind/components/daterangepicker.css | 456 +- hypha/storage_backends.py | 16 +- hypha/templates/404.html | 8 +- hypha/templates/base-apply.html | 68 +- hypha/templates/base.html | 94 +- hypha/templates/blocks/apply_link_block.html | 6 +- .../django/forms/widgets/input_option.html | 2 +- .../django/forms/widgets/number.html | 26 +- hypha/templates/includes/pagination.html | 26 +- hypha/templates/includes/relatedcontent.html | 50 +- .../includes/relatedcontent_card.html | 40 +- hypha/templates/includes/share.html | 8 +- hypha/templates/includes/sprites.html | 2 +- hypha/templates/styleguide.html | 350 +- hypha/urls.py | 47 +- mkdocs.yml | 26 +- package-lock.json | 12268 ++++++++-------- package.json | 164 +- 1093 files changed, 109259 insertions(+), 29530 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 02bfa91d01..6db2c3b2e8 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,44 +1,44 @@ -name-template: '$RESOLVED_VERSION' -tag-template: 'v$RESOLVED_VERSION' +name-template: "$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" version-resolver: major: labels: - - 'Type: Major' - - 'major' + - "Type: Major" + - "major" minor: labels: - - 'Type: Minor' - - 'minor' + - "Type: Minor" + - "minor" patch: labels: - - 'Type: Patch' - - 'patch' + - "Type: Patch" + - "patch" default: patch categories: - - title: '🚀 Features' - labels: - - 'Type: Feature' - - 'feature' - - title: '⚙️ Enhancements' - labels: - - 'Type: Enhancement' - - 'enhancement' - - title: '🐛 Bug Fixes' - labels: - - 'Type: Bug' - - 'fix' - - 'bugfix' - - 'bug' - - title: '🔧 Maintenance' - labels: - - 'Type: Maintenance' - - 'Type: Dependencies' - - 'dependencies' - - 'maintenance' - - title: '📜 Documentation' - labels: - - 'Type: Documentation' - - 'documentation' + - title: "🚀 Features" + labels: + - "Type: Feature" + - "feature" + - title: "⚙️ Enhancements" + labels: + - "Type: Enhancement" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "Type: Bug" + - "fix" + - "bugfix" + - "bug" + - title: "🔧 Maintenance" + labels: + - "Type: Maintenance" + - "Type: Dependencies" + - "dependencies" + - "maintenance" + - title: "📜 Documentation" + labels: + - "Type: Documentation" + - "documentation" template: | ## Changes diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 05c1c7ede3..914ecbbdfa 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,10 +14,10 @@ name: "CodeQL" on: push: - branches: [ main, test ] + branches: [main, test] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] jobs: analyze: @@ -25,14 +25,14 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: javascript, python + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: javascript, python - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index cddd4eebec..fc0e89bc60 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -5,8 +5,8 @@ on: branches: - main paths: - - 'docs/**' - - 'mkdocs.yml' + - "docs/**" + - "mkdocs.yml" concurrency: group: deploy diff --git a/.github/workflows/hypha-ci.yml b/.github/workflows/hypha-ci.yml index be7b3c820a..cf1cf594f6 100644 --- a/.github/workflows/hypha-ci.yml +++ b/.github/workflows/hypha-ci.yml @@ -1,4 +1,3 @@ - name: Hypha CI on: @@ -16,7 +15,7 @@ concurrency: env: NODE_VERSION: 18 - PYTHON_VERSION: '3.11' + PYTHON_VERSION: "3.11" jobs: build-fe: @@ -26,7 +25,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} - cache: 'npm' + cache: "npm" - name: install node dependencies run: npm install --quiet - name: builds static assets @@ -41,8 +40,8 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - cache: 'pip' - cache-dependency-path: '**/requirements*.txt' + cache: "pip" + cache-dependency-path: "**/requirements*.txt" - name: install python dependencies run: | python3 -m venv venv @@ -58,7 +57,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} - cache: 'npm' + cache: "npm" - name: install node dependencies run: npm install --quiet - name: run scss and js linting @@ -100,8 +99,8 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - cache: 'pip' - cache-dependency-path: '**/requirements*.txt' + cache: "pip" + cache-dependency-path: "**/requirements*.txt" - uses: codecov/codecov-action@v3 - name: install python dependencies run: | diff --git a/.jscsrc b/.jscsrc index eaa85c0fa5..1830e1e278 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,14 +1,10 @@ { "validateIndentation": 4, - "requireSpaceBeforeKeywords": [ - "else", - "while", - "catch" - ], + "requireSpaceBeforeKeywords": ["else", "while", "catch"], "disallowMultipleVarDecl": { "allExcept": ["undefined"] }, "fileExtensions": [".js"], - "preset":"airbnb", + "preset": "airbnb", "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties" -} \ No newline at end of file +} diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml index 28d863bec9..60f9853d68 100644 --- a/.stylelintrc.yaml +++ b/.stylelintrc.yaml @@ -31,10 +31,10 @@ rules: max-nesting-depth: - 4 - ignoreAtRules: - - each - - media - - supports - - include + - each + - media + - supports + - include media-feature-name-no-vendor-prefix: true media-feature-range-notation: prefix no-descending-specificity: null @@ -43,14 +43,14 @@ rules: rule-empty-line-before: - always-multi-line - except: - - first-nested + - first-nested ignore: - - after-comment + - after-comment scss/at-extend-no-missing-placeholder: true scss/at-function-pattern: "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$" scss/at-import-no-partial-leading-underscore: true scss/at-import-partial-extension-blacklist: - - scss + - scss scss/at-mixin-pattern: "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$" scss/at-rule-no-unknown: true scss/comment-no-empty: null diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ebdcaab8c5..b09131edc2 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,3 @@ { - "recommendations": [ - "njpwerner.autodocstring" - ] + "recommendations": ["njpwerner.autodocstring"] } diff --git a/.vscode/launch.json b/.vscode/launch.json index 1a82eb43a2..8fadbd175b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,19 +1,16 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python: Django", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/manage.py", - "args": [ - "runserver", - "0.0.0.0:9001" - ], - "django": true - } - ] + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Django", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/manage.py", + "args": ["runserver", "0.0.0.0:9001"], + "django": true + } + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index f24ba4be3c..06d6178f35 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,11 @@ { - "makefile.extensionOutputFolder": "./.vscode", - "cSpell.words": [ - "Anymail", - "coreutils", - "modelcluster", - "pagedown", - "WAGTAILADMIN", - "wagtailcore" - ] + "makefile.extensionOutputFolder": "./.vscode", + "cSpell.words": [ + "Anymail", + "coreutils", + "modelcluster", + "pagedown", + "WAGTAILADMIN", + "wagtailcore" + ] } diff --git a/addressfield/fields.py b/addressfield/fields.py index 052bd49b01..5c872c90bf 100644 --- a/addressfield/fields.py +++ b/addressfield/fields.py @@ -8,13 +8,18 @@ basepath = path.dirname(__file__) filepath = path.abspath(path.join(basepath, "static", "addressfield.min.json")) -with open(filepath, encoding='utf8') as address_data: - countries = json.load(address_data)['options'] +with open(filepath, encoding="utf8") as address_data: + countries = json.load(address_data)["options"] -VALIDATION_DATA = {country['iso']: country for country in countries} +VALIDATION_DATA = {country["iso"]: country for country in countries} ADDRESS_FIELDS_ORDER = [ - 'thoroughfare', 'premise', 'localityname', 'administrativearea', 'postalcode', 'country' + "thoroughfare", + "premise", + "localityname", + "administrativearea", + "postalcode", + "country", ] @@ -35,22 +40,27 @@ class AddressField(forms.CharField): The field stores the address in a flattened form, so the locality components are on the same level as country or premise """ + widget = AddressWidget data = VALIDATION_DATA def clean(self, value, **kwargs): - country = value['country'] + country = value["country"] try: country_data = self.data[country] except KeyError: - raise ValidationError('Invalid country selected') from None + raise ValidationError("Invalid country selected") from None - fields = flatten_data(country_data['fields']) + fields = flatten_data(country_data["fields"]) - missing_fields = set(country_data['required']) - {field for field, value in value.items() if value} + missing_fields = set(country_data["required"]) - { + field for field, value in value.items() if value + } if missing_fields: - missing_field_name = [fields[field]['label'] for field in missing_fields] - raise ValidationError('Please provide data for: {}'.format(', '.join(missing_field_name))) + missing_field_name = [fields[field]["label"] for field in missing_fields] + raise ValidationError( + "Please provide data for: {}".format(", ".join(missing_field_name)) + ) return super().clean(value, **kwargs) diff --git a/addressfield/static/address_form.js b/addressfield/static/address_form.js index dd240bbc32..34dd405a31 100644 --- a/addressfield/static/address_form.js +++ b/addressfield/static/address_form.js @@ -1,10 +1,10 @@ (function ($) { // add the require attribute to the field configs - function addRequiredToKey(fields, findKey){ + function addRequiredToKey(fields, findKey) { $.each(fields, (index, value) => { var fieldName = Object.keys(value)[0]; var data = value[fieldName]; - if (fieldName===findKey) { + if (fieldName === findKey) { data.required = true; } else if (Array.isArray(data)) { // Handle nested fields @@ -13,10 +13,9 @@ }); } - // hook into the transform to update with the required attribute var oldTransform = $.fn.addressfield.transform; - $.fn.addressfield.transform = function(data) { + $.fn.addressfield.transform = function (data) { var mappedData = oldTransform.call(this, data); $.each(mappedData, (key, value) => { $.each(value.required, (index, field) => { @@ -26,27 +25,27 @@ return mappedData; }; - function labelFor(field){ - return $('label[for="'+ $(field).attr('id') +'"]'); + function labelFor(field) { + return $('label[for="' + $(field).attr("id") + '"]'); } - function makeFieldNotRequired(field){ + function makeFieldNotRequired(field) { var $field = $(field); - $field.removeAttr('required'); + $field.removeAttr("required"); var $label = labelFor($field); - $label.children('span').remove(); + $label.children("span").remove(); } - function makeFieldRequired(field){ + function makeFieldRequired(field) { var $field = $(field); - $field.prop('required', true); + $field.prop("required", true); var $label = labelFor($field); $label.append('*'); } // Hook into the validate process to update the required display var oldValidate = $.fn.addressfield.validate; - $.fn.addressfield.validate = function(field, config) { + $.fn.addressfield.validate = function (field, config) { if (config.required) { makeFieldRequired(this); } else { @@ -59,7 +58,7 @@ // Hook into the select builder to update the display var oldConvertToSelect = $.fn.addressfield.convertToSelect; - $.fn.addressfield.convertToSelect = function() { + $.fn.addressfield.convertToSelect = function () { var $select = oldConvertToSelect.call(this); $select.wrap(selectWrap); return $select; @@ -67,16 +66,16 @@ // Hook into the text builder to update the display var oldConvertToText = $.fn.addressfield.convertToText; - $.fn.addressfield.convertToText = function() { + $.fn.addressfield.convertToText = function () { var $text = oldConvertToText.call(this); $text.unwrap(); return $text; }; $(document).ready(function formReady() { - $('.form div.address').each(function() { - $('.form div#' + this.id).addressfield({ - json: '/static/addressfield.min.json', + $(".form div.address").each(function () { + $(".form div#" + this.id).addressfield({ + json: "/static/addressfield.min.json", fields: { country: ".country", thoroughfare: ".thoroughfare", @@ -84,9 +83,9 @@ locality: ".locality", localityname: ".localityname", administrativearea: ".administrativearea", - postalcode: ".postalcode" - } + postalcode: ".postalcode", + }, }); - }) + }); }); })(jQuery); diff --git a/addressfield/static/addressfield.min.json b/addressfield/static/addressfield.min.json index b9af099e0e..293ff9f831 100644 --- a/addressfield/static/addressfield.min.json +++ b/addressfield/static/addressfield.min.json @@ -1 +1,5033 @@ -{"label":"Country","options":[{"label":"Afghanistan","iso":"AF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"1001"}}]}],"required":["localityname","thoroughfare"]},{"label":"Aland Islands","iso":"AX","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code","format":"^22\\d{3}$","eg":"22150"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Albania","iso":"AL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Algeria","iso":"DZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"American Samoa","iso":"AS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Andorra","iso":"AD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Angola","iso":"AO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Anguilla","iso":"AI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Antarctica","iso":"AQ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Antigua and Barbuda","iso":"AG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Argentina","iso":"AR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^((?:[A-HJ-NP-Z])?\\d{4})([A-Z]{3})?$","eg":"B1921"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"B":"Buenos Aires"},{"K":"Catamarca"},{"H":"Chaco"},{"U":"Chubut"},{"C":"Ciudad de Buenos Aires"},{"X":"C\u00f3rdoba"},{"W":"Corrientes"},{"E":"Entre R\u00edos"},{"P":"Formosa"},{"Y":"Jujuy"},{"L":"La Pampa"},{"F":"La Rioja"},{"M":"Mendoza"},{"N":"Misiones"},{"Q":"Neuqu\u00e9n"},{"R":"R\u00edo Negro"},{"A":"Salta"},{"J":"San Juan"},{"D":"San Luis"},{"Z":"Santa Cruz"},{"S":"Santa Fe"},{"G":"Santiago del Estero"},{"V":"Tierra del Fuego"},{"T":"Tucum\u00e1n"}]}}]}],"required":["localityname","thoroughfare"]},{"label":"Armenia","iso":"AM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","thoroughfare"]},{"label":"Aruba","iso":"AW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Australia","iso":"AU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City/suburb"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"ACT":"Australian Capital Territory"},{"NSW":"New South Wales"},{"NT":"Northern Territory"},{"QLD":"Queensland"},{"SA":"South Australia"},{"TAS":"Tasmania"},{"VIC":"Victoria"},{"WA":"Western Australia"}]}},{"postalcode":{"label":"Postcode","format":"^\\d{4}$","eg":"2000"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Austria","iso":"AT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"3741"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Azerbaijan","iso":"AZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bahamas","iso":"BS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bahrain","iso":"BH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bangladesh","iso":"BD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Barbados","iso":"BB","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Belarus","iso":"BY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","thoroughfare"]},{"label":"Belgium","iso":"BE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"4000"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Belize","iso":"BZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}}]}],"required":["localityname","thoroughfare"]},{"label":"Benin","iso":"BJ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bermuda","iso":"BM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bhutan","iso":"BT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bolivia","iso":"BO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bosnia and Herzegovina","iso":"BA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Botswana","iso":"BW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bouvet Island","iso":"BV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Brazil","iso":"BR","fields":[{"thoroughfare":{"label":"Thoroughfare"}},{"premise":{"label":"Complement"}},{"locality":[{"dependent_localityname":{"label":"Neighborhood"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"AC":"Acre"},{"AL":"Alagoas"},{"AM":"Amazonas"},{"AP":"Amapa"},{"BA":"Bahia"},{"CE":"Ceara"},{"DF":"Distrito Federal"},{"ES":"Espirito Santo"},{"GO":"Goias"},{"MA":"Maranhao"},{"MG":"Minas Gerais"},{"MS":"Mato Grosso do Sul"},{"MT":"Mato Grosso"},{"PA":"Para"},{"PB":"Paraiba"},{"PE":"Pernambuco"},{"PI":"Piaui"},{"PR":"Parana"},{"RJ":"Rio de Janeiro"},{"RN":"Rio Grande do Norte"},{"RO":"Rondonia"},{"RR":"Roraima"},{"RS":"Rio Grande do Sul"},{"SC":"Santa Catarina"},{"SE":"Sergipe"},{"SP":"Sao Paulo"},{"TO":"Tocantins"}]}},{"postalcode":{"label":"Postal code","format":"^\\d{5}[\\-]?\\d{3}$","eg":"10025-345"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"British Indian Ocean Territory","iso":"IO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"British Virgin Islands","iso":"VG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Brunei","iso":"BN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Bulgaria","iso":"BG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Burkina Faso","iso":"BF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Burundi","iso":"BI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cambodia","iso":"KH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cameroon","iso":"CM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Canada","iso":"CA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"AB":"Alberta"},{"BC":"British Columbia"},{"MB":"Manitoba"},{"NB":"New Brunswick"},{"NL":"Newfoundland"},{"NT":"Northwest Territories"},{"NS":"Nova Scotia"},{"NU":"Nunavut"},{"ON":"Ontario"},{"PE":"Prince Edward Island"},{"QC":"Quebec"},{"SK":"Saskatchewan"},{"YT":"Yukon Territory"}]}},{"postalcode":{"label":"Postal code","format":"^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z][ ]?\\d[ABCEGHJ-NPRSTV-Z]\\d$","eg":"K1A 0B1"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Cape Verde","iso":"CV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cayman Islands","iso":"KY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"administrativearea":{"label":"Island"}}]}],"required":["administrativearea","thoroughfare"]},{"label":"Central African Republic","iso":"CF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Chad","iso":"TD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Chile","iso":"CL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"AI":"Ays\u00e9n del General Carlos Ib\u00e1\u00f1ez del Campo"},{"AN":"Antofagasta"},{"AR":"Araucan\u00eda"},{"AP":"Arica y Parinacota"},{"AT":"Atacama"},{"BI":"Biob\u00edo"},{"CO":"Coquimbo"},{"LI":"Libertador General Bernardo O'Higgins"},{"LL":"Los Lagos"},{"LR":"Los R\u00edos"},{"MA":"Magallanes y de la Ant\u00e1rtica Chilena"},{"ML":"Maule"},{"RM":"Metropolitana de Santiago"},{"TA":"Tarapac\u00e1"},{"VS":"Valpara\u00edso"}]}}]}],"required":["localityname","thoroughfare"]},{"label":"China","iso":"CN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"District"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"BJ":"Beijing"},{"SH":"Shanghai"},{"GD":"Guangdong"},{"TJ":"Tianjin"},{"HE":"Hebei"},{"SX":"Shanxi"},{"NM":"Inner Mongolia"},{"LN":"Liaoning"},{"JL":"Jilin"},{"HL":"Heilongjiang"},{"JS":"Jiangsu"},{"ZJ":"Zhejiang"},{"AH":"Anhui"},{"FJ":"Fujian"},{"JX":"Jiangxi"},{"SD":"Shandong"},{"HA":"Henan"},{"HB":"Hubei"},{"HN":"Hunan"},{"GX":"Guangxi"},{"HI":"Hainan"},{"CQ":"Chongqing"},{"SC":"Sichuan"},{"GZ":"Guizhou"},{"YN":"Yunnan"},{"XZ":"Tibet"},{"SN":"Shaanxi"},{"GS":"Gansu"},{"QH":"Qinghai"},{"NX":"Ningxia Hui"},{"XJ":"Xinjiang Uyghur"}]}},{"postalcode":{"label":"Postal code","format":"^\\d{6}$","eg":"101200"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Christmas Island","iso":"CX","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cocos (Keeling) Islands","iso":"CC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Colombia","iso":"CO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Comoros","iso":"KM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Congo (Brazzaville)","iso":"CG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Congo (Kinshasa)","iso":"CD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cook Islands","iso":"CK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Costa Rica","iso":"CR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cuba","iso":"CU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Croatia","iso":"HR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cura\u00c1ao","iso":"CW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Cyprus","iso":"CY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Czech Republic","iso":"CZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Denmark","iso":"DK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"8660"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Djibouti","iso":"DJ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Dominica","iso":"DM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Dominican Republic","iso":"DO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}}]}],"required":["localityname","thoroughfare"]},{"label":"Ecuador","iso":"EC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Egypt","iso":"EG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Governorate","options":[{"":"--"},{"ALX":"Alexandria"},{"ASN":"Aswan"},{"AST":"Asyut"},{"BH":"Beheira"},{"BNS":"Beni Suef"},{"C":"Cairo"},{"DK":"Dakahlia"},{"DT":"Damietta"},{"FYM":"Faiyum"},{"GH":"Gharbia"},{"GZ":"Giza"},{"IS":"Ismailia"},{"KFS":"Kafr el-Sheikh"},{"MT":"Matruh"},{"MN":"Minya"},{"MNF":"Monufia"},{"WAD":"New Valley"},{"SIN":"North Sinai"},{"PTS":"Port Said"},{"KB":"Qalyubia"},{"KN":"Qena"},{"BA":"Red Sea"},{"SHR":"Sharqia"},{"SHG":"Sohag"},{"JS":"South Sinai"},{"SUZ":"Suez"},{"LX":"Luxor"}]}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"El Salvador","iso":"SV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Equatorial Guinea","iso":"GQ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Eritrea","iso":"ER","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Estonia","iso":"EE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Ethiopia","iso":"ET","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Falkland Islands","iso":"FK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Faroe Islands","iso":"FO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Fiji","iso":"FJ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}}]}],"required":["localityname","thoroughfare"]},{"label":"Finland","iso":"FI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{5}$","eg":"00550"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"France","iso":"FR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{2}[ ]?\\d{3}$","eg":"75002"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"French Guiana","iso":"GF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78]3\\d{2}$","eg":"97300"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"French Polynesia","iso":"PF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"French Southern Territories","iso":"TF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Gabon","iso":"GA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Gambia","iso":"GM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Georgia","iso":"GE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Germany","iso":"DE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{5}$","eg":"60322"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Ghana","iso":"GH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Gibraltar","iso":"GI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Greece","iso":"GR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{3} ?\\d{2}$","eg":"151 24"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Greenland","iso":"GL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^39\\d{2}$","eg":"3911"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Grenada","iso":"GD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Guadeloupe","iso":"GP","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78][01]\\d{2}$","eg":"97100"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Guam","iso":"GU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Guatemala","iso":"GT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Guernsey","iso":"GG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^GY\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}$","eg":"GY1 1AA"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Guinea","iso":"GN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Guinea-Bissau","iso":"GW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Guyana","iso":"GY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Haiti","iso":"HT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Heard Island and McDonald Islands","iso":"HM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Honduras","iso":"HN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Hong Kong S.A.R., China","iso":"HK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"District"}},{"administrativearea":{"label":"Area","options":[{"":"--"},{"Kowloon":"Kowloon"},{"Hong Kong Island":"Hong Kong Island"},{"New Territories":"New Territories"}]}}]}],"required":["administrativearea","thoroughfare"]},{"label":"Hungary","iso":"HU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Iceland","iso":"IS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"India","iso":"IN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"AP":"Andhra Pradesh"},{"AR":"Arunachal Pradesh"},{"AS":"Assam"},{"BR":"Bihar"},{"CT":"Chhattisgarh"},{"GA":"Goa"},{"GJ":"Gujarat"},{"HR":"Haryana"},{"HP":"Himachal Pradesh"},{"JK":"Jammu and Kashmir"},{"JH":"Jharkhand"},{"KA":"Karnataka"},{"KL":"Kerala"},{"MP":"Madhya Pradesh"},{"MH":"Maharashtra"},{"MN":"Manipur"},{"ML":"Meghalaya"},{"MZ":"Mizoram"},{"NL":"Nagaland"},{"OR":"Odisha"},{"PB":"Punjab"},{"RJ":"Rajasthan"},{"SK":"Sikkim"},{"TN":"Tamil Nadu"},{"TR":"Tripura"},{"UP":"Uttar Pradesh"},{"UT":"Uttarakhand"},{"WB":"West Bengal"},{"":"--"},{"AN":"Andaman and Nicobar Islands"},{"CH":"Chandigarh"},{"DN":"Dadra and Nagar Haveli"},{"DD":"Daman and Diu"},{"LD":"Lakshadweep"},{"DL":"National Capital Territory of Delhi"},{"PY":"Puducherry"}]}},{"postalcode":{"label":"PIN code","format":"^\\d{6}$","eg":"110005"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Indonesia","iso":"ID","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City/regency"}},{"postalcode":{"label":"Postal code"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"AC":"Aceh"},{"BA":"Bali"},{"BB":"Bangka Belitung"},{"BT":"Banten"},{"BE":"Bengkulu"},{"JK":"DKI Jakarta"},{"YO":"D.I. Yogyakarta"},{"GO":"Gorontalo"},{"JA":"Jambi"},{"JB":"Jawa Barat"},{"JT":"Jawa Tengah"},{"JI":"Jawa Timur"},{"KB":"Kalimantan Barat"},{"KS":"Kalimantan Selatan"},{"KT":"Kalimantan Tengah"},{"KI":"Kalimantan Timur"},{"KR":"Kepulauan Riau"},{"LA":"Lampung"},{"MA":"Maluku"},{"MU":"Maluku Utara"},{"NB":"Nusa Tenggara Barat"},{"NT":"Nusa Tenggara Timur"},{"PA":"Papua"},{"PB":"Papua Barat"},{"RI":"Riau"},{"SR":"Sulawesi Barat"},{"SN":"Sulawesi Selatan"},{"ST":"Sulawesi Tengah"},{"SG":"Sulawesi Tenggara"},{"SA":"Sulawesi Utara"},{"SB":"Sumatera Barat"},{"SS":"Sumatera Selatan"},{"SU":"Sumatera Utara"}]}}]}],"required":["localityname","thoroughfare"]},{"label":"Iran","iso":"IR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"Neighborhood"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Iraq","iso":"IQ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Ireland","iso":"IE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"Town/city"}},{"administrativearea":{"label":"County","options":[{"":"--"},{"CW":"Co Carlow"},{"CN":"Co Cavan"},{"CE":"Co Clare"},{"CO":"Co Cork"},{"DL":"Co Donegal"},{"D":"Co Dublin"},{"D1":"Dublin 1"},{"D2":"Dublin 2"},{"D3":"Dublin 3"},{"D4":"Dublin 4"},{"D5":"Dublin 5"},{"D6":"Dublin 6"},{"D6W":"Dublin 6w"},{"D7":"Dublin 7"},{"D8":"Dublin 8"},{"D9":"Dublin 9"},{"D10":"Dublin 10"},{"D11":"Dublin 11"},{"D12":"Dublin 12"},{"D13":"Dublin 13"},{"D14":"Dublin 14"},{"D15":"Dublin 15"},{"D16":"Dublin 16"},{"D17":"Dublin 17"},{"D18":"Dublin 18"},{"D19":"Dublin 19"},{"D20":"Dublin 20"},{"D21":"Dublin 21"},{"D22":"Dublin 22"},{"D23":"Dublin 23"},{"D24":"Dublin 24"},{"G":"Co Galway"},{"KY":"Co Kerry"},{"KE":"Co Kildare"},{"KK":"Co Kilkenny"},{"LS":"Co Laois"},{"LM":"Co Leitrim"},{"LK":"Co Limerick"},{"LD":"Co Longford"},{"LH":"Co Louth"},{"MO":"Co Mayo"},{"MH":"Co Meath"},{"MN":"Co Monaghan"},{"OY":"Co Offaly"},{"RN":"Co Roscommon"},{"SO":"Co Sligo"},{"TA":"Co Tipperary"},{"WD":"Co Waterford"},{"WH":"Co Westmeath"},{"WX":"Co Wexford"},{"WW":"Co Wicklow"}]}}]}],"required":["localityname","thoroughfare"]},{"label":"Isle of Man","iso":"IM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^IM\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}$","eg":"IM99 1PS"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Israel","iso":"IL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Italy","iso":"IT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"AG":"Agrigento"},{"AL":"Alessandria"},{"AN":"Ancona"},{"AO":"Valle d'Aosta/Vall\u00c8e d'Aoste"},{"AP":"Ascoli Piceno"},{"AQ":"L'Aquila"},{"AR":"Arezzo"},{"AT":"Asti"},{"AV":"Avellino"},{"BA":"Bari"},{"BG":"Bergamo"},{"BI":"Biella"},{"BL":"Belluno"},{"BN":"Benevento"},{"BO":"Bologna"},{"BR":"Brindisi"},{"BS":"Brescia"},{"BT":"Barletta-Andria-Trani"},{"BZ":"Bolzano/Bozen"},{"CA":"Cagliari"},{"CB":"Campobasso"},{"CE":"Caserta"},{"CH":"Chieti"},{"CI":"Carbonia-Iglesias"},{"CL":"Caltanissetta"},{"CN":"Cuneo"},{"CO":"Como"},{"CR":"Cremona"},{"CS":"Cosenza"},{"CT":"Catania"},{"CZ":"Catanzaro"},{"EN":"Enna"},{"FC":"Forl\u00cf-Cesena"},{"FE":"Ferrara"},{"FG":"Foggia"},{"FI":"Firenze"},{"FM":"Fermo"},{"FR":"Frosinone"},{"GE":"Genova"},{"GO":"Gorizia"},{"GR":"Grosseto"},{"IM":"Imperia"},{"IS":"Isernia"},{"KR":"Crotone"},{"LC":"Lecco"},{"LE":"Lecce"},{"LI":"Livorno"},{"LO":"Lodi"},{"LT":"Latina"},{"LU":"Lucca"},{"MB":"Monza e Brianza"},{"MC":"Macerata"},{"ME":"Messina"},{"MI":"Milano"},{"MN":"Mantova"},{"MO":"Modena"},{"MS":"Massa-Carrara"},{"MT":"Matera"},{"NA":"Napoli"},{"NO":"Novara"},{"NU":"Nuoro"},{"OG":"Ogliastra"},{"OR":"Oristano"},{"OT":"Olbia-Tempio"},{"PA":"Palermo"},{"PC":"Piacenza"},{"PD":"Padova"},{"PE":"Pescara"},{"PG":"Perugia"},{"PI":"Pisa"},{"PN":"Pordenone"},{"PO":"Prato"},{"PR":"Parma"},{"PT":"Pistoia"},{"PU":"Pesaro e Urbino"},{"PV":"Pavia"},{"PZ":"Potenza"},{"RA":"Ravenna"},{"RC":"Reggio di Calabria"},{"RE":"Reggio nell'Emilia"},{"RG":"Ragusa"},{"RI":"Rieti"},{"RM":"Roma"},{"RN":"Rimini"},{"RO":"Rovigo"},{"SA":"Salerno"},{"SI":"Siena"},{"SO":"Sondrio"},{"SP":"La Spezia"},{"SR":"Siracusa"},{"SS":"Sassari"},{"SV":"Savona"},{"TA":"Taranto"},{"TE":"Teramo"},{"TN":"Trento"},{"TO":"Torino"},{"TP":"Trapani"},{"TR":"Terni"},{"TS":"Trieste"},{"TV":"Treviso"},{"UD":"Udine"},{"VA":"Varese"},{"VB":"Verbano-Cusio-Ossola"},{"VC":"Vercelli"},{"VE":"Venezia"},{"VI":"Vicenza"},{"VR":"Verona"},{"VS":"Medio Campidano"},{"VT":"Viterbo"},{"VV":"Vibo Valentia"}]}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Ivory Coast","iso":"CI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Jamaica","iso":"JM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Parish","options":[{"":"--"},{"Clarendon":"Clarendon"},{"Hanover":"Hanover"},{"Kingston":"Kingston"},{"Manchester":"Manchester"},{"Portland":"Portland"},{"St. Andrew":"St. Andrew"},{"St. Ann":"St. Ann"},{"St. Catherine":"St. Catherine"},{"St. Elizabeth":"St. Elizabeth"},{"St. James":"St. James"},{"St. Mary":"St. Mary"},{"St. Thomas":"St. Thomas"},{"Trelawny":"Trelawny"},{"Westmoreland":"Westmoreland"}]}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Japan","iso":"JP","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{3}-?\\d{4}$","eg":"142-0062"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Prefecture","options":[{"":"--"},{"Hokkaido":"Hokkaido"},{"Aomori":"Aomori"},{"Iwate":"Iwate"},{"Miyagi":"Miyagi"},{"Akita":"Akita"},{"Yamagata":"Yamagata"},{"Fukushima":"Fukushima"},{"Ibaraki":"Ibaraki"},{"Tochigi":"Tochigi"},{"Gunma":"Gunma"},{"Saitama":"Saitama"},{"Chiba":"Chiba"},{"Tokyo":"Tokyo"},{"Kanagawa":"Kanagawa"},{"Niigata":"Niigata"},{"Toyama":"Toyama"},{"Ishikawa":"Ishikawa"},{"Fukui":"Fukui"},{"Yamanashi":"Yamanashi"},{"Nagano":"Nagano"},{"Gifu":"Gifu"},{"Shizuoka":"Shizuoka"},{"Aichi":"Aichi"},{"Mie":"Mie"},{"Shiga":"Shiga"},{"Kyoto":"Kyoto"},{"Osaka":"Osaka"},{"Hyogo":"Hyogo"},{"Nara":"Nara"},{"Wakayama":"Wakayama"},{"Tottori":"Tottori"},{"Shimane":"Shimane"},{"Okayama":"Okayama"},{"Hiroshima":"Hiroshima"},{"Yamaguchi":"Yamaguchi"},{"Tokushima":"Tokushima"},{"Kagawa":"Kagawa"},{"Ehime":"Ehime"},{"Kochi":"Kochi"},{"Fukuoka":"Fukuoka"},{"Saga":"Saga"},{"Nagasaki":"Nagasaki"},{"Kumamoto":"Kumamoto"},{"Oita":"Oita"},{"Miyazaki":"Miyazaki"},{"Kagoshima":"Kagoshima"},{"Okinawa":"Okinawa"}]}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Jersey","iso":"JE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^JE\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}$","eg":"JE2 2BT"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Jordan","iso":"JO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Kazakhstan","iso":"KZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Kenya","iso":"KE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Kiribati","iso":"KI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island"}}]}],"required":["localityname","thoroughfare"]},{"label":"Kosovo","iso":"KV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Kuwait","iso":"KW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}}]}],"required":["localityname","thoroughfare"]},{"label":"Kyrgyzstan","iso":"KG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Laos","iso":"LA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Latvia","iso":"LV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Lebanon","iso":"LB","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Lesotho","iso":"LS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Liberia","iso":"LR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Libya","iso":"LY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Liechtenstein","iso":"LI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^(948[5-9])|(949[0-7])$","eg":"9496"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Lithuania","iso":"LT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Luxembourg","iso":"LU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"4750"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Macao S.A.R., China","iso":"MO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Macedonia","iso":"MK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Madagascar","iso":"MG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Malawi","iso":"MW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Malaysia","iso":"MY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"Village/township"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"Johor":"Johor"},{"Kedah":"Kedah"},{"Kelantan":"Kelantan"},{"Kuala Lumpur":"Kuala Lumpur"},{"Labuan":"Labuan"},{"Melaka":"Melaka"},{"Negeri Sembilan":"Negeri Sembilan"},{"Pahang":"Pahang"},{"Perak":"Perak"},{"Perlis":"Perlis"},{"Pulau Pinang":"Pulau Pinang"},{"Putrajaya":"Putrajaya"},{"Sabah":"Sabah"},{"Sarawak":"Sarawak"},{"Selangor":"Selangor"},{"Terengganu":"Terengganu"}]}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Maldives","iso":"MV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Mali","iso":"ML","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Malta","iso":"MT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Marshall Islands","iso":"MH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Martinique","iso":"MQ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78]2\\d{2}$","eg":"97220"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Mauritania","iso":"MR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Mauritius","iso":"MU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Mayotte","iso":"YT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^976\\d{2}$","eg":"97600"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Mexico","iso":"MX","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"Neighborhood"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"AGU":"Aguascalientes"},{"BCN":"Baja California"},{"BCS":"Baja California Sur"},{"CAM":"Campeche"},{"COA":"Coahuila"},{"COL":"Colima"},{"CHP":"Chiapas"},{"CHH":"Chihuahua"},{"DIF":"Distrito Federal"},{"DUG":"Durango"},{"MEX":"Estado de M\u00e9xico"},{"GUA":"Guanajuato"},{"GRO":"Guerrero"},{"HID":"Hidalgo"},{"JAL":"Jalisco"},{"MIC":"Michoac\u00e1n"},{"MOR":"Morelos"},{"NAY":"Nayarit"},{"NLE":"Nuevo Le\u00f3n"},{"OAX":"Oaxaca"},{"PUE":"Puebla"},{"QUE":"Queretaro"},{"ROO":"Quintana Roo"},{"SLP":"San Luis Potos\u00ed"},{"SIN":"Sinaloa"},{"SON":"Sonora"},{"TAB":"Tabasco"},{"TAM":"Tamaulipas"},{"TLA":"Tlaxcala"},{"VER":"Veracruz"},{"YUC":"Yucat\u00e1n"},{"ZAC":"Zacatecas"}]}},{"postalcode":{"label":"Postal code","format":"^\\d{5}$","eg":"03400"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Micronesia","iso":"FM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Moldova","iso":"MD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Monaco","iso":"MC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Mongolia","iso":"MN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Montenegro","iso":"ME","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Montserrat","iso":"MS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Morocco","iso":"MA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Mozambique","iso":"MZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","thoroughfare"]},{"label":"Myanmar","iso":"MM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Namibia","iso":"NA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Nauru","iso":"NR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"administrativearea":{"label":"District"}}]}],"required":["administrativearea","thoroughfare"]},{"label":"Nepal","iso":"NP","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Netherlands","iso":"NL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}[ ]?[A-Z]{2}$","eg":"2585 GJ"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Netherlands Antilles","iso":"AN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"New Caledonia","iso":"NC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^988\\d{2}$","eg":"98814"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"New Zealand","iso":"NZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"Town/city"}},{"administrativearea":{"label":"Region","options":[{"":"--"},{"AUK":"Auckland"},{"BOP":"Bay of Plenty"},{"CAN":"Canterbury"},{"HKB":"Hawke's Bay"},{"MWT":"Manawatu-Wanganui"},{"NTL":"Northland"},{"OTA":"Otago"},{"STL":"Southland"},{"TKI":"Taranaki"},{"WKO":"Waikato"},{"WGN":"Wellington"},{"WTC":"West Coast"},{"GIS":"Gisborne District"},{"MBH":"Marlborough District"},{"NSN":"Nelson"},{"TAS":"Tasman District"},{"CIT":"Chatham Islands Territory"}]}},{"postalcode":{"label":"Postcode"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Nicaragua","iso":"NI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Department"}}]}],"required":["localityname","thoroughfare"]},{"label":"Niger","iso":"NE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Nigeria","iso":"NG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Niue","iso":"NU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Norfolk Island","iso":"NF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Northern Mariana Islands","iso":"MP","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"North Korea","iso":"KP","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Norway","iso":"NO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"0025"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Oman","iso":"OM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}},{"administrativearea":{"label":"State"}}]}],"required":["localityname","thoroughfare"]},{"label":"Pakistan","iso":"PK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Palau","iso":"PW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Palestinian Territory","iso":"PS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Panama","iso":"PA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","thoroughfare"]},{"label":"Papua New Guinea","iso":"PG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Paraguay","iso":"PY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Peru","iso":"PE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"administrativearea":{"label":"Region","options":[{"":"--"},{"AMA":"Amazonas"},{"ANC":"Ancash"},{"APU":"Apurimac"},{"ARE":"Arequipa"},{"AYA":"Ayacucho"},{"CAJ":"Cajamarca"},{"CAL":"Callao"},{"CUS":"Cusco"},{"HUV":"Huancavelica"},{"HUC":"Huanuco"},{"ICA":"Ica"},{"JUN":"Junin"},{"LAL":"La Libertad"},{"LAM":"Lambayeque"},{"LIM":"Lima"},{"LOR":"Loreto"},{"MDD":"Madre de Dios"},{"MOQ":"Moquegua"},{"PAS":"Pasco"},{"PIU":"Piura"},{"PUN":"Puno"},{"SAM":"San Martin"},{"TAC":"Tacna"},{"TUM":"Tumbes"},{"UCA":"Ucayali"}]}},{"localityname":{"label":"District"}}]}],"required":["localityname","thoroughfare"]},{"label":"Philippines","iso":"PH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"Suburb"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Pitcairn","iso":"PN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Poland","iso":"PL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{2}-?\\d{3}$","eg":"00-950"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Portugal","iso":"PT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}-?\\d{3}$","eg":"2725-079"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Puerto Rico","iso":"PR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Qatar","iso":"QA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Reunion","iso":"RE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78]4\\d{2}$","eg":"97400"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Romania","iso":"RO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Russia","iso":"RU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"MOW":"Moskva"},{"SPE":"Sankt-Peterburg"},{"AD":"Adygeya, Respublika"},{"AL":"Altay, Respublika"},{"BA":"Bashkortostan, Respublika"},{"BU":"Buryatiya, Respublika"},{"CE":"Chechenskaya Respublika"},{"CU":"Chuvashskaya Respublika"},{"DA":"Dagestan, Respublika"},{"IN":"Ingushetiya, Respublika"},{"KB":"Kabardino-Balkarskaya Respublika"},{"KL":"Kalmykiya, Respublika"},{"KC":"Karachayevo-Cherkesskaya Respublika"},{"KR":"Kareliya, Respublika"},{"KK":"Khakasiya, Respublika"},{"KO":"Komi, Respublika"},{"ME":"Mariy El, Respublika"},{"MO":"Mordoviya, Respublika"},{"SA":"Sakha, Respublika [Yakutiya]"},{"SE":"Severnaya Osetiya-Alaniya, Respublika"},{"TA":"Tatarstan, Respublika"},{"TY":"Tyva, Respublika [Tuva]"},{"UD":"Udmurtskaya Respublika"},{"ALT":"Altayskiy kray"},{"KAM":"Kamchatskiy kray"},{"KHA":"Khabarovskiy kray"},{"KDA":"Krasnodarskiy kray"},{"KYA":"Krasnoyarskiy kray"},{"PER":"Permskiy kray"},{"PRI":"Primorskiy kray"},{"STA":"Stavropolskiy kray"},{"ZAB":"Zabaykalskiy kray"},{"AMU":"Amurskaya oblast"},{"ARK":"Arkhangelskaya oblast"},{"AST":"Astrakhanskaya oblast"},{"BEL":"Belgorodskaya oblast"},{"BRY":"Bryanskaya oblast"},{"CHE":"Chelyabinskaya oblast"},{"IRK":"Irkutskaya oblast"},{"IVA":"Ivanovskaya oblast"},{"KGD":"Kaliningradskaya oblast"},{"KLU":"Kaluzhskaya oblast"},{"KEM":"Kemerovskaya oblast"},{"KIR":"Kirovskaya oblast"},{"KOS":"Kostromskaya oblast"},{"KGN":"Kurganskaya oblast"},{"KRS":"Kurskaya oblast"},{"LEN":"Leningradskaya oblast"},{"LIP":"Lipetskaya oblast"},{"MAG":"Magadanskaya oblast"},{"MOS":"Moskovskaya oblast"},{"MUR":"Murmanskaya oblast"},{"NIZ":"Nizhegorodskaya oblast"},{"NGR":"Novgorodskaya oblast"},{"NVS":"Novosibirskaya oblast"},{"OMS":"Omskaya oblast"},{"ORE":"Orenburgskaya oblast"},{"ORL":"Orlovskaya oblast"},{"PNZ":"Penzenskaya oblast"},{"PSK":"Pskovskaya oblast"},{"ROS":"Rostovskaya oblast"},{"RYA":"Ryazanskaya oblast"},{"SAK":"Sakhalinskaya oblast"},{"SAM":"Samarskaya oblast"},{"SAR":"Saratovskaya oblast"},{"SMO":"Smolenskaya oblast"},{"SVE":"Sverdlovskaya oblast"},{"TAM":"Tambovskaya oblast"},{"TOM":"Tomskaya oblast"},{"TUL":"Tulskaya oblast"},{"TVE":"Tverskaya oblast"},{"TYU":"Tyumenskaya oblast"},{"ULY":"Ulyanovskaya oblast"},{"VLA":"Vladimirskaya oblast"},{"VGG":"Volgogradskaya oblast"},{"VLG":"Vologodskaya oblast"},{"VOR":"Voronezhskaya oblast"},{"YAR":"Yaroslavskaya oblast"},{"YEV":"Yevreyskaya avtonomnaya oblast"},{"CHU":"Chukotskiy avtonomnyy okrug"},{"KHM":"Khanty-Mansiyskiy avtonomnyy okrug-Yugra"},{"NEN":"Nenetskiy avtonomnyy okrug"},{"YAN":"Yamalo-Nenetskiy avtonomnyy okrug"}]}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Rwanda","iso":"RW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Saint Barth\u00c8lemy","iso":"BL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78][01]\\d{2}$","eg":"97100"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Saint Helena","iso":"SH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^(ASCN|STHL)[ ]?1ZZ$","eg":"STHL 1ZZ"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Saint Kitts and Nevis","iso":"KN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Saint Lucia","iso":"LC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Saint Martin (French part)","iso":"MF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78][01]\\d{2}$","eg":"97100"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Saint Pierre and Miquelon","iso":"PM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^9[78]5\\d{2}$","eg":"97500"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Saint Vincent and the Grenadines","iso":"VC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Samoa","iso":"WS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"San Marino","iso":"SM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["postalcode","thoroughfare"]},{"label":"Sao Tome and Principe","iso":"ST","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Saudi Arabia","iso":"SA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Senegal","iso":"SN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Serbia","iso":"RS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Seychelles","iso":"SC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island"}}]}],"required":["localityname","thoroughfare"]},{"label":"Sierra Leone","iso":"SL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Singapore","iso":"SG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code","format":"^\\d{6}$","eg":"238880"}}]}],"required":["postalcode","thoroughfare"]},{"label":"Slovakia","iso":"SK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Slovenia","iso":"SI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Solomon Islands","iso":"SB","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Somalia","iso":"SO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"South Africa","iso":"ZA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"Eastern Cape":"Eastern Cape"},{"Free State":"Free State"},{"Gauteng":"Gauteng"},{"KwaZulu-Natal":"KwaZulu-Natal"},{"Limpopo":"Limpopo"},{"Mpumalanga":"Mpumalanga"},{"North West":"North West"},{"Northern Cape":"Northern Cape"},{"Western Cape":"Western Cape"}]}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"South Georgia and the South Sandwich Islands","iso":"GS","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"South Korea","iso":"KR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"District"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"Seoul":"Seoul"},{"Busan":"Busan"},{"Daegu":"Daegu"},{"Daejeon":"Daejeon"},{"Gwangju":"Gwangju"},{"Incheon":"Incheon"},{"Ulsan":"Ulsan"},{"Chungcheongbuk-do":"Chungcheongbuk-do"},{"Chungcheongnam-do":"Chungcheongnam-do"},{"Gangwon-do":"Gangwon-do"},{"Gyeonggi-do":"Gyeonggi-do"},{"Gyeongsangbuk-do":"Gyeongsangbuk-do"},{"Gyeongsangnam-do":"Gyeongsangnam-do"},{"Jeju-do":"Jeju-do"},{"Jeollabuk-do":"Jeollabuk-do"},{"Jeollanam-do":"Jeollanam-do"},{"Sejong":"Sejong"}]}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Spain","iso":"ES","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"C":"A Coru\u00f1a"},{"VI":"Alava"},{"AB":"Albacete"},{"A":"Alicante"},{"AL":"Almer\u00eda"},{"O":"Asturias"},{"AV":"\u00c1vila"},{"BA":"Badajoz"},{"PM":"Baleares"},{"B":"Barcelona"},{"BU":"Burgos"},{"CC":"C\u00e1ceres"},{"CA":"C\u00e1diz"},{"S":"Cantabria"},{"CS":"Castell\u00f3n"},{"CE":"Ceuta"},{"CR":"Ciudad Real"},{"CO":"C\u00f3rdoba"},{"CU":"Cuenca"},{"GI":"Gerona"},{"GR":"Granada"},{"GU":"Guadalajara"},{"SS":"Guip\u00fazcoa"},{"H":"Huelva"},{"HU":"Huesca"},{"J":"Ja\u00e9n"},{"LO":"La Rioja"},{"GC":"Las Palmas"},{"LE":"Le\u00f3n"},{"L":"L\u00e9rida"},{"LU":"Lugo"},{"M":"Madrid"},{"MA":"M\u00e1laga"},{"ML":"Melilla"},{"MU":"Murcia"},{"NA":"Navarra"},{"OR":"Ourense"},{"P":"Palencia"},{"PO":"Pontevedra"},{"SA":"Salamanca"},{"TF":"Santa Cruz de Tenerife"},{"SG":"Segovia"},{"SE":"Sevilla"},{"SO":"Soria"},{"T":"Tarragona"},{"TE":"Teruel"},{"TO":"Toledo"},{"V":"Valencia"},{"VA":"Valladolid"},{"BI":"Vizcaya"},{"ZA":"Zamora"},{"Z":"Zaragoza"}]}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Sri Lanka","iso":"LK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Sudan","iso":"SD","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Suriname","iso":"SR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}}]}],"required":["localityname","thoroughfare"]},{"label":"Svalbard and Jan Mayen","iso":"SJ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"9170"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Swaziland","iso":"SZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Sweden","iso":"SE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{3}[ ]?\\d{2}$","eg":"11455"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Switzerland","iso":"CH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{4}$","eg":"2544"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Syria","iso":"SY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Taiwan","iso":"TW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^\\d{3}(\\d{2})?$","eg":"100"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"TXG":"Taichung City"},{"TPE":"Taipei City"},{"TTT":"Taitung County"},{"TNN":"Tainan City"},{"ILA":"Yilan County"},{"HUA":"Hualien County"},{"Kinmen County":"Kinmen County"},{"NAN":"Nantou County"},{"PIF":"Pingtung County"},{"MIA":"Miaoli County"},{"TAO":"Taoyuan County"},{"KHH":"Kaohsiung City"},{"KEE":"Keelung City"},{"Lienchiang County":"Lienchiang County"},{"YUN":"Yunlin County"},{"TPQ":"New Taipei City"},{"HSZ":"Hsinchu City"},{"HSQ":"Hsinchu County"},{"CYI":"Chiayi City"},{"CYQ":"Chiayi County"},{"CHA":"Changhua County"},{"PEN":"Penghu County"}]}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Tajikistan","iso":"TJ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Tanzania","iso":"TZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Thailand","iso":"TH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"dependent_localityname":{"label":"Suburb"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"Province"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Timor-Leste","iso":"TL","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Togo","iso":"TG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Tokelau","iso":"TK","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Tonga","iso":"TO","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Trinidad and Tobago","iso":"TT","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Tunisia","iso":"TN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Turkey","iso":"TR","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"administrativearea":{"label":"Province","options":[{"":"--"},{"Adana":"Adana"},{"Ad\u0131yaman":"Ad\u0131yaman"},{"Afyon":"Afyon"},{"A\u011fr\u0131":"A\u011fr\u0131"},{"Aksaray":"Aksaray"},{"Amasya":"Amasya"},{"Ankara":"Ankara"},{"Antalya":"Antalya"},{"Ardahan":"Ardahan"},{"Artvin":"Artvin"},{"Ayd\u0131n":"Ayd\u0131n"},{"Bal\u0131kesir":"Bal\u0131kesir"},{"Bart\u0131n":"Bart\u0131n"},{"Batman":"Batman"},{"Bayburt":"Bayburt"},{"Bilecik":"Bilecik"},{"Bing\u00f6l":"Bing\u00f6l"},{"Bitlis":"Bitlis"},{"Bolu":"Bolu"},{"Burdur":"Burdur"},{"Bursa":"Bursa"},{"\u00c7anakkale":"\u00c7anakkale"},{"\u00c7ank\u0131r\u0131":"\u00c7ank\u0131r\u0131"},{"\u00c7orum":"\u00c7orum"},{"Denizli":"Denizli"},{"Diyarbak\u0131r":"Diyarbak\u0131r"},{"D\u00fczce":"D\u00fczce"},{"Edirne":"Edirne"},{"Elaz\u0131\u011f":"Elaz\u0131\u011f"},{"Erzincan":"Erzincan"},{"Erzurum":"Erzurum"},{"Eski\u015fehir":"Eski\u015fehir"},{"Gaziantep":"Gaziantep"},{"Giresun":"Giresun"},{"G\u00fcm\u00fc\u015fhane":"G\u00fcm\u00fc\u015fhane"},{"Hakkari":"Hakkari"},{"Hatay":"Hatay"},{"I\u011fd\u0131r":"I\u011fd\u0131r"},{"Isparta":"Isparta"},{"\u0130stanbul":"\u0130stanbul"},{"\u0130zmir":"\u0130zmir"},{"Kahramanmara\u015f":"Kahramanmara\u015f"},{"Karab\u00fck":"Karab\u00fck"},{"Karaman":"Karaman"},{"Kars":"Kars"},{"Kastamonu":"Kastamonu"},{"Kayseri":"Kayseri"},{"K\u0131r\u0131kkale":"K\u0131r\u0131kkale"},{"K\u0131rklareli":"K\u0131rklareli"},{"K\u0131r\u015fehir":"K\u0131r\u015fehir"},{"Kilis":"Kilis"},{"Kocaeli":"Kocaeli"},{"Konya":"Konya"},{"K\u00fctahya":"K\u00fctahya"},{"Malatya":"Malatya"},{"Manisa":"Manisa"},{"Mardin":"Mardin"},{"Mersin":"Mersin"},{"Mu\u011fla":"Mu\u011fla"},{"Mu\u015f":"Mu\u015f"},{"Nev\u015fehir":"Nev\u015fehir"},{"Ni\u011fde":"Ni\u011fde"},{"Ordu":"Ordu"},{"Osmaniye":"Osmaniye"},{"Rize":"Rize"},{"Sakarya":"Sakarya"},{"Samsun":"Samsun"},{"Siirt":"Siirt"},{"Sinop":"Sinop"},{"Sivas":"Sivas"},{"\u015eanl\u0131urfa":"\u015eanl\u0131urfa"},{"\u015e\u0131rnak":"\u015e\u0131rnak"},{"Tekirda\u011f":"Tekirda\u011f"},{"Tokat":"Tokat"},{"Trabzon":"Trabzon"},{"Tunceli":"Tunceli"},{"U\u015fak":"U\u015fak"},{"Van":"Van"},{"Yalova":"Yalova"},{"Yozgat":"Yozgat"},{"Zonguldak":"Zonguldak"}]}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Turkmenistan","iso":"TM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Turks and Caicos Islands","iso":"TC","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Tuvalu","iso":"TV","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Island","options":[{"":"--"},{"Funafuti":"Funafuti"},{"Funafuti Centre":"Funafuti Centre"},{"Nanumaga":"Nanumaga"},{"Nanumea":"Nanumea"},{"Niulakita":"Niulakita"},{"Niutao":"Niutao"},{"Nui":"Nui"},{"Nukulaelae":"Nukulaelae"},{"Vaitupu":"Vaitupu"}]}}]}],"required":["localityname","thoroughfare"]},{"label":"U.S. Virgin Islands","iso":"VI","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"Uganda","iso":"UG","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Ukraine","iso":"UA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"Region"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"United Arab Emirates","iso":"AE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"administrativearea":{"label":"Emirate","options":[{"":"--"},{"AZ":"Abu Dhabi"},{"FU":"Fujairah"},{"UQ":"Umm al-Quwain"},{"SH":"Sharjah"},{"DU":"Dubai"},{"RK":"Ras al-Khaimah"},{"AJ":"Ajm\u0101n"}]}}]}],"required":["administrativearea","thoroughfare"]},{"label":"United Kingdom","iso":"GB","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"Town/city"}},{"administrativearea":{"label":"County"}},{"postalcode":{"label":"Postcode","format":"^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\\d{1,4}$","eg":"SE1 0SU"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"United States","iso":"US","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"AL":"Alabama"},{"AK":"Alaska"},{"AZ":"Arizona"},{"AR":"Arkansas"},{"CA":"California"},{"CO":"Colorado"},{"CT":"Connecticut"},{"DE":"Delaware"},{"DC":"District Of Columbia"},{"FL":"Florida"},{"GA":"Georgia"},{"HI":"Hawaii"},{"ID":"Idaho"},{"IL":"Illinois"},{"IN":"Indiana"},{"IA":"Iowa"},{"KS":"Kansas"},{"KY":"Kentucky"},{"LA":"Louisiana"},{"ME":"Maine"},{"MD":"Maryland"},{"MA":"Massachusetts"},{"MI":"Michigan"},{"MN":"Minnesota"},{"MS":"Mississippi"},{"MO":"Missouri"},{"MT":"Montana"},{"NE":"Nebraska"},{"NV":"Nevada"},{"NH":"New Hampshire"},{"NJ":"New Jersey"},{"NM":"New Mexico"},{"NY":"New York"},{"NC":"North Carolina"},{"ND":"North Dakota"},{"OH":"Ohio"},{"OK":"Oklahoma"},{"OR":"Oregon"},{"PA":"Pennsylvania"},{"RI":"Rhode Island"},{"SC":"South Carolina"},{"SD":"South Dakota"},{"TN":"Tennessee"},{"TX":"Texas"},{"UT":"Utah"},{"VT":"Vermont"},{"VA":"Virginia"},{"WA":"Washington"},{"WV":"West Virginia"},{"WI":"Wisconsin"},{"WY":"Wyoming"},{"":"--"},{"AA":"Armed Forces (Americas)"},{"AE":"Armed Forces (Europe, Canada, Middle East, Africa)"},{"AP":"Armed Forces (Pacific)"},{"AS":"American Samoa"},{"FM":"Federated States of Micronesia"},{"GU":"Guam"},{"MH":"Marshall Islands"},{"MP":"Northern Mariana Islands"},{"PW":"Palau"},{"PR":"Puerto Rico"},{"VI":"Virgin Islands"}]}},{"postalcode":{"label":"ZIP code","format":"^\\d{5}(?:[-\\s]\\d{4})?$","eg":"98103"}}]}],"required":["localityname","administrativearea","postalcode","thoroughfare"]},{"label":"United States Minor Outlying Islands","iso":"UM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"ZIP code"}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Uruguay","iso":"UY","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}}]}],"required":["localityname","thoroughfare"]},{"label":"Uzbekistan","iso":"UZ","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Vanuatu","iso":"VU","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Vatican","iso":"VA","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Venezuela","iso":"VE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}},{"administrativearea":{"label":"State","options":[{"":"--"},{"Z":"Amazonas"},{"B":"Anzo\u00e1tegui"},{"C":"Apure"},{"D":"Aragua"},{"E":"Barinas"},{"F":"Bol\u00edvar"},{"G":"Carabobo"},{"H":"Cojedes"},{"Y":"Delta Amacuro"},{"W":"Dependencias Federales"},{"A":"Distrito Federal"},{"I":"Falc\u00f3n"},{"J":"Gu\u00e1rico"},{"K":"Lara"},{"L":"M\u00e9rida"},{"M":"Miranda"},{"N":"Monagas"},{"O":"Nueva Esparta"},{"P":"Portuguesa"},{"R":"Sucre"},{"S":"T\u00e1chira"},{"T":"Trujillo"},{"X":"Vargas"},{"U":"Yaracuy"},{"V":"Zulia"}]}}]}],"required":["localityname","administrativearea","thoroughfare"]},{"label":"Vietnam","iso":"VN","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}},{"administrativearea":{"label":"State"}},{"postalcode":{"label":"Postal code"}}]}],"required":["localityname","thoroughfare"]},{"label":"Wallis and Futuna","iso":"WF","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code","format":"^986\\d{2}$","eg":"98600"}},{"localityname":{"label":"City"}}]}],"required":["localityname","postalcode","thoroughfare"]},{"label":"Western Sahara","iso":"EH","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Yemen","iso":"YE","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Zambia","iso":"ZM","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"postalcode":{"label":"Postal code"}},{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]},{"label":"Zimbabwe","iso":"ZW","fields":[{"thoroughfare":{"label":"Address 1"}},{"premise":{"label":"Address 2"}},{"locality":[{"localityname":{"label":"City"}}]}],"required":["localityname","thoroughfare"]}]} +{ + "label": "Country", + "options": [ + { + "label": "Afghanistan", + "iso": "AF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "1001" + } + } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Aland Islands", + "iso": "AX", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "postalcode": { + "label": "Postal code", + "format": "^22\\d{3}$", + "eg": "22150" + } + } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Albania", + "iso": "AL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Algeria", + "iso": "DZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "American Samoa", + "iso": "AS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Andorra", + "iso": "AD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Angola", + "iso": "AO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Anguilla", + "iso": "AI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Antarctica", + "iso": "AQ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Antigua and Barbuda", + "iso": "AG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Argentina", + "iso": "AR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^((?:[A-HJ-NP-Z])?\\d{4})([A-Z]{3})?$", + "eg": "B1921" + } + }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "B": "Buenos Aires" }, + { "K": "Catamarca" }, + { "H": "Chaco" }, + { "U": "Chubut" }, + { "C": "Ciudad de Buenos Aires" }, + { "X": "C\u00f3rdoba" }, + { "W": "Corrientes" }, + { "E": "Entre R\u00edos" }, + { "P": "Formosa" }, + { "Y": "Jujuy" }, + { "L": "La Pampa" }, + { "F": "La Rioja" }, + { "M": "Mendoza" }, + { "N": "Misiones" }, + { "Q": "Neuqu\u00e9n" }, + { "R": "R\u00edo Negro" }, + { "A": "Salta" }, + { "J": "San Juan" }, + { "D": "San Luis" }, + { "Z": "Santa Cruz" }, + { "S": "Santa Fe" }, + { "G": "Santiago del Estero" }, + { "V": "Tierra del Fuego" }, + { "T": "Tucum\u00e1n" } + ] + } + } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Armenia", + "iso": "AM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Aruba", + "iso": "AW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Australia", + "iso": "AU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City/suburb" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "ACT": "Australian Capital Territory" }, + { "NSW": "New South Wales" }, + { "NT": "Northern Territory" }, + { "QLD": "Queensland" }, + { "SA": "South Australia" }, + { "TAS": "Tasmania" }, + { "VIC": "Victoria" }, + { "WA": "Western Australia" } + ] + } + }, + { + "postalcode": { + "label": "Postcode", + "format": "^\\d{4}$", + "eg": "2000" + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Austria", + "iso": "AT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "3741" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Azerbaijan", + "iso": "AZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bahamas", + "iso": "BS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bahrain", + "iso": "BH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bangladesh", + "iso": "BD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Barbados", + "iso": "BB", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Belarus", + "iso": "BY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Belgium", + "iso": "BE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "4000" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Belize", + "iso": "BZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Benin", + "iso": "BJ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bermuda", + "iso": "BM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bhutan", + "iso": "BT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bolivia", + "iso": "BO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bosnia and Herzegovina", + "iso": "BA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Botswana", + "iso": "BW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bouvet Island", + "iso": "BV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Brazil", + "iso": "BR", + "fields": [ + { "thoroughfare": { "label": "Thoroughfare" } }, + { "premise": { "label": "Complement" } }, + { + "locality": [ + { "dependent_localityname": { "label": "Neighborhood" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "AC": "Acre" }, + { "AL": "Alagoas" }, + { "AM": "Amazonas" }, + { "AP": "Amapa" }, + { "BA": "Bahia" }, + { "CE": "Ceara" }, + { "DF": "Distrito Federal" }, + { "ES": "Espirito Santo" }, + { "GO": "Goias" }, + { "MA": "Maranhao" }, + { "MG": "Minas Gerais" }, + { "MS": "Mato Grosso do Sul" }, + { "MT": "Mato Grosso" }, + { "PA": "Para" }, + { "PB": "Paraiba" }, + { "PE": "Pernambuco" }, + { "PI": "Piaui" }, + { "PR": "Parana" }, + { "RJ": "Rio de Janeiro" }, + { "RN": "Rio Grande do Norte" }, + { "RO": "Rondonia" }, + { "RR": "Roraima" }, + { "RS": "Rio Grande do Sul" }, + { "SC": "Santa Catarina" }, + { "SE": "Sergipe" }, + { "SP": "Sao Paulo" }, + { "TO": "Tocantins" } + ] + } + }, + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{5}[\\-]?\\d{3}$", + "eg": "10025-345" + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "British Indian Ocean Territory", + "iso": "IO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "British Virgin Islands", + "iso": "VG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Brunei", + "iso": "BN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Bulgaria", + "iso": "BG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Burkina Faso", + "iso": "BF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Burundi", + "iso": "BI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cambodia", + "iso": "KH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cameroon", + "iso": "CM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Canada", + "iso": "CA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "AB": "Alberta" }, + { "BC": "British Columbia" }, + { "MB": "Manitoba" }, + { "NB": "New Brunswick" }, + { "NL": "Newfoundland" }, + { "NT": "Northwest Territories" }, + { "NS": "Nova Scotia" }, + { "NU": "Nunavut" }, + { "ON": "Ontario" }, + { "PE": "Prince Edward Island" }, + { "QC": "Quebec" }, + { "SK": "Saskatchewan" }, + { "YT": "Yukon Territory" } + ] + } + }, + { + "postalcode": { + "label": "Postal code", + "format": "^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z][ ]?\\d[ABCEGHJ-NPRSTV-Z]\\d$", + "eg": "K1A 0B1" + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Cape Verde", + "iso": "CV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cayman Islands", + "iso": "KY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": ["administrativearea", "thoroughfare"] + }, + { + "label": "Central African Republic", + "iso": "CF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Chad", + "iso": "TD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Chile", + "iso": "CL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { + "AI": "Ays\u00e9n del General Carlos Ib\u00e1\u00f1ez del Campo" + }, + { "AN": "Antofagasta" }, + { "AR": "Araucan\u00eda" }, + { "AP": "Arica y Parinacota" }, + { "AT": "Atacama" }, + { "BI": "Biob\u00edo" }, + { "CO": "Coquimbo" }, + { "LI": "Libertador General Bernardo O'Higgins" }, + { "LL": "Los Lagos" }, + { "LR": "Los R\u00edos" }, + { "MA": "Magallanes y de la Ant\u00e1rtica Chilena" }, + { "ML": "Maule" }, + { "RM": "Metropolitana de Santiago" }, + { "TA": "Tarapac\u00e1" }, + { "VS": "Valpara\u00edso" } + ] + } + } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "China", + "iso": "CN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "District" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "BJ": "Beijing" }, + { "SH": "Shanghai" }, + { "GD": "Guangdong" }, + { "TJ": "Tianjin" }, + { "HE": "Hebei" }, + { "SX": "Shanxi" }, + { "NM": "Inner Mongolia" }, + { "LN": "Liaoning" }, + { "JL": "Jilin" }, + { "HL": "Heilongjiang" }, + { "JS": "Jiangsu" }, + { "ZJ": "Zhejiang" }, + { "AH": "Anhui" }, + { "FJ": "Fujian" }, + { "JX": "Jiangxi" }, + { "SD": "Shandong" }, + { "HA": "Henan" }, + { "HB": "Hubei" }, + { "HN": "Hunan" }, + { "GX": "Guangxi" }, + { "HI": "Hainan" }, + { "CQ": "Chongqing" }, + { "SC": "Sichuan" }, + { "GZ": "Guizhou" }, + { "YN": "Yunnan" }, + { "XZ": "Tibet" }, + { "SN": "Shaanxi" }, + { "GS": "Gansu" }, + { "QH": "Qinghai" }, + { "NX": "Ningxia Hui" }, + { "XJ": "Xinjiang Uyghur" } + ] + } + }, + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{6}$", + "eg": "101200" + } + } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Christmas Island", + "iso": "CX", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cocos (Keeling) Islands", + "iso": "CC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Colombia", + "iso": "CO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Comoros", + "iso": "KM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Congo (Brazzaville)", + "iso": "CG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Congo (Kinshasa)", + "iso": "CD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cook Islands", + "iso": "CK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Costa Rica", + "iso": "CR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cuba", + "iso": "CU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Croatia", + "iso": "HR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cura\u00c1ao", + "iso": "CW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Cyprus", + "iso": "CY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Czech Republic", + "iso": "CZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Denmark", + "iso": "DK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "8660" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Djibouti", + "iso": "DJ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Dominica", + "iso": "DM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Dominican Republic", + "iso": "DO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Ecuador", + "iso": "EC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Egypt", + "iso": "EG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Governorate", + "options": [ + { "": "--" }, + { "ALX": "Alexandria" }, + { "ASN": "Aswan" }, + { "AST": "Asyut" }, + { "BH": "Beheira" }, + { "BNS": "Beni Suef" }, + { "C": "Cairo" }, + { "DK": "Dakahlia" }, + { "DT": "Damietta" }, + { "FYM": "Faiyum" }, + { "GH": "Gharbia" }, + { "GZ": "Giza" }, + { "IS": "Ismailia" }, + { "KFS": "Kafr el-Sheikh" }, + { "MT": "Matruh" }, + { "MN": "Minya" }, + { "MNF": "Monufia" }, + { "WAD": "New Valley" }, + { "SIN": "North Sinai" }, + { "PTS": "Port Said" }, + { "KB": "Qalyubia" }, + { "KN": "Qena" }, + { "BA": "Red Sea" }, + { "SHR": "Sharqia" }, + { "SHG": "Sohag" }, + { "JS": "South Sinai" }, + { "SUZ": "Suez" }, + { "LX": "Luxor" } + ] + } + }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "El Salvador", + "iso": "SV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Equatorial Guinea", + "iso": "GQ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Eritrea", + "iso": "ER", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Estonia", + "iso": "EE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Ethiopia", + "iso": "ET", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Falkland Islands", + "iso": "FK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Faroe Islands", + "iso": "FO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Fiji", + "iso": "FJ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Finland", + "iso": "FI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{5}$", + "eg": "00550" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "France", + "iso": "FR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{2}[ ]?\\d{3}$", + "eg": "75002" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "French Guiana", + "iso": "GF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78]3\\d{2}$", + "eg": "97300" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "French Polynesia", + "iso": "PF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "French Southern Territories", + "iso": "TF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Gabon", + "iso": "GA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Gambia", + "iso": "GM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Georgia", + "iso": "GE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Germany", + "iso": "DE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{5}$", + "eg": "60322" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Ghana", + "iso": "GH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Gibraltar", + "iso": "GI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "postalcode": { "label": "Postal code" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Greece", + "iso": "GR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{3} ?\\d{2}$", + "eg": "151 24" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Greenland", + "iso": "GL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^39\\d{2}$", + "eg": "3911" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Grenada", + "iso": "GD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Guadeloupe", + "iso": "GP", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78][01]\\d{2}$", + "eg": "97100" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Guam", + "iso": "GU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Guatemala", + "iso": "GT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Guernsey", + "iso": "GG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^GY\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}$", + "eg": "GY1 1AA" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Guinea", + "iso": "GN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Guinea-Bissau", + "iso": "GW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Guyana", + "iso": "GY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Haiti", + "iso": "HT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Heard Island and McDonald Islands", + "iso": "HM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Honduras", + "iso": "HN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Hong Kong S.A.R., China", + "iso": "HK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "District" } }, + { + "administrativearea": { + "label": "Area", + "options": [ + { "": "--" }, + { "Kowloon": "Kowloon" }, + { "Hong Kong Island": "Hong Kong Island" }, + { "New Territories": "New Territories" } + ] + } + } + ] + } + ], + "required": ["administrativearea", "thoroughfare"] + }, + { + "label": "Hungary", + "iso": "HU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Iceland", + "iso": "IS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "India", + "iso": "IN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "AP": "Andhra Pradesh" }, + { "AR": "Arunachal Pradesh" }, + { "AS": "Assam" }, + { "BR": "Bihar" }, + { "CT": "Chhattisgarh" }, + { "GA": "Goa" }, + { "GJ": "Gujarat" }, + { "HR": "Haryana" }, + { "HP": "Himachal Pradesh" }, + { "JK": "Jammu and Kashmir" }, + { "JH": "Jharkhand" }, + { "KA": "Karnataka" }, + { "KL": "Kerala" }, + { "MP": "Madhya Pradesh" }, + { "MH": "Maharashtra" }, + { "MN": "Manipur" }, + { "ML": "Meghalaya" }, + { "MZ": "Mizoram" }, + { "NL": "Nagaland" }, + { "OR": "Odisha" }, + { "PB": "Punjab" }, + { "RJ": "Rajasthan" }, + { "SK": "Sikkim" }, + { "TN": "Tamil Nadu" }, + { "TR": "Tripura" }, + { "UP": "Uttar Pradesh" }, + { "UT": "Uttarakhand" }, + { "WB": "West Bengal" }, + { "": "--" }, + { "AN": "Andaman and Nicobar Islands" }, + { "CH": "Chandigarh" }, + { "DN": "Dadra and Nagar Haveli" }, + { "DD": "Daman and Diu" }, + { "LD": "Lakshadweep" }, + { "DL": "National Capital Territory of Delhi" }, + { "PY": "Puducherry" } + ] + } + }, + { + "postalcode": { + "label": "PIN code", + "format": "^\\d{6}$", + "eg": "110005" + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Indonesia", + "iso": "ID", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City/regency" } }, + { "postalcode": { "label": "Postal code" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "AC": "Aceh" }, + { "BA": "Bali" }, + { "BB": "Bangka Belitung" }, + { "BT": "Banten" }, + { "BE": "Bengkulu" }, + { "JK": "DKI Jakarta" }, + { "YO": "D.I. Yogyakarta" }, + { "GO": "Gorontalo" }, + { "JA": "Jambi" }, + { "JB": "Jawa Barat" }, + { "JT": "Jawa Tengah" }, + { "JI": "Jawa Timur" }, + { "KB": "Kalimantan Barat" }, + { "KS": "Kalimantan Selatan" }, + { "KT": "Kalimantan Tengah" }, + { "KI": "Kalimantan Timur" }, + { "KR": "Kepulauan Riau" }, + { "LA": "Lampung" }, + { "MA": "Maluku" }, + { "MU": "Maluku Utara" }, + { "NB": "Nusa Tenggara Barat" }, + { "NT": "Nusa Tenggara Timur" }, + { "PA": "Papua" }, + { "PB": "Papua Barat" }, + { "RI": "Riau" }, + { "SR": "Sulawesi Barat" }, + { "SN": "Sulawesi Selatan" }, + { "ST": "Sulawesi Tengah" }, + { "SG": "Sulawesi Tenggara" }, + { "SA": "Sulawesi Utara" }, + { "SB": "Sumatera Barat" }, + { "SS": "Sumatera Selatan" }, + { "SU": "Sumatera Utara" } + ] + } + } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Iran", + "iso": "IR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "Neighborhood" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Iraq", + "iso": "IQ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Ireland", + "iso": "IE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "Town/city" } }, + { + "administrativearea": { + "label": "County", + "options": [ + { "": "--" }, + { "CW": "Co Carlow" }, + { "CN": "Co Cavan" }, + { "CE": "Co Clare" }, + { "CO": "Co Cork" }, + { "DL": "Co Donegal" }, + { "D": "Co Dublin" }, + { "D1": "Dublin 1" }, + { "D2": "Dublin 2" }, + { "D3": "Dublin 3" }, + { "D4": "Dublin 4" }, + { "D5": "Dublin 5" }, + { "D6": "Dublin 6" }, + { "D6W": "Dublin 6w" }, + { "D7": "Dublin 7" }, + { "D8": "Dublin 8" }, + { "D9": "Dublin 9" }, + { "D10": "Dublin 10" }, + { "D11": "Dublin 11" }, + { "D12": "Dublin 12" }, + { "D13": "Dublin 13" }, + { "D14": "Dublin 14" }, + { "D15": "Dublin 15" }, + { "D16": "Dublin 16" }, + { "D17": "Dublin 17" }, + { "D18": "Dublin 18" }, + { "D19": "Dublin 19" }, + { "D20": "Dublin 20" }, + { "D21": "Dublin 21" }, + { "D22": "Dublin 22" }, + { "D23": "Dublin 23" }, + { "D24": "Dublin 24" }, + { "G": "Co Galway" }, + { "KY": "Co Kerry" }, + { "KE": "Co Kildare" }, + { "KK": "Co Kilkenny" }, + { "LS": "Co Laois" }, + { "LM": "Co Leitrim" }, + { "LK": "Co Limerick" }, + { "LD": "Co Longford" }, + { "LH": "Co Louth" }, + { "MO": "Co Mayo" }, + { "MH": "Co Meath" }, + { "MN": "Co Monaghan" }, + { "OY": "Co Offaly" }, + { "RN": "Co Roscommon" }, + { "SO": "Co Sligo" }, + { "TA": "Co Tipperary" }, + { "WD": "Co Waterford" }, + { "WH": "Co Westmeath" }, + { "WX": "Co Wexford" }, + { "WW": "Co Wicklow" } + ] + } + } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Isle of Man", + "iso": "IM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^IM\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}$", + "eg": "IM99 1PS" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Israel", + "iso": "IL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Italy", + "iso": "IT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "AG": "Agrigento" }, + { "AL": "Alessandria" }, + { "AN": "Ancona" }, + { "AO": "Valle d'Aosta/Vall\u00c8e d'Aoste" }, + { "AP": "Ascoli Piceno" }, + { "AQ": "L'Aquila" }, + { "AR": "Arezzo" }, + { "AT": "Asti" }, + { "AV": "Avellino" }, + { "BA": "Bari" }, + { "BG": "Bergamo" }, + { "BI": "Biella" }, + { "BL": "Belluno" }, + { "BN": "Benevento" }, + { "BO": "Bologna" }, + { "BR": "Brindisi" }, + { "BS": "Brescia" }, + { "BT": "Barletta-Andria-Trani" }, + { "BZ": "Bolzano/Bozen" }, + { "CA": "Cagliari" }, + { "CB": "Campobasso" }, + { "CE": "Caserta" }, + { "CH": "Chieti" }, + { "CI": "Carbonia-Iglesias" }, + { "CL": "Caltanissetta" }, + { "CN": "Cuneo" }, + { "CO": "Como" }, + { "CR": "Cremona" }, + { "CS": "Cosenza" }, + { "CT": "Catania" }, + { "CZ": "Catanzaro" }, + { "EN": "Enna" }, + { "FC": "Forl\u00cf-Cesena" }, + { "FE": "Ferrara" }, + { "FG": "Foggia" }, + { "FI": "Firenze" }, + { "FM": "Fermo" }, + { "FR": "Frosinone" }, + { "GE": "Genova" }, + { "GO": "Gorizia" }, + { "GR": "Grosseto" }, + { "IM": "Imperia" }, + { "IS": "Isernia" }, + { "KR": "Crotone" }, + { "LC": "Lecco" }, + { "LE": "Lecce" }, + { "LI": "Livorno" }, + { "LO": "Lodi" }, + { "LT": "Latina" }, + { "LU": "Lucca" }, + { "MB": "Monza e Brianza" }, + { "MC": "Macerata" }, + { "ME": "Messina" }, + { "MI": "Milano" }, + { "MN": "Mantova" }, + { "MO": "Modena" }, + { "MS": "Massa-Carrara" }, + { "MT": "Matera" }, + { "NA": "Napoli" }, + { "NO": "Novara" }, + { "NU": "Nuoro" }, + { "OG": "Ogliastra" }, + { "OR": "Oristano" }, + { "OT": "Olbia-Tempio" }, + { "PA": "Palermo" }, + { "PC": "Piacenza" }, + { "PD": "Padova" }, + { "PE": "Pescara" }, + { "PG": "Perugia" }, + { "PI": "Pisa" }, + { "PN": "Pordenone" }, + { "PO": "Prato" }, + { "PR": "Parma" }, + { "PT": "Pistoia" }, + { "PU": "Pesaro e Urbino" }, + { "PV": "Pavia" }, + { "PZ": "Potenza" }, + { "RA": "Ravenna" }, + { "RC": "Reggio di Calabria" }, + { "RE": "Reggio nell'Emilia" }, + { "RG": "Ragusa" }, + { "RI": "Rieti" }, + { "RM": "Roma" }, + { "RN": "Rimini" }, + { "RO": "Rovigo" }, + { "SA": "Salerno" }, + { "SI": "Siena" }, + { "SO": "Sondrio" }, + { "SP": "La Spezia" }, + { "SR": "Siracusa" }, + { "SS": "Sassari" }, + { "SV": "Savona" }, + { "TA": "Taranto" }, + { "TE": "Teramo" }, + { "TN": "Trento" }, + { "TO": "Torino" }, + { "TP": "Trapani" }, + { "TR": "Terni" }, + { "TS": "Trieste" }, + { "TV": "Treviso" }, + { "UD": "Udine" }, + { "VA": "Varese" }, + { "VB": "Verbano-Cusio-Ossola" }, + { "VC": "Vercelli" }, + { "VE": "Venezia" }, + { "VI": "Vicenza" }, + { "VR": "Verona" }, + { "VS": "Medio Campidano" }, + { "VT": "Viterbo" }, + { "VV": "Vibo Valentia" } + ] + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Ivory Coast", + "iso": "CI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Jamaica", + "iso": "JM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Parish", + "options": [ + { "": "--" }, + { "Clarendon": "Clarendon" }, + { "Hanover": "Hanover" }, + { "Kingston": "Kingston" }, + { "Manchester": "Manchester" }, + { "Portland": "Portland" }, + { "St. Andrew": "St. Andrew" }, + { "St. Ann": "St. Ann" }, + { "St. Catherine": "St. Catherine" }, + { "St. Elizabeth": "St. Elizabeth" }, + { "St. James": "St. James" }, + { "St. Mary": "St. Mary" }, + { "St. Thomas": "St. Thomas" }, + { "Trelawny": "Trelawny" }, + { "Westmoreland": "Westmoreland" } + ] + } + } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Japan", + "iso": "JP", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{3}-?\\d{4}$", + "eg": "142-0062" + } + }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Prefecture", + "options": [ + { "": "--" }, + { "Hokkaido": "Hokkaido" }, + { "Aomori": "Aomori" }, + { "Iwate": "Iwate" }, + { "Miyagi": "Miyagi" }, + { "Akita": "Akita" }, + { "Yamagata": "Yamagata" }, + { "Fukushima": "Fukushima" }, + { "Ibaraki": "Ibaraki" }, + { "Tochigi": "Tochigi" }, + { "Gunma": "Gunma" }, + { "Saitama": "Saitama" }, + { "Chiba": "Chiba" }, + { "Tokyo": "Tokyo" }, + { "Kanagawa": "Kanagawa" }, + { "Niigata": "Niigata" }, + { "Toyama": "Toyama" }, + { "Ishikawa": "Ishikawa" }, + { "Fukui": "Fukui" }, + { "Yamanashi": "Yamanashi" }, + { "Nagano": "Nagano" }, + { "Gifu": "Gifu" }, + { "Shizuoka": "Shizuoka" }, + { "Aichi": "Aichi" }, + { "Mie": "Mie" }, + { "Shiga": "Shiga" }, + { "Kyoto": "Kyoto" }, + { "Osaka": "Osaka" }, + { "Hyogo": "Hyogo" }, + { "Nara": "Nara" }, + { "Wakayama": "Wakayama" }, + { "Tottori": "Tottori" }, + { "Shimane": "Shimane" }, + { "Okayama": "Okayama" }, + { "Hiroshima": "Hiroshima" }, + { "Yamaguchi": "Yamaguchi" }, + { "Tokushima": "Tokushima" }, + { "Kagawa": "Kagawa" }, + { "Ehime": "Ehime" }, + { "Kochi": "Kochi" }, + { "Fukuoka": "Fukuoka" }, + { "Saga": "Saga" }, + { "Nagasaki": "Nagasaki" }, + { "Kumamoto": "Kumamoto" }, + { "Oita": "Oita" }, + { "Miyazaki": "Miyazaki" }, + { "Kagoshima": "Kagoshima" }, + { "Okinawa": "Okinawa" } + ] + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Jersey", + "iso": "JE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^JE\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}$", + "eg": "JE2 2BT" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Jordan", + "iso": "JO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Kazakhstan", + "iso": "KZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Kenya", + "iso": "KE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Kiribati", + "iso": "KI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Kosovo", + "iso": "KV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Kuwait", + "iso": "KW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Kyrgyzstan", + "iso": "KG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Laos", + "iso": "LA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Latvia", + "iso": "LV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Lebanon", + "iso": "LB", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Lesotho", + "iso": "LS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Liberia", + "iso": "LR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Libya", + "iso": "LY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Liechtenstein", + "iso": "LI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^(948[5-9])|(949[0-7])$", + "eg": "9496" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Lithuania", + "iso": "LT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Luxembourg", + "iso": "LU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "4750" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Macao S.A.R., China", + "iso": "MO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Macedonia", + "iso": "MK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Madagascar", + "iso": "MG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Malawi", + "iso": "MW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Malaysia", + "iso": "MY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "Village/township" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "Johor": "Johor" }, + { "Kedah": "Kedah" }, + { "Kelantan": "Kelantan" }, + { "Kuala Lumpur": "Kuala Lumpur" }, + { "Labuan": "Labuan" }, + { "Melaka": "Melaka" }, + { "Negeri Sembilan": "Negeri Sembilan" }, + { "Pahang": "Pahang" }, + { "Perak": "Perak" }, + { "Perlis": "Perlis" }, + { "Pulau Pinang": "Pulau Pinang" }, + { "Putrajaya": "Putrajaya" }, + { "Sabah": "Sabah" }, + { "Sarawak": "Sarawak" }, + { "Selangor": "Selangor" }, + { "Terengganu": "Terengganu" } + ] + } + }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Maldives", + "iso": "MV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Mali", + "iso": "ML", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Malta", + "iso": "MT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Marshall Islands", + "iso": "MH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Martinique", + "iso": "MQ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78]2\\d{2}$", + "eg": "97220" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Mauritania", + "iso": "MR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Mauritius", + "iso": "MU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Mayotte", + "iso": "YT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^976\\d{2}$", + "eg": "97600" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Mexico", + "iso": "MX", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "Neighborhood" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "AGU": "Aguascalientes" }, + { "BCN": "Baja California" }, + { "BCS": "Baja California Sur" }, + { "CAM": "Campeche" }, + { "COA": "Coahuila" }, + { "COL": "Colima" }, + { "CHP": "Chiapas" }, + { "CHH": "Chihuahua" }, + { "DIF": "Distrito Federal" }, + { "DUG": "Durango" }, + { "MEX": "Estado de M\u00e9xico" }, + { "GUA": "Guanajuato" }, + { "GRO": "Guerrero" }, + { "HID": "Hidalgo" }, + { "JAL": "Jalisco" }, + { "MIC": "Michoac\u00e1n" }, + { "MOR": "Morelos" }, + { "NAY": "Nayarit" }, + { "NLE": "Nuevo Le\u00f3n" }, + { "OAX": "Oaxaca" }, + { "PUE": "Puebla" }, + { "QUE": "Queretaro" }, + { "ROO": "Quintana Roo" }, + { "SLP": "San Luis Potos\u00ed" }, + { "SIN": "Sinaloa" }, + { "SON": "Sonora" }, + { "TAB": "Tabasco" }, + { "TAM": "Tamaulipas" }, + { "TLA": "Tlaxcala" }, + { "VER": "Veracruz" }, + { "YUC": "Yucat\u00e1n" }, + { "ZAC": "Zacatecas" } + ] + } + }, + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{5}$", + "eg": "03400" + } + } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Micronesia", + "iso": "FM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Moldova", + "iso": "MD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Monaco", + "iso": "MC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Mongolia", + "iso": "MN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Montenegro", + "iso": "ME", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Montserrat", + "iso": "MS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Morocco", + "iso": "MA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Mozambique", + "iso": "MZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Myanmar", + "iso": "MM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Namibia", + "iso": "NA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Nauru", + "iso": "NR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "administrativearea": { "label": "District" } }] } + ], + "required": ["administrativearea", "thoroughfare"] + }, + { + "label": "Nepal", + "iso": "NP", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Netherlands", + "iso": "NL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}[ ]?[A-Z]{2}$", + "eg": "2585 GJ" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Netherlands Antilles", + "iso": "AN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "New Caledonia", + "iso": "NC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^988\\d{2}$", + "eg": "98814" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "New Zealand", + "iso": "NZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "Town/city" } }, + { + "administrativearea": { + "label": "Region", + "options": [ + { "": "--" }, + { "AUK": "Auckland" }, + { "BOP": "Bay of Plenty" }, + { "CAN": "Canterbury" }, + { "HKB": "Hawke's Bay" }, + { "MWT": "Manawatu-Wanganui" }, + { "NTL": "Northland" }, + { "OTA": "Otago" }, + { "STL": "Southland" }, + { "TKI": "Taranaki" }, + { "WKO": "Waikato" }, + { "WGN": "Wellington" }, + { "WTC": "West Coast" }, + { "GIS": "Gisborne District" }, + { "MBH": "Marlborough District" }, + { "NSN": "Nelson" }, + { "TAS": "Tasman District" }, + { "CIT": "Chatham Islands Territory" } + ] + } + }, + { "postalcode": { "label": "Postcode" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Nicaragua", + "iso": "NI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Department" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Niger", + "iso": "NE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Nigeria", + "iso": "NG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Niue", + "iso": "NU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Norfolk Island", + "iso": "NF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Northern Mariana Islands", + "iso": "MP", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "North Korea", + "iso": "KP", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Norway", + "iso": "NO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "0025" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Oman", + "iso": "OM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } }, + { "administrativearea": { "label": "State" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Pakistan", + "iso": "PK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Palau", + "iso": "PW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Palestinian Territory", + "iso": "PS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Panama", + "iso": "PA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Papua New Guinea", + "iso": "PG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Paraguay", + "iso": "PY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Peru", + "iso": "PE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { + "administrativearea": { + "label": "Region", + "options": [ + { "": "--" }, + { "AMA": "Amazonas" }, + { "ANC": "Ancash" }, + { "APU": "Apurimac" }, + { "ARE": "Arequipa" }, + { "AYA": "Ayacucho" }, + { "CAJ": "Cajamarca" }, + { "CAL": "Callao" }, + { "CUS": "Cusco" }, + { "HUV": "Huancavelica" }, + { "HUC": "Huanuco" }, + { "ICA": "Ica" }, + { "JUN": "Junin" }, + { "LAL": "La Libertad" }, + { "LAM": "Lambayeque" }, + { "LIM": "Lima" }, + { "LOR": "Loreto" }, + { "MDD": "Madre de Dios" }, + { "MOQ": "Moquegua" }, + { "PAS": "Pasco" }, + { "PIU": "Piura" }, + { "PUN": "Puno" }, + { "SAM": "San Martin" }, + { "TAC": "Tacna" }, + { "TUM": "Tumbes" }, + { "UCA": "Ucayali" } + ] + } + }, + { "localityname": { "label": "District" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Philippines", + "iso": "PH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "Suburb" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Pitcairn", + "iso": "PN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Poland", + "iso": "PL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{2}-?\\d{3}$", + "eg": "00-950" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Portugal", + "iso": "PT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}-?\\d{3}$", + "eg": "2725-079" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Puerto Rico", + "iso": "PR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Qatar", + "iso": "QA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Reunion", + "iso": "RE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78]4\\d{2}$", + "eg": "97400" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Romania", + "iso": "RO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Russia", + "iso": "RU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "MOW": "Moskva" }, + { "SPE": "Sankt-Peterburg" }, + { "AD": "Adygeya, Respublika" }, + { "AL": "Altay, Respublika" }, + { "BA": "Bashkortostan, Respublika" }, + { "BU": "Buryatiya, Respublika" }, + { "CE": "Chechenskaya Respublika" }, + { "CU": "Chuvashskaya Respublika" }, + { "DA": "Dagestan, Respublika" }, + { "IN": "Ingushetiya, Respublika" }, + { "KB": "Kabardino-Balkarskaya Respublika" }, + { "KL": "Kalmykiya, Respublika" }, + { "KC": "Karachayevo-Cherkesskaya Respublika" }, + { "KR": "Kareliya, Respublika" }, + { "KK": "Khakasiya, Respublika" }, + { "KO": "Komi, Respublika" }, + { "ME": "Mariy El, Respublika" }, + { "MO": "Mordoviya, Respublika" }, + { "SA": "Sakha, Respublika [Yakutiya]" }, + { "SE": "Severnaya Osetiya-Alaniya, Respublika" }, + { "TA": "Tatarstan, Respublika" }, + { "TY": "Tyva, Respublika [Tuva]" }, + { "UD": "Udmurtskaya Respublika" }, + { "ALT": "Altayskiy kray" }, + { "KAM": "Kamchatskiy kray" }, + { "KHA": "Khabarovskiy kray" }, + { "KDA": "Krasnodarskiy kray" }, + { "KYA": "Krasnoyarskiy kray" }, + { "PER": "Permskiy kray" }, + { "PRI": "Primorskiy kray" }, + { "STA": "Stavropolskiy kray" }, + { "ZAB": "Zabaykalskiy kray" }, + { "AMU": "Amurskaya oblast" }, + { "ARK": "Arkhangelskaya oblast" }, + { "AST": "Astrakhanskaya oblast" }, + { "BEL": "Belgorodskaya oblast" }, + { "BRY": "Bryanskaya oblast" }, + { "CHE": "Chelyabinskaya oblast" }, + { "IRK": "Irkutskaya oblast" }, + { "IVA": "Ivanovskaya oblast" }, + { "KGD": "Kaliningradskaya oblast" }, + { "KLU": "Kaluzhskaya oblast" }, + { "KEM": "Kemerovskaya oblast" }, + { "KIR": "Kirovskaya oblast" }, + { "KOS": "Kostromskaya oblast" }, + { "KGN": "Kurganskaya oblast" }, + { "KRS": "Kurskaya oblast" }, + { "LEN": "Leningradskaya oblast" }, + { "LIP": "Lipetskaya oblast" }, + { "MAG": "Magadanskaya oblast" }, + { "MOS": "Moskovskaya oblast" }, + { "MUR": "Murmanskaya oblast" }, + { "NIZ": "Nizhegorodskaya oblast" }, + { "NGR": "Novgorodskaya oblast" }, + { "NVS": "Novosibirskaya oblast" }, + { "OMS": "Omskaya oblast" }, + { "ORE": "Orenburgskaya oblast" }, + { "ORL": "Orlovskaya oblast" }, + { "PNZ": "Penzenskaya oblast" }, + { "PSK": "Pskovskaya oblast" }, + { "ROS": "Rostovskaya oblast" }, + { "RYA": "Ryazanskaya oblast" }, + { "SAK": "Sakhalinskaya oblast" }, + { "SAM": "Samarskaya oblast" }, + { "SAR": "Saratovskaya oblast" }, + { "SMO": "Smolenskaya oblast" }, + { "SVE": "Sverdlovskaya oblast" }, + { "TAM": "Tambovskaya oblast" }, + { "TOM": "Tomskaya oblast" }, + { "TUL": "Tulskaya oblast" }, + { "TVE": "Tverskaya oblast" }, + { "TYU": "Tyumenskaya oblast" }, + { "ULY": "Ulyanovskaya oblast" }, + { "VLA": "Vladimirskaya oblast" }, + { "VGG": "Volgogradskaya oblast" }, + { "VLG": "Vologodskaya oblast" }, + { "VOR": "Voronezhskaya oblast" }, + { "YAR": "Yaroslavskaya oblast" }, + { "YEV": "Yevreyskaya avtonomnaya oblast" }, + { "CHU": "Chukotskiy avtonomnyy okrug" }, + { "KHM": "Khanty-Mansiyskiy avtonomnyy okrug-Yugra" }, + { "NEN": "Nenetskiy avtonomnyy okrug" }, + { "YAN": "Yamalo-Nenetskiy avtonomnyy okrug" } + ] + } + }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Rwanda", + "iso": "RW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Saint Barth\u00c8lemy", + "iso": "BL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78][01]\\d{2}$", + "eg": "97100" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Saint Helena", + "iso": "SH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^(ASCN|STHL)[ ]?1ZZ$", + "eg": "STHL 1ZZ" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Saint Kitts and Nevis", + "iso": "KN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Saint Lucia", + "iso": "LC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Saint Martin (French part)", + "iso": "MF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78][01]\\d{2}$", + "eg": "97100" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Saint Pierre and Miquelon", + "iso": "PM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^9[78]5\\d{2}$", + "eg": "97500" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Saint Vincent and the Grenadines", + "iso": "VC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Samoa", + "iso": "WS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "San Marino", + "iso": "SM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["postalcode", "thoroughfare"] + }, + { + "label": "Sao Tome and Principe", + "iso": "ST", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Saudi Arabia", + "iso": "SA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Senegal", + "iso": "SN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Serbia", + "iso": "RS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Seychelles", + "iso": "SC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Island" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Sierra Leone", + "iso": "SL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Singapore", + "iso": "SG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{6}$", + "eg": "238880" + } + } + ] + } + ], + "required": ["postalcode", "thoroughfare"] + }, + { + "label": "Slovakia", + "iso": "SK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Slovenia", + "iso": "SI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Solomon Islands", + "iso": "SB", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Somalia", + "iso": "SO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "South Africa", + "iso": "ZA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "Eastern Cape": "Eastern Cape" }, + { "Free State": "Free State" }, + { "Gauteng": "Gauteng" }, + { "KwaZulu-Natal": "KwaZulu-Natal" }, + { "Limpopo": "Limpopo" }, + { "Mpumalanga": "Mpumalanga" }, + { "North West": "North West" }, + { "Northern Cape": "Northern Cape" }, + { "Western Cape": "Western Cape" } + ] + } + } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "South Georgia and the South Sandwich Islands", + "iso": "GS", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "South Korea", + "iso": "KR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "District" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "Seoul": "Seoul" }, + { "Busan": "Busan" }, + { "Daegu": "Daegu" }, + { "Daejeon": "Daejeon" }, + { "Gwangju": "Gwangju" }, + { "Incheon": "Incheon" }, + { "Ulsan": "Ulsan" }, + { "Chungcheongbuk-do": "Chungcheongbuk-do" }, + { "Chungcheongnam-do": "Chungcheongnam-do" }, + { "Gangwon-do": "Gangwon-do" }, + { "Gyeonggi-do": "Gyeonggi-do" }, + { "Gyeongsangbuk-do": "Gyeongsangbuk-do" }, + { "Gyeongsangnam-do": "Gyeongsangnam-do" }, + { "Jeju-do": "Jeju-do" }, + { "Jeollabuk-do": "Jeollabuk-do" }, + { "Jeollanam-do": "Jeollanam-do" }, + { "Sejong": "Sejong" } + ] + } + }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Spain", + "iso": "ES", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "C": "A Coru\u00f1a" }, + { "VI": "Alava" }, + { "AB": "Albacete" }, + { "A": "Alicante" }, + { "AL": "Almer\u00eda" }, + { "O": "Asturias" }, + { "AV": "\u00c1vila" }, + { "BA": "Badajoz" }, + { "PM": "Baleares" }, + { "B": "Barcelona" }, + { "BU": "Burgos" }, + { "CC": "C\u00e1ceres" }, + { "CA": "C\u00e1diz" }, + { "S": "Cantabria" }, + { "CS": "Castell\u00f3n" }, + { "CE": "Ceuta" }, + { "CR": "Ciudad Real" }, + { "CO": "C\u00f3rdoba" }, + { "CU": "Cuenca" }, + { "GI": "Gerona" }, + { "GR": "Granada" }, + { "GU": "Guadalajara" }, + { "SS": "Guip\u00fazcoa" }, + { "H": "Huelva" }, + { "HU": "Huesca" }, + { "J": "Ja\u00e9n" }, + { "LO": "La Rioja" }, + { "GC": "Las Palmas" }, + { "LE": "Le\u00f3n" }, + { "L": "L\u00e9rida" }, + { "LU": "Lugo" }, + { "M": "Madrid" }, + { "MA": "M\u00e1laga" }, + { "ML": "Melilla" }, + { "MU": "Murcia" }, + { "NA": "Navarra" }, + { "OR": "Ourense" }, + { "P": "Palencia" }, + { "PO": "Pontevedra" }, + { "SA": "Salamanca" }, + { "TF": "Santa Cruz de Tenerife" }, + { "SG": "Segovia" }, + { "SE": "Sevilla" }, + { "SO": "Soria" }, + { "T": "Tarragona" }, + { "TE": "Teruel" }, + { "TO": "Toledo" }, + { "V": "Valencia" }, + { "VA": "Valladolid" }, + { "BI": "Vizcaya" }, + { "ZA": "Zamora" }, + { "Z": "Zaragoza" } + ] + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Sri Lanka", + "iso": "LK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Sudan", + "iso": "SD", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Suriname", + "iso": "SR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Svalbard and Jan Mayen", + "iso": "SJ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "9170" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Swaziland", + "iso": "SZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Sweden", + "iso": "SE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{3}[ ]?\\d{2}$", + "eg": "11455" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Switzerland", + "iso": "CH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{4}$", + "eg": "2544" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Syria", + "iso": "SY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Taiwan", + "iso": "TW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^\\d{3}(\\d{2})?$", + "eg": "100" + } + }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "TXG": "Taichung City" }, + { "TPE": "Taipei City" }, + { "TTT": "Taitung County" }, + { "TNN": "Tainan City" }, + { "ILA": "Yilan County" }, + { "HUA": "Hualien County" }, + { "Kinmen County": "Kinmen County" }, + { "NAN": "Nantou County" }, + { "PIF": "Pingtung County" }, + { "MIA": "Miaoli County" }, + { "TAO": "Taoyuan County" }, + { "KHH": "Kaohsiung City" }, + { "KEE": "Keelung City" }, + { "Lienchiang County": "Lienchiang County" }, + { "YUN": "Yunlin County" }, + { "TPQ": "New Taipei City" }, + { "HSZ": "Hsinchu City" }, + { "HSQ": "Hsinchu County" }, + { "CYI": "Chiayi City" }, + { "CYQ": "Chiayi County" }, + { "CHA": "Changhua County" }, + { "PEN": "Penghu County" } + ] + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Tajikistan", + "iso": "TJ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Tanzania", + "iso": "TZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Thailand", + "iso": "TH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "dependent_localityname": { "label": "Suburb" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Province" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Timor-Leste", + "iso": "TL", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Togo", + "iso": "TG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Tokelau", + "iso": "TK", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Tonga", + "iso": "TO", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Trinidad and Tobago", + "iso": "TT", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Tunisia", + "iso": "TN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Turkey", + "iso": "TR", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { + "administrativearea": { + "label": "Province", + "options": [ + { "": "--" }, + { "Adana": "Adana" }, + { "Ad\u0131yaman": "Ad\u0131yaman" }, + { "Afyon": "Afyon" }, + { "A\u011fr\u0131": "A\u011fr\u0131" }, + { "Aksaray": "Aksaray" }, + { "Amasya": "Amasya" }, + { "Ankara": "Ankara" }, + { "Antalya": "Antalya" }, + { "Ardahan": "Ardahan" }, + { "Artvin": "Artvin" }, + { "Ayd\u0131n": "Ayd\u0131n" }, + { "Bal\u0131kesir": "Bal\u0131kesir" }, + { "Bart\u0131n": "Bart\u0131n" }, + { "Batman": "Batman" }, + { "Bayburt": "Bayburt" }, + { "Bilecik": "Bilecik" }, + { "Bing\u00f6l": "Bing\u00f6l" }, + { "Bitlis": "Bitlis" }, + { "Bolu": "Bolu" }, + { "Burdur": "Burdur" }, + { "Bursa": "Bursa" }, + { "\u00c7anakkale": "\u00c7anakkale" }, + { "\u00c7ank\u0131r\u0131": "\u00c7ank\u0131r\u0131" }, + { "\u00c7orum": "\u00c7orum" }, + { "Denizli": "Denizli" }, + { "Diyarbak\u0131r": "Diyarbak\u0131r" }, + { "D\u00fczce": "D\u00fczce" }, + { "Edirne": "Edirne" }, + { "Elaz\u0131\u011f": "Elaz\u0131\u011f" }, + { "Erzincan": "Erzincan" }, + { "Erzurum": "Erzurum" }, + { "Eski\u015fehir": "Eski\u015fehir" }, + { "Gaziantep": "Gaziantep" }, + { "Giresun": "Giresun" }, + { "G\u00fcm\u00fc\u015fhane": "G\u00fcm\u00fc\u015fhane" }, + { "Hakkari": "Hakkari" }, + { "Hatay": "Hatay" }, + { "I\u011fd\u0131r": "I\u011fd\u0131r" }, + { "Isparta": "Isparta" }, + { "\u0130stanbul": "\u0130stanbul" }, + { "\u0130zmir": "\u0130zmir" }, + { "Kahramanmara\u015f": "Kahramanmara\u015f" }, + { "Karab\u00fck": "Karab\u00fck" }, + { "Karaman": "Karaman" }, + { "Kars": "Kars" }, + { "Kastamonu": "Kastamonu" }, + { "Kayseri": "Kayseri" }, + { "K\u0131r\u0131kkale": "K\u0131r\u0131kkale" }, + { "K\u0131rklareli": "K\u0131rklareli" }, + { "K\u0131r\u015fehir": "K\u0131r\u015fehir" }, + { "Kilis": "Kilis" }, + { "Kocaeli": "Kocaeli" }, + { "Konya": "Konya" }, + { "K\u00fctahya": "K\u00fctahya" }, + { "Malatya": "Malatya" }, + { "Manisa": "Manisa" }, + { "Mardin": "Mardin" }, + { "Mersin": "Mersin" }, + { "Mu\u011fla": "Mu\u011fla" }, + { "Mu\u015f": "Mu\u015f" }, + { "Nev\u015fehir": "Nev\u015fehir" }, + { "Ni\u011fde": "Ni\u011fde" }, + { "Ordu": "Ordu" }, + { "Osmaniye": "Osmaniye" }, + { "Rize": "Rize" }, + { "Sakarya": "Sakarya" }, + { "Samsun": "Samsun" }, + { "Siirt": "Siirt" }, + { "Sinop": "Sinop" }, + { "Sivas": "Sivas" }, + { "\u015eanl\u0131urfa": "\u015eanl\u0131urfa" }, + { "\u015e\u0131rnak": "\u015e\u0131rnak" }, + { "Tekirda\u011f": "Tekirda\u011f" }, + { "Tokat": "Tokat" }, + { "Trabzon": "Trabzon" }, + { "Tunceli": "Tunceli" }, + { "U\u015fak": "U\u015fak" }, + { "Van": "Van" }, + { "Yalova": "Yalova" }, + { "Yozgat": "Yozgat" }, + { "Zonguldak": "Zonguldak" } + ] + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Turkmenistan", + "iso": "TM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Turks and Caicos Islands", + "iso": "TC", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Tuvalu", + "iso": "TV", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "Island", + "options": [ + { "": "--" }, + { "Funafuti": "Funafuti" }, + { "Funafuti Centre": "Funafuti Centre" }, + { "Nanumaga": "Nanumaga" }, + { "Nanumea": "Nanumea" }, + { "Niulakita": "Niulakita" }, + { "Niutao": "Niutao" }, + { "Nui": "Nui" }, + { "Nukulaelae": "Nukulaelae" }, + { "Vaitupu": "Vaitupu" } + ] + } + } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "U.S. Virgin Islands", + "iso": "VI", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "Uganda", + "iso": "UG", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Ukraine", + "iso": "UA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "Region" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "United Arab Emirates", + "iso": "AE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "administrativearea": { + "label": "Emirate", + "options": [ + { "": "--" }, + { "AZ": "Abu Dhabi" }, + { "FU": "Fujairah" }, + { "UQ": "Umm al-Quwain" }, + { "SH": "Sharjah" }, + { "DU": "Dubai" }, + { "RK": "Ras al-Khaimah" }, + { "AJ": "Ajm\u0101n" } + ] + } + } + ] + } + ], + "required": ["administrativearea", "thoroughfare"] + }, + { + "label": "United Kingdom", + "iso": "GB", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "Town/city" } }, + { "administrativearea": { "label": "County" } }, + { + "postalcode": { + "label": "Postcode", + "format": "^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\\d{1,4}$", + "eg": "SE1 0SU" + } + } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "United States", + "iso": "US", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "AL": "Alabama" }, + { "AK": "Alaska" }, + { "AZ": "Arizona" }, + { "AR": "Arkansas" }, + { "CA": "California" }, + { "CO": "Colorado" }, + { "CT": "Connecticut" }, + { "DE": "Delaware" }, + { "DC": "District Of Columbia" }, + { "FL": "Florida" }, + { "GA": "Georgia" }, + { "HI": "Hawaii" }, + { "ID": "Idaho" }, + { "IL": "Illinois" }, + { "IN": "Indiana" }, + { "IA": "Iowa" }, + { "KS": "Kansas" }, + { "KY": "Kentucky" }, + { "LA": "Louisiana" }, + { "ME": "Maine" }, + { "MD": "Maryland" }, + { "MA": "Massachusetts" }, + { "MI": "Michigan" }, + { "MN": "Minnesota" }, + { "MS": "Mississippi" }, + { "MO": "Missouri" }, + { "MT": "Montana" }, + { "NE": "Nebraska" }, + { "NV": "Nevada" }, + { "NH": "New Hampshire" }, + { "NJ": "New Jersey" }, + { "NM": "New Mexico" }, + { "NY": "New York" }, + { "NC": "North Carolina" }, + { "ND": "North Dakota" }, + { "OH": "Ohio" }, + { "OK": "Oklahoma" }, + { "OR": "Oregon" }, + { "PA": "Pennsylvania" }, + { "RI": "Rhode Island" }, + { "SC": "South Carolina" }, + { "SD": "South Dakota" }, + { "TN": "Tennessee" }, + { "TX": "Texas" }, + { "UT": "Utah" }, + { "VT": "Vermont" }, + { "VA": "Virginia" }, + { "WA": "Washington" }, + { "WV": "West Virginia" }, + { "WI": "Wisconsin" }, + { "WY": "Wyoming" }, + { "": "--" }, + { "AA": "Armed Forces (Americas)" }, + { + "AE": "Armed Forces (Europe, Canada, Middle East, Africa)" + }, + { "AP": "Armed Forces (Pacific)" }, + { "AS": "American Samoa" }, + { "FM": "Federated States of Micronesia" }, + { "GU": "Guam" }, + { "MH": "Marshall Islands" }, + { "MP": "Northern Mariana Islands" }, + { "PW": "Palau" }, + { "PR": "Puerto Rico" }, + { "VI": "Virgin Islands" } + ] + } + }, + { + "postalcode": { + "label": "ZIP code", + "format": "^\\d{5}(?:[-\\s]\\d{4})?$", + "eg": "98103" + } + } + ] + } + ], + "required": [ + "localityname", + "administrativearea", + "postalcode", + "thoroughfare" + ] + }, + { + "label": "United States Minor Outlying Islands", + "iso": "UM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "ZIP code" } } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Uruguay", + "iso": "UY", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Uzbekistan", + "iso": "UZ", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Vanuatu", + "iso": "VU", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Vatican", + "iso": "VA", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Venezuela", + "iso": "VE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } }, + { + "administrativearea": { + "label": "State", + "options": [ + { "": "--" }, + { "Z": "Amazonas" }, + { "B": "Anzo\u00e1tegui" }, + { "C": "Apure" }, + { "D": "Aragua" }, + { "E": "Barinas" }, + { "F": "Bol\u00edvar" }, + { "G": "Carabobo" }, + { "H": "Cojedes" }, + { "Y": "Delta Amacuro" }, + { "W": "Dependencias Federales" }, + { "A": "Distrito Federal" }, + { "I": "Falc\u00f3n" }, + { "J": "Gu\u00e1rico" }, + { "K": "Lara" }, + { "L": "M\u00e9rida" }, + { "M": "Miranda" }, + { "N": "Monagas" }, + { "O": "Nueva Esparta" }, + { "P": "Portuguesa" }, + { "R": "Sucre" }, + { "S": "T\u00e1chira" }, + { "T": "Trujillo" }, + { "X": "Vargas" }, + { "U": "Yaracuy" }, + { "V": "Zulia" } + ] + } + } + ] + } + ], + "required": ["localityname", "administrativearea", "thoroughfare"] + }, + { + "label": "Vietnam", + "iso": "VN", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "localityname": { "label": "City" } }, + { "administrativearea": { "label": "State" } }, + { "postalcode": { "label": "Postal code" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Wallis and Futuna", + "iso": "WF", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { + "postalcode": { + "label": "Postal code", + "format": "^986\\d{2}$", + "eg": "98600" + } + }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "postalcode", "thoroughfare"] + }, + { + "label": "Western Sahara", + "iso": "EH", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Yemen", + "iso": "YE", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Zambia", + "iso": "ZM", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { + "locality": [ + { "postalcode": { "label": "Postal code" } }, + { "localityname": { "label": "City" } } + ] + } + ], + "required": ["localityname", "thoroughfare"] + }, + { + "label": "Zimbabwe", + "iso": "ZW", + "fields": [ + { "thoroughfare": { "label": "Address 1" } }, + { "premise": { "label": "Address 2" } }, + { "locality": [{ "localityname": { "label": "City" } }] } + ], + "required": ["localityname", "thoroughfare"] + } + ] +} diff --git a/addressfield/templates/addressfield/widgets/nested_with_label.html b/addressfield/templates/addressfield/widgets/nested_with_label.html index afb74baf2e..dd58bc2805 100644 --- a/addressfield/templates/addressfield/widgets/nested_with_label.html +++ b/addressfield/templates/addressfield/widgets/nested_with_label.html @@ -1,14 +1,14 @@
{% spaceless %} {% for widget in widget.subwidgets %} {% if not widget.subwidgets %} -
- +
+ {% endif %} {% include widget.template_name %} {% if not widget.subwidgets %} -
+
{% endif %} {% endfor %} {% endspaceless %}
diff --git a/addressfield/tests.py b/addressfield/tests.py index 6ccdd64174..4558073a11 100644 --- a/addressfield/tests.py +++ b/addressfield/tests.py @@ -11,34 +11,38 @@ def build_validation_data(self, fields=None, required=None): if required is None: required = [] - return {'COUNTRY': { - 'fields': [{field: {'label': field}} for field in set(fields + required)], - 'required': required, - }} + return { + "COUNTRY": { + "fields": [ + {field: {"label": field}} for field in set(fields + required) + ], + "required": required, + } + } def test_non_required(self): field = AddressField() - field.data = self.build_validation_data(fields=['postalcode']) - field.clean({'country': 'COUNTRY'}) + field.data = self.build_validation_data(fields=["postalcode"]) + field.clean({"country": "COUNTRY"}) def test_non_required_blank_data(self): field = AddressField() - field.data = self.build_validation_data(fields=['postalcode']) - field.clean({'country': 'COUNTRY', 'postalcode': ''}) + field.data = self.build_validation_data(fields=["postalcode"]) + field.clean({"country": "COUNTRY", "postalcode": ""}) def test_one_field_required(self): field = AddressField() - field.data = self.build_validation_data(required=['postalcode']) + field.data = self.build_validation_data(required=["postalcode"]) with self.assertRaises(ValidationError): - field.clean({'country': 'COUNTRY'}) + field.clean({"country": "COUNTRY"}) def test_one_field_required_blank_data(self): field = AddressField() - field.data = self.build_validation_data(required=['postalcode']) + field.data = self.build_validation_data(required=["postalcode"]) with self.assertRaises(ValidationError): - field.clean({'country': 'COUNTRY', 'postalcode': ''}) + field.clean({"country": "COUNTRY", "postalcode": ""}) def test_one_field_required_supplied_data(self): field = AddressField() - field.data = self.build_validation_data(required=['postalcode']) - field.clean({'country': 'COUNTRY', 'postalcode': 'BS1 2AB'}) + field.data = self.build_validation_data(required=["postalcode"]) + field.clean({"country": "COUNTRY", "postalcode": "BS1 2AB"}) diff --git a/addressfield/widgets.py b/addressfield/widgets.py index f515407646..6794a67b42 100644 --- a/addressfield/widgets.py +++ b/addressfield/widgets.py @@ -12,7 +12,7 @@ class CountrySelectWithChoices(KeepOwnAttrsWidget, forms.Select): is_required = True def __init__(self, *args, **kwargs): - kwargs['choices'] = countries + kwargs["choices"] = countries super().__init__(*args, **kwargs) @@ -21,19 +21,25 @@ class KeepAttrsTextInput(KeepOwnAttrsWidget, forms.TextInput): def classify(field): - return field.replace('_', '') + return field.replace("_", "") def display(field): - return field.replace('_', ' ').title() + return field.replace("_", " ").title() class NestedMultiWidget(KeepOwnAttrsWidget, forms.MultiWidget): - template_name = 'addressfield/widgets/nested_with_label.html' + template_name = "addressfield/widgets/nested_with_label.html" def __init__(self, *args, **kwargs): widgets = [ - widget(attrs={'class': classify(field), 'required': False, 'display': display(field)}) + widget( + attrs={ + "class": classify(field), + "required": False, + "display": display(field), + } + ) for field, widget in self.components.items() ] super().__init__(widgets, *args, **kwargs) @@ -46,7 +52,7 @@ def decompress(self, value): if value: decompressed = [] for i, widget in enumerate(self.widgets): - if hasattr(widget, 'components'): + if hasattr(widget, "components"): decompressed.append(widget.decompress(value)) else: decompressed.append(value.get(self.field_names[i])) @@ -56,9 +62,9 @@ def decompress(self, value): def value_from_datadict(self, data, files, name): value = {} for i, widget in enumerate(self.widgets): - widget_value = widget.value_from_datadict(data, files, name + '_%s' % i) + widget_value = widget.value_from_datadict(data, files, name + "_%s" % i) # flatten the data structure to a single dict - if hasattr(widget, 'widgets'): + if hasattr(widget, "widgets"): value.update(widget_value) else: value[self.field_names[i]] = widget_value @@ -67,28 +73,28 @@ def value_from_datadict(self, data, files, name): class LocalityWidget(NestedMultiWidget): components = { - 'locality_name': KeepAttrsTextInput, - 'administrative_area': KeepAttrsTextInput, - 'postal_code': KeepAttrsTextInput, + "locality_name": KeepAttrsTextInput, + "administrative_area": KeepAttrsTextInput, + "postal_code": KeepAttrsTextInput, } class AddressWidget(NestedMultiWidget): components = { - 'country': CountrySelectWithChoices, - 'thoroughfare': KeepAttrsTextInput, - 'premise': KeepAttrsTextInput, - 'locality': LocalityWidget, + "country": CountrySelectWithChoices, + "thoroughfare": KeepAttrsTextInput, + "premise": KeepAttrsTextInput, + "locality": LocalityWidget, } class Media: js = ( - 'jquery.addressfield.min.js', - 'address_form.js', + "jquery.addressfield.min.js", + "address_form.js", ) def __init__(self, *args, **kwargs): - attrs = kwargs.get('attrs', {}) - attrs['class'] = 'address' - kwargs['attrs'] = attrs + attrs = kwargs.get("attrs", {}) + attrs["class"] = "address" + kwargs["attrs"] = attrs super().__init__(*args, **kwargs) diff --git a/app.json b/app.json index ce7bd1c619..b9cd062619 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,6 @@ { "name": "opentech.fund", - "scripts": { - }, + "scripts": {}, "env": { "BASIC_AUTH_ENABLED": { "required": true @@ -39,9 +38,7 @@ "quantity": 1 } }, - "addons": [ - "heroku-postgresql" - ], + "addons": ["heroku-postgresql"], "buildpacks": [ { "url": "heroku/nodejs" diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index d36e65f4f6..9fb2280f8d 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3.7' +version: "3.7" services: web: diff --git a/docs/assets/extra.css b/docs/assets/extra.css index 4fa7c3c7a6..7a6cfc2fc5 100644 --- a/docs/assets/extra.css +++ b/docs/assets/extra.css @@ -1,3 +1,3 @@ -[dir=ltr] .md-header__title { +[dir="ltr"] .md-header__title { margin-left: 0.2rem; } diff --git a/hypha/apply/activity/adapters/activity_feed.py b/hypha/apply/activity/adapters/activity_feed.py index 136f5afba7..6613dcf8a8 100644 --- a/hypha/apply/activity/adapters/activity_feed.py +++ b/hypha/apply/activity/adapters/activity_feed.py @@ -20,42 +20,54 @@ class ActivityAdapter(AdapterBase): adapter_type = "Activity Feed" always_send = True messages = { - MESSAGES.TRANSITION: 'handle_transition', - MESSAGES.BATCH_TRANSITION: 'handle_batch_transition', - MESSAGES.NEW_SUBMISSION: _('Submitted {source.title} for {source.page.title}'), - MESSAGES.EDIT_SUBMISSION: _('Edited'), - MESSAGES.APPLICANT_EDIT: _('Edited'), - MESSAGES.UPDATE_LEAD: _('Lead changed from {old_lead} to {source.lead}'), - MESSAGES.BATCH_UPDATE_LEAD: _('Batch Lead changed to {new_lead}'), - MESSAGES.DETERMINATION_OUTCOME: _('Sent a determination. Outcome: {determination.clean_outcome}'), - MESSAGES.BATCH_DETERMINATION_OUTCOME: 'batch_determination', - MESSAGES.INVITED_TO_PROPOSAL: _('Invited to submit a proposal'), - MESSAGES.REVIEWERS_UPDATED: 'reviewers_updated', - MESSAGES.BATCH_REVIEWERS_UPDATED: 'batch_reviewers_updated', - MESSAGES.PARTNERS_UPDATED: 'partners_updated', - MESSAGES.NEW_REVIEW: _('Submitted a review'), - MESSAGES.OPENED_SEALED: _('Opened the submission while still sealed'), - MESSAGES.SCREENING: 'handle_screening_statuses', - MESSAGES.REVIEW_OPINION: _('{user} {opinion.opinion_display}s with {opinion.review.author}s review of {source}'), - MESSAGES.CREATED_PROJECT: _('Created'), - MESSAGES.PROJECT_TRANSITION: 'handle_project_transition', - MESSAGES.UPDATE_PROJECT_LEAD: _('Lead changed from {old_lead} to {source.lead}'), - MESSAGES.SEND_FOR_APPROVAL: _('Requested approval'), - MESSAGES.APPROVE_PROJECT: _('Approved'), - MESSAGES.REQUEST_PROJECT_CHANGE: _('Requested changes for acceptance: "{comment}"'), - MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: _('Submitted Contract Documents'), - MESSAGES.UPLOAD_CONTRACT: _('Uploaded a {contract.state} contract'), - MESSAGES.APPROVE_CONTRACT: _('Approved contract'), - MESSAGES.UPDATE_INVOICE_STATUS: 'handle_update_invoice_status', - MESSAGES.CREATE_INVOICE: _('Invoice added'), - MESSAGES.SUBMIT_REPORT: _('Submitted a report'), - MESSAGES.SKIPPED_REPORT: 'handle_skipped_report', - MESSAGES.REPORT_FREQUENCY_CHANGED: 'handle_report_frequency', - MESSAGES.DISABLED_REPORTING: _('Reporting disabled'), - MESSAGES.BATCH_DELETE_SUBMISSION: 'handle_batch_delete_submission', - MESSAGES.BATCH_ARCHIVE_SUBMISSION: 'handle_batch_archive_submission', - MESSAGES.ARCHIVE_SUBMISSION: _('{user} has archived the submission: {source.title}'), - MESSAGES.UNARCHIVE_SUBMISSION: _('{user} has unarchived the submission: {source.title}'), + MESSAGES.TRANSITION: "handle_transition", + MESSAGES.BATCH_TRANSITION: "handle_batch_transition", + MESSAGES.NEW_SUBMISSION: _("Submitted {source.title} for {source.page.title}"), + MESSAGES.EDIT_SUBMISSION: _("Edited"), + MESSAGES.APPLICANT_EDIT: _("Edited"), + MESSAGES.UPDATE_LEAD: _("Lead changed from {old_lead} to {source.lead}"), + MESSAGES.BATCH_UPDATE_LEAD: _("Batch Lead changed to {new_lead}"), + MESSAGES.DETERMINATION_OUTCOME: _( + "Sent a determination. Outcome: {determination.clean_outcome}" + ), + MESSAGES.BATCH_DETERMINATION_OUTCOME: "batch_determination", + MESSAGES.INVITED_TO_PROPOSAL: _("Invited to submit a proposal"), + MESSAGES.REVIEWERS_UPDATED: "reviewers_updated", + MESSAGES.BATCH_REVIEWERS_UPDATED: "batch_reviewers_updated", + MESSAGES.PARTNERS_UPDATED: "partners_updated", + MESSAGES.NEW_REVIEW: _("Submitted a review"), + MESSAGES.OPENED_SEALED: _("Opened the submission while still sealed"), + MESSAGES.SCREENING: "handle_screening_statuses", + MESSAGES.REVIEW_OPINION: _( + "{user} {opinion.opinion_display}s with {opinion.review.author}s review of {source}" + ), + MESSAGES.CREATED_PROJECT: _("Created"), + MESSAGES.PROJECT_TRANSITION: "handle_project_transition", + MESSAGES.UPDATE_PROJECT_LEAD: _( + "Lead changed from {old_lead} to {source.lead}" + ), + MESSAGES.SEND_FOR_APPROVAL: _("Requested approval"), + MESSAGES.APPROVE_PROJECT: _("Approved"), + MESSAGES.REQUEST_PROJECT_CHANGE: _( + 'Requested changes for acceptance: "{comment}"' + ), + MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: _("Submitted Contract Documents"), + MESSAGES.UPLOAD_CONTRACT: _("Uploaded a {contract.state} contract"), + MESSAGES.APPROVE_CONTRACT: _("Approved contract"), + MESSAGES.UPDATE_INVOICE_STATUS: "handle_update_invoice_status", + MESSAGES.CREATE_INVOICE: _("Invoice added"), + MESSAGES.SUBMIT_REPORT: _("Submitted a report"), + MESSAGES.SKIPPED_REPORT: "handle_skipped_report", + MESSAGES.REPORT_FREQUENCY_CHANGED: "handle_report_frequency", + MESSAGES.DISABLED_REPORTING: _("Reporting disabled"), + MESSAGES.BATCH_DELETE_SUBMISSION: "handle_batch_delete_submission", + MESSAGES.BATCH_ARCHIVE_SUBMISSION: "handle_batch_archive_submission", + MESSAGES.ARCHIVE_SUBMISSION: _( + "{user} has archived the submission: {source.title}" + ), + MESSAGES.UNARCHIVE_SUBMISSION: _( + "{user} has unarchived the submission: {source.title}" + ), } def recipients(self, message_type, **kwargs): @@ -74,43 +86,43 @@ def extra_kwargs(self, message_type, source, sources, **kwargs): MESSAGES.SEND_FOR_APPROVAL, MESSAGES.NEW_REVIEW, ]: - return {'visibility': TEAM} + return {"visibility": TEAM} source = source or sources[0] if is_transition(message_type) and not source.phase.permissions.can_view( source.user ): # User's shouldn't see status activity changes for stages that aren't visible to the them - return {'visibility': TEAM} + return {"visibility": TEAM} if message_type == MESSAGES.UPDATE_INVOICE_STATUS: - invoice = kwargs.get('invoice', None) + invoice = kwargs.get("invoice", None) if invoice and not is_invoice_public_transition(invoice): - return {'visibility': TEAM} + return {"visibility": TEAM} return {} def reviewers_updated(self, added=None, removed=None, **kwargs): - message = [_('Reviewers updated.')] + message = [_("Reviewers updated.")] if added: - message.append(_('Added:')) + message.append(_("Added:")) message.extend(reviewers_message(added)) if removed: - message.append(_('Removed:')) + message.append(_("Removed:")) message.extend(reviewers_message(removed)) - return ' '.join(message) + return " ".join(message) def batch_reviewers_updated(self, added, **kwargs): - base = [_('Batch Reviewers Updated.')] + base = [_("Batch Reviewers Updated.")] base.extend( [ - _('{user} as {name}.').format(user=str(user), name=role.name) + _("{user} as {name}.").format(user=str(user), name=role.name) for role, user in added if user ] ) - return ' '.join(base) + return " ".join(base) def batch_determination(self, sources, determinations, **kwargs): submission = sources[0] @@ -121,21 +133,21 @@ def batch_determination(self, sources, determinations, **kwargs): def handle_batch_delete_submission(self, sources, **kwargs): submissions = sources - submissions_text = ', '.join([submission.title for submission in submissions]) - return _('Successfully deleted submissions: {title}').format( + submissions_text = ", ".join([submission.title for submission in submissions]) + return _("Successfully deleted submissions: {title}").format( title=submissions_text ) def handle_batch_archive_submission(self, sources, **kwargs): submissions = sources - submissions_text = ', '.join([submission.title for submission in submissions]) - return _('Successfully archived submissions: {title}').format( + submissions_text = ", ".join([submission.title for submission in submissions]) + return _("Successfully archived submissions: {title}").format( title=submissions_text ) def handle_transition(self, old_phase, source, **kwargs): submission = source - base_message = _('Progressed from {old_display} to {new_display}') + base_message = _("Progressed from {old_display} to {new_display}") new_phase = submission.phase @@ -167,7 +179,7 @@ def handle_transition(self, old_phase, source, **kwargs): def handle_project_transition(self, old_stage, source, **kwargs): project = source - base_message = _('Progressed from {old_display} to {new_display}') + base_message = _("Progressed from {old_display} to {new_display}") staff_message = base_message.format( old_display=get_project_status_display_value(old_stage), @@ -180,15 +192,15 @@ def handle_project_transition(self, old_stage, source, **kwargs): ) return json.dumps( - { - TEAM: staff_message, - ALL: applicant_message, - } - ) + { + TEAM: staff_message, + ALL: applicant_message, + } + ) def handle_batch_transition(self, transitions, sources, **kwargs): submissions = sources - kwargs.pop('source') + kwargs.pop("source") for submission in submissions: old_phase = transitions[submission.id] return self.handle_transition( @@ -196,21 +208,21 @@ def handle_batch_transition(self, transitions, sources, **kwargs): ) def partners_updated(self, added, removed, **kwargs): - message = [_('Partners updated.')] + message = [_("Partners updated.")] if added: - message.append(_('Added:')) - message.append(', '.join([str(user) for user in added]) + '.') + message.append(_("Added:")) + message.append(", ".join([str(user) for user in added]) + ".") if removed: - message.append(_('Removed:')) - message.append(', '.join([str(user) for user in removed]) + '.') + message.append(_("Removed:")) + message.append(", ".join([str(user) for user in removed]) + ".") - return ' '.join(message) + return " ".join(message) def handle_report_frequency(self, config, **kwargs): new_schedule = config.get_frequency_display() return _( - 'Updated reporting frequency. New schedule is: {new_schedule} starting on {schedule_start}' + "Updated reporting frequency. New schedule is: {new_schedule} starting on {schedule_start}" ).format(new_schedule=new_schedule, schedule_start=config.schedule_start) def handle_skipped_report(self, report, **kwargs): @@ -220,27 +232,22 @@ def handle_skipped_report(self, report, **kwargs): return "Marked a Report as required" def handle_update_invoice_status(self, invoice, **kwargs): - base_message = _('Updated Invoice status to: {invoice_status}.') + base_message = _("Updated Invoice status to: {invoice_status}.") staff_message = base_message.format(invoice_status=invoice.get_status_display()) if is_invoice_public_transition(invoice): public_status = get_invoice_public_status(invoice_status=invoice.status) applicant_message = base_message.format(invoice_status=public_status) - return json.dumps( - { - TEAM: staff_message, - ALL: applicant_message - } - ) + return json.dumps({TEAM: staff_message, ALL: applicant_message}) return staff_message def send_message(self, message, user, source, sources, **kwargs): from ..models import Activity - visibility = kwargs.get('visibility', ALL) + visibility = kwargs.get("visibility", ALL) - related = kwargs['related'] + related = kwargs["related"] if isinstance(related, dict): try: related = related[source.id] @@ -248,7 +255,7 @@ def send_message(self, message, user, source, sources, **kwargs): pass has_correct_fields = all( - hasattr(related, attr) for attr in ['get_absolute_url'] + hasattr(related, attr) for attr in ["get_absolute_url"] ) isnt_source = source != related is_model = isinstance(related, DjangoModel) @@ -267,7 +274,7 @@ def send_message(self, message, user, source, sources, **kwargs): ) def handle_screening_statuses(self, source, old_status, **kwargs): - new_status = ', '.join([s.title for s in source.screening_statuses.all()]) - return _('Screening decision from {old_status} to {new_status}').format( + new_status = ", ".join([s.title for s in source.screening_statuses.all()]) + return _("Screening decision from {old_status} to {new_status}").format( old_status=old_status, new_status=new_status ) diff --git a/hypha/apply/activity/adapters/base.py b/hypha/apply/activity/adapters/base.py index 253ee953d6..f8263851b3 100644 --- a/hypha/apply/activity/adapters/base.py +++ b/hypha/apply/activity/adapters/base.py @@ -4,36 +4,36 @@ from hypha.apply.activity.options import MESSAGES neat_related = { - MESSAGES.DETERMINATION_OUTCOME: 'determination', - MESSAGES.BATCH_DETERMINATION_OUTCOME: 'determinations', - MESSAGES.UPDATE_LEAD: 'old_lead', - MESSAGES.NEW_REVIEW: 'review', - MESSAGES.TRANSITION: 'old_phase', - MESSAGES.BATCH_TRANSITION: 'transitions', - MESSAGES.APPLICANT_EDIT: 'revision', - MESSAGES.EDIT_SUBMISSION: 'revision', - MESSAGES.COMMENT: 'comment', - MESSAGES.SCREENING: 'old_status', - MESSAGES.REVIEW_OPINION: 'opinion', - MESSAGES.DELETE_REVIEW: 'review', - MESSAGES.EDIT_REVIEW: 'review', - MESSAGES.CREATED_PROJECT: 'submission', - MESSAGES.PROJECT_TRANSITION: 'old_stage', - MESSAGES.UPDATE_PROJECT_LEAD: 'old_lead', - MESSAGES.APPROVE_CONTRACT: 'contract', - MESSAGES.UPLOAD_CONTRACT: 'contract', - MESSAGES.CREATE_INVOICE: 'create_invoice', - MESSAGES.UPDATE_INVOICE_STATUS: 'invoice', - MESSAGES.APPROVE_INVOICE: 'invoice', - MESSAGES.DELETE_INVOICE: 'invoice', - MESSAGES.UPDATE_INVOICE: 'invoice', - MESSAGES.SUBMIT_REPORT: 'report', - MESSAGES.SKIPPED_REPORT: 'report', - MESSAGES.REPORT_FREQUENCY_CHANGED: 'config', - MESSAGES.REPORT_NOTIFY: 'report', - MESSAGES.CREATE_REMINDER: 'reminder', - MESSAGES.DELETE_REMINDER: 'reminder', - MESSAGES.REVIEW_REMINDER: 'reminder', + MESSAGES.DETERMINATION_OUTCOME: "determination", + MESSAGES.BATCH_DETERMINATION_OUTCOME: "determinations", + MESSAGES.UPDATE_LEAD: "old_lead", + MESSAGES.NEW_REVIEW: "review", + MESSAGES.TRANSITION: "old_phase", + MESSAGES.BATCH_TRANSITION: "transitions", + MESSAGES.APPLICANT_EDIT: "revision", + MESSAGES.EDIT_SUBMISSION: "revision", + MESSAGES.COMMENT: "comment", + MESSAGES.SCREENING: "old_status", + MESSAGES.REVIEW_OPINION: "opinion", + MESSAGES.DELETE_REVIEW: "review", + MESSAGES.EDIT_REVIEW: "review", + MESSAGES.CREATED_PROJECT: "submission", + MESSAGES.PROJECT_TRANSITION: "old_stage", + MESSAGES.UPDATE_PROJECT_LEAD: "old_lead", + MESSAGES.APPROVE_CONTRACT: "contract", + MESSAGES.UPLOAD_CONTRACT: "contract", + MESSAGES.CREATE_INVOICE: "create_invoice", + MESSAGES.UPDATE_INVOICE_STATUS: "invoice", + MESSAGES.APPROVE_INVOICE: "invoice", + MESSAGES.DELETE_INVOICE: "invoice", + MESSAGES.UPDATE_INVOICE: "invoice", + MESSAGES.SUBMIT_REPORT: "report", + MESSAGES.SKIPPED_REPORT: "report", + MESSAGES.REPORT_FREQUENCY_CHANGED: "config", + MESSAGES.REPORT_NOTIFY: "report", + MESSAGES.CREATE_REMINDER: "reminder", + MESSAGES.DELETE_REMINDER: "reminder", + MESSAGES.REVIEW_REMINDER: "reminder", } @@ -87,8 +87,8 @@ def batch_recipients(self, message_type, sources, **kwargs): # receive a message under normal conditions return [ { - 'recipients': self.recipients(message_type, source=source, **kwargs), - 'sources': [source], + "recipients": self.recipients(message_type, source=source, **kwargs), + "sources": [source], } for source in sources ] @@ -100,8 +100,8 @@ def process_batch( for recipient in self.batch_recipients( message_type, sources, user=user, **kwargs ): - recipients = recipient['recipients'] - sources = recipient['sources'] + recipients = recipient["recipients"] + sources = recipient["sources"] events = [events_by_source[source.id] for source in sources] self.process_send( message_type, @@ -119,7 +119,12 @@ def process( self, message_type, event, request, user, source, related=None, **kwargs ): recipients = self.recipients( - message_type, source=source, related=related, user=user, request=request, **kwargs + message_type, + source=source, + related=related, + user=user, + request=request, + **kwargs, ) self.process_send( message_type, @@ -153,11 +158,11 @@ def process_send( pass kwargs = { - 'request': request, - 'user': user, - 'source': source, - 'sources': sources, - 'related': related, + "request": request, + "user": user, + "source": source, + "sources": sources, + "related": related, **kwargs, } kwargs.update(self.get_neat_related(message_type, related)) @@ -175,17 +180,17 @@ def process_send( message, recipient=recipient, logs=message_logs, **kwargs ) else: - status = 'Message not sent as SEND_MESSAGES==FALSE' + status = "Message not sent as SEND_MESSAGES==FALSE" message_logs.update_status(status) if not settings.SEND_MESSAGES: if recipient: - debug_message = '{} [to: {}]: {}'.format( + debug_message = "{} [to: {}]: {}".format( self.adapter_type, recipient, message ) else: - debug_message = '{}: {}'.format(self.adapter_type, message) + debug_message = "{}: {}".format(self.adapter_type, message) messages.add_message(request, messages.DEBUG, debug_message) def create_logs(self, message, recipient, *events): @@ -198,10 +203,10 @@ def create_logs(self, message, recipient, *events): def log_kwargs(self, message, recipient, event): return { - 'type': self.adapter_type, - 'content': message, - 'recipient': recipient or '', - 'event': event, + "type": self.adapter_type, + "content": message, + "recipient": recipient or "", + "event": event, } def send_message(self, message, **kwargs): diff --git a/hypha/apply/activity/adapters/django_messages.py b/hypha/apply/activity/adapters/django_messages.py index 2499ed6d3d..45f5f89b94 100644 --- a/hypha/apply/activity/adapters/django_messages.py +++ b/hypha/apply/activity/adapters/django_messages.py @@ -7,73 +7,84 @@ class DjangoMessagesAdapter(AdapterBase): - adapter_type = 'Django' + adapter_type = "Django" always_send = True messages = { - MESSAGES.BATCH_REVIEWERS_UPDATED: 'batch_reviewers_updated', - MESSAGES.BATCH_TRANSITION: 'batch_transition', - MESSAGES.BATCH_DETERMINATION_OUTCOME: 'batch_determinations', - MESSAGES.REMOVE_DOCUMENT: _('Successfully removed document'), - MESSAGES.SKIPPED_REPORT: 'handle_skipped_report', - MESSAGES.REPORT_FREQUENCY_CHANGED: 'handle_report_frequency', - MESSAGES.DISABLED_REPORTING: _('Reporting disabled'), - MESSAGES.CREATE_REMINDER: _('Reminder created'), - MESSAGES.DELETE_REMINDER: _('Reminder deleted'), + MESSAGES.BATCH_REVIEWERS_UPDATED: "batch_reviewers_updated", + MESSAGES.BATCH_TRANSITION: "batch_transition", + MESSAGES.BATCH_DETERMINATION_OUTCOME: "batch_determinations", + MESSAGES.REMOVE_DOCUMENT: _("Successfully removed document"), + MESSAGES.SKIPPED_REPORT: "handle_skipped_report", + MESSAGES.REPORT_FREQUENCY_CHANGED: "handle_report_frequency", + MESSAGES.DISABLED_REPORTING: _("Reporting disabled"), + MESSAGES.CREATE_REMINDER: _("Reminder created"), + MESSAGES.DELETE_REMINDER: _("Reminder deleted"), } def batch_reviewers_updated(self, added, sources, **kwargs): - reviewers_text = ' '.join([ - _('{user} as {name},').format(user=str(user), name=role.name) - for role, user in added - if user - ]) - - return ( - _('Batch reviewers added: {reviewers_text} to ').format(reviewers_text=reviewers_text) + ', '.join(['"{title}"'.format(title=source.title) for source in sources]) + reviewers_text = " ".join( + [ + _("{user} as {name},").format(user=str(user), name=role.name) + for role, user in added + if user + ] ) + return _("Batch reviewers added: {reviewers_text} to ").format( + reviewers_text=reviewers_text + ) + ", ".join(['"{title}"'.format(title=source.title) for source in sources]) + def handle_report_frequency(self, config, **kwargs): new_schedule = config.get_frequency_display() - return _('Successfully updated reporting frequency. They will now report {new_schedule} starting on {schedule_start}').format(new_schedule=new_schedule, schedule_start=config.schedule_start) + return _( + "Successfully updated reporting frequency. They will now report {new_schedule} starting on {schedule_start}" + ).format(new_schedule=new_schedule, schedule_start=config.schedule_start) def handle_skipped_report(self, report, **kwargs): if report.skipped: - return _('Successfully skipped a Report for {start_date} to {end_date}').format(start_date=report.start_date, end_date=report.end_date) + return _( + "Successfully skipped a Report for {start_date} to {end_date}" + ).format(start_date=report.start_date, end_date=report.end_date) else: - return _('Successfully unskipped a Report for {start_date} to {end_date}').format(start_date=report.start_date, end_date=report.end_date) + return _( + "Successfully unskipped a Report for {start_date} to {end_date}" + ).format(start_date=report.start_date, end_date=report.end_date) def batch_transition(self, sources, transitions, **kwargs): - base_message = 'Successfully updated:' - transition = '{submission} [{old_display} → {new_display}].' + base_message = "Successfully updated:" + transition = "{submission} [{old_display} → {new_display}]." transition_messages = [ transition.format( submission=submission.title, old_display=transitions[submission.id], new_display=submission.phase, - ) for submission in sources + ) + for submission in sources ] messages = [base_message, *transition_messages] - return ' '.join(messages) + return " ".join(messages) def batch_determinations(self, sources, determinations, **kwargs): submissions = sources outcome = determinations[submissions[0].id].clean_outcome - base_message = _('Successfully determined as {outcome}: ').format(outcome=outcome) - submissions_text = [ - str(submission.title) for submission in submissions - ] - return base_message + ', '.join(submissions_text) + base_message = _("Successfully determined as {outcome}: ").format( + outcome=outcome + ) + submissions_text = [str(submission.title) for submission in submissions] + return base_message + ", ".join(submissions_text) def recipients(self, *args, **kwargs): return [None] def batch_recipients(self, message_type, sources, *args, **kwargs): - return [{ - 'recipients': [None], - 'sources': sources, - }] + return [ + { + "recipients": [None], + "sources": sources, + } + ] def send_message(self, message, request, **kwargs): messages.add_message(request, messages.INFO, message) diff --git a/hypha/apply/activity/adapters/emails.py b/hypha/apply/activity/adapters/emails.py index 3003f831aa..406d936678 100644 --- a/hypha/apply/activity/adapters/emails.py +++ b/hypha/apply/activity/adapters/emails.py @@ -35,93 +35,117 @@ class EmailAdapter(AdapterBase): - adapter_type = 'Email' + adapter_type = "Email" messages = { - MESSAGES.NEW_SUBMISSION: 'messages/email/submission_confirmation.html', - MESSAGES.DRAFT_SUBMISSION: 'messages/email/submission_confirmation.html', - MESSAGES.COMMENT: 'notify_comment', - MESSAGES.EDIT_SUBMISSION: 'messages/email/submission_edit.html', - MESSAGES.TRANSITION: 'handle_transition', - MESSAGES.BATCH_TRANSITION: 'handle_batch_transition', - MESSAGES.DETERMINATION_OUTCOME: 'handle_determination', - MESSAGES.BATCH_DETERMINATION_OUTCOME: 'handle_batch_determination', - MESSAGES.INVITED_TO_PROPOSAL: 'messages/email/invited_to_proposal.html', - MESSAGES.BATCH_READY_FOR_REVIEW: 'handle_batch_ready_for_review', - MESSAGES.READY_FOR_REVIEW: 'handle_ready_for_review', - MESSAGES.REVIEWERS_UPDATED: 'handle_ready_for_review', - MESSAGES.BATCH_REVIEWERS_UPDATED: 'handle_batch_ready_for_review', - MESSAGES.PARTNERS_UPDATED: 'partners_updated_applicant', - MESSAGES.PARTNERS_UPDATED_PARTNER: 'partners_updated_partner', - MESSAGES.UPLOAD_CONTRACT: 'messages/email/contract_uploaded.html', - MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: 'messages/email/submit_contract_documents.html', - MESSAGES.CREATED_PROJECT: 'handle_project_created', - MESSAGES.UPDATED_VENDOR: 'handle_vendor_updated', - MESSAGES.SENT_TO_COMPLIANCE: 'messages/email/sent_to_compliance.html', - MESSAGES.SEND_FOR_APPROVAL: 'messages/email/paf_for_approval.html', - MESSAGES.REQUEST_PROJECT_CHANGE: 'messages/email/project_request_change.html', - MESSAGES.ASSIGN_PAF_APPROVER: 'messages/email/assign_paf_approvers.html', - MESSAGES.APPROVE_PAF: 'messages/email/paf_for_approval.html', - MESSAGES.UPDATE_INVOICE: 'handle_invoice_updated', - MESSAGES.UPDATE_INVOICE_STATUS: 'handle_invoice_status_updated', - MESSAGES.APPROVE_INVOICE: 'messages/email/invoice_approved.html', - MESSAGES.SUBMIT_REPORT: 'messages/email/report_submitted.html', - MESSAGES.SKIPPED_REPORT: 'messages/email/report_skipped.html', - MESSAGES.REPORT_FREQUENCY_CHANGED: 'messages/email/report_frequency.html', - MESSAGES.REPORT_NOTIFY: 'messages/email/report_notify.html', - MESSAGES.REVIEW_REMINDER: 'messages/email/ready_to_review.html', - MESSAGES.PROJECT_TRANSITION: 'handle_project_transition', + MESSAGES.NEW_SUBMISSION: "messages/email/submission_confirmation.html", + MESSAGES.DRAFT_SUBMISSION: "messages/email/submission_confirmation.html", + MESSAGES.COMMENT: "notify_comment", + MESSAGES.EDIT_SUBMISSION: "messages/email/submission_edit.html", + MESSAGES.TRANSITION: "handle_transition", + MESSAGES.BATCH_TRANSITION: "handle_batch_transition", + MESSAGES.DETERMINATION_OUTCOME: "handle_determination", + MESSAGES.BATCH_DETERMINATION_OUTCOME: "handle_batch_determination", + MESSAGES.INVITED_TO_PROPOSAL: "messages/email/invited_to_proposal.html", + MESSAGES.BATCH_READY_FOR_REVIEW: "handle_batch_ready_for_review", + MESSAGES.READY_FOR_REVIEW: "handle_ready_for_review", + MESSAGES.REVIEWERS_UPDATED: "handle_ready_for_review", + MESSAGES.BATCH_REVIEWERS_UPDATED: "handle_batch_ready_for_review", + MESSAGES.PARTNERS_UPDATED: "partners_updated_applicant", + MESSAGES.PARTNERS_UPDATED_PARTNER: "partners_updated_partner", + MESSAGES.UPLOAD_CONTRACT: "messages/email/contract_uploaded.html", + MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: "messages/email/submit_contract_documents.html", + MESSAGES.CREATED_PROJECT: "handle_project_created", + MESSAGES.UPDATED_VENDOR: "handle_vendor_updated", + MESSAGES.SENT_TO_COMPLIANCE: "messages/email/sent_to_compliance.html", + MESSAGES.SEND_FOR_APPROVAL: "messages/email/paf_for_approval.html", + MESSAGES.REQUEST_PROJECT_CHANGE: "messages/email/project_request_change.html", + MESSAGES.ASSIGN_PAF_APPROVER: "messages/email/assign_paf_approvers.html", + MESSAGES.APPROVE_PAF: "messages/email/paf_for_approval.html", + MESSAGES.UPDATE_INVOICE: "handle_invoice_updated", + MESSAGES.UPDATE_INVOICE_STATUS: "handle_invoice_status_updated", + MESSAGES.APPROVE_INVOICE: "messages/email/invoice_approved.html", + MESSAGES.SUBMIT_REPORT: "messages/email/report_submitted.html", + MESSAGES.SKIPPED_REPORT: "messages/email/report_skipped.html", + MESSAGES.REPORT_FREQUENCY_CHANGED: "messages/email/report_frequency.html", + MESSAGES.REPORT_NOTIFY: "messages/email/report_notify.html", + MESSAGES.REVIEW_REMINDER: "messages/email/ready_to_review.html", + MESSAGES.PROJECT_TRANSITION: "handle_project_transition", } def get_subject(self, message_type, source): - if source and hasattr(source, 'title'): + if source and hasattr(source, "title"): if is_ready_for_review(message_type) or is_reviewer_update(message_type): - subject = _('Application ready to review: {source.title}').format( + subject = _("Application ready to review: {source.title}").format( source=source ) if message_type in { MESSAGES.BATCH_READY_FOR_REVIEW, MESSAGES.BATCH_REVIEWERS_UPDATED, }: - subject = _('Multiple applications are now ready for your review') + subject = _("Multiple applications are now ready for your review") elif message_type in {MESSAGES.REVIEW_REMINDER}: subject = _( - 'Reminder: Application ready to review: {source.title}' + "Reminder: Application ready to review: {source.title}" ).format(source=source) - elif message_type in [MESSAGES.SENT_TO_COMPLIANCE, MESSAGES.APPROVE_PAF, MESSAGES.SEND_FOR_APPROVAL]: - subject = _('Project is waiting for approval: {source.title}').format(source=source) + elif message_type in [ + MESSAGES.SENT_TO_COMPLIANCE, + MESSAGES.APPROVE_PAF, + MESSAGES.SEND_FOR_APPROVAL, + ]: + subject = _("Project is waiting for approval: {source.title}").format( + source=source + ) elif message_type == MESSAGES.UPLOAD_CONTRACT: - subject = _('Contract uploaded for the project: {source.title}').format(source=source) + subject = _("Contract uploaded for the project: {source.title}").format( + source=source + ) elif message_type == MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: - subject = _('Contract Documents required approval for the project: {source.title}').format(source=source) + subject = _( + "Contract Documents required approval for the project: {source.title}" + ).format(source=source) elif message_type == MESSAGES.PROJECT_TRANSITION: from hypha.apply.projects.models.project import ( CONTRACTING, INVOICING_AND_REPORTING, ) + if source.status == CONTRACTING: - subject = _('Project is waiting for the contract: {source.title}').format(source=source) + subject = _( + "Project is waiting for the contract: {source.title}" + ).format(source=source) elif source.status == INVOICING_AND_REPORTING: - subject = _('Project is ready for invoicing: {source.title}').format(source=source) + subject = _( + "Project is ready for invoicing: {source.title}" + ).format(source=source) else: - subject = _('Project status has changed to {project_status}: {source.title}').format(project_status=display_project_status(source, source.user), source=source) + subject = _( + "Project status has changed to {project_status}: {source.title}" + ).format( + project_status=display_project_status(source, source.user), + source=source, + ) elif message_type == MESSAGES.REQUEST_PROJECT_CHANGE: subject = _("Project has been rejected, please update and resubmit") elif message_type == MESSAGES.ASSIGN_PAF_APPROVER: - subject = _("Project documents are ready to be assigned for approval: {source.title}".format(source=source)) + subject = _( + "Project documents are ready to be assigned for approval: {source.title}".format( + source=source + ) + ) else: try: subject = source.page.specific.subject or _( - 'Your application to {org_long_name}: {source.title}' + "Your application to {org_long_name}: {source.title}" ).format(org_long_name=settings.ORG_LONG_NAME, source=source) except AttributeError: - subject = _('Your {org_long_name} Project: {source.title}').format( + subject = _("Your {org_long_name} Project: {source.title}").format( org_long_name=settings.ORG_LONG_NAME, source=source ) return subject def extra_kwargs(self, message_type, source, sources, **kwargs): return { - 'subject': self.get_subject(message_type, source), + "subject": self.get_subject(message_type, source), } def handle_transition(self, old_phase, source, **kwargs): @@ -135,7 +159,7 @@ def handle_transition(self, old_phase, source, **kwargs): if is_forward: return self.render_message( - 'messages/email/transition.html', + "messages/email/transition.html", source=submission, old_phase=old_phase, **kwargs, @@ -143,7 +167,7 @@ def handle_transition(self, old_phase, source, **kwargs): def handle_batch_transition(self, transitions, sources, **kwargs): submissions = sources - kwargs.pop('source') + kwargs.pop("source") for submission in submissions: old_phase = transitions[submission.id] return self.handle_transition( @@ -155,46 +179,47 @@ def handle_project_transition(self, source, **kwargs): CONTRACTING, INVOICING_AND_REPORTING, ) + if source.status == CONTRACTING: return self.render_message( - 'messages/email/ready_for_contracting.html', + "messages/email/ready_for_contracting.html", source=source, **kwargs, ) if source.status == INVOICING_AND_REPORTING: return self.render_message( - 'messages/email/ready_for_invoicing.html', + "messages/email/ready_for_invoicing.html", source=source, **kwargs, ) def handle_invoice_status_updated(self, related, **kwargs): return self.render_message( - 'messages/email/invoice_status_updated.html', + "messages/email/invoice_status_updated.html", has_changes_requested=related.has_changes_requested, **kwargs, ) def handle_invoice_updated(self, **kwargs): return self.render_message( - 'messages/email/invoice_updated.html', + "messages/email/invoice_updated.html", **kwargs, ) def handle_project_created(self, source, **kwargs): from hypha.apply.projects.models import ProjectSettings - request = kwargs.get('request') + request = kwargs.get("request") project_settings = ProjectSettings.for_request(request) if project_settings.vendor_setup_required: return self.render_message( - 'messages/email/vendor_setup_needed.html', source=source, **kwargs + "messages/email/vendor_setup_needed.html", source=source, **kwargs ) def handle_vendor_updated(self, source, **kwargs): return self.render_message( - 'messages/email/vendor_updated.html', + "messages/email/vendor_updated.html", source=source, **kwargs, ) @@ -203,7 +228,7 @@ def handle_determination(self, determination, source, **kwargs): submission = source if determination.send_notice: return self.render_message( - 'messages/email/determination.html', + "messages/email/determination.html", source=submission, determination=determination, **kwargs, @@ -211,11 +236,11 @@ def handle_determination(self, determination, source, **kwargs): def handle_batch_determination(self, determinations, sources, **kwargs): submissions = sources - kwargs.pop('source') + kwargs.pop("source") for submission in submissions: determination = determinations[submission.id] return self.render_message( - 'messages/email/determination.html', + "messages/email/determination.html", source=submission, determination=determination, **kwargs, @@ -224,7 +249,7 @@ def handle_batch_determination(self, determinations, sources, **kwargs): def handle_ready_for_review(self, request, source, **kwargs): if settings.SEND_READY_FOR_REVIEW: return self.render_message( - 'messages/email/ready_to_review.html', + "messages/email/ready_to_review.html", source=source, request=request, **kwargs, @@ -233,17 +258,17 @@ def handle_ready_for_review(self, request, source, **kwargs): def handle_batch_ready_for_review(self, request, sources, **kwargs): if settings.SEND_READY_FOR_REVIEW: return self.render_message( - 'messages/email/batch_ready_to_review.html', + "messages/email/batch_ready_to_review.html", sources=sources, request=request, **kwargs, ) def notify_comment(self, **kwargs): - comment = kwargs['comment'] - source = kwargs['source'] + comment = kwargs["comment"] + source = kwargs["source"] if not comment.priviledged and not comment.user == source.user: - return self.render_message('messages/email/comment.html', **kwargs) + return self.render_message("messages/email/comment.html", **kwargs) def recipients(self, message_type, source, user, **kwargs): if is_ready_for_review(message_type): @@ -265,46 +290,79 @@ def recipients(self, message_type, source, user, **kwargs): return [] if message_type == MESSAGES.PARTNERS_UPDATED_PARTNER: - partners = kwargs['added'] + partners = kwargs["added"] return [partner.email for partner in partners] if message_type in [MESSAGES.SEND_FOR_APPROVAL, MESSAGES.APPROVE_PAF]: from hypha.apply.projects.models.project import ProjectSettings + # notify the assigned approvers - request = kwargs.get('request') + request = kwargs.get("request") project_settings = ProjectSettings.for_request(request) if project_settings.paf_approval_sequential: next_paf_approval = source.paf_approvals.filter(approved=False).first() if next_paf_approval and next_paf_approval.user: return [next_paf_approval.user.email] - return list(filter(lambda approver: approver is not None, source.paf_approvals.filter(approved=False).values_list('user__email', flat=True))) + return list( + filter( + lambda approver: approver is not None, + source.paf_approvals.filter(approved=False).values_list( + "user__email", flat=True + ), + ) + ) if message_type == MESSAGES.ASSIGN_PAF_APPROVER: from hypha.apply.projects.models.project import ProjectSettings + # notify PAFReviewerRole's groups' users to assign approvers - request = kwargs.get('request') + request = kwargs.get("request") project_settings = ProjectSettings.for_request(request) if project_settings.paf_approval_sequential: next_paf_approval = source.paf_approvals.filter(approved=False).first() if next_paf_approval and not next_paf_approval.user: - assigners = get_users_for_groups(list(next_paf_approval.paf_reviewer_role.user_roles.all()), exact_match=True) + assigners = get_users_for_groups( + list(next_paf_approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ) return [assigner.email for assigner in assigners] assigners_emails = [] if user == source.lead: - for approval in source.paf_approvals.filter(approved=False, user__isnull=True): - assigners_emails.extend([assigner.email for assigner in get_users_for_groups(list(approval.paf_reviewer_role.user_roles.all()), exact_match=True)]) + for approval in source.paf_approvals.filter( + approved=False, user__isnull=True + ): + assigners_emails.extend( + [ + assigner.email + for assigner in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ) + ] + ) else: - assigners_emails.extend([assigner.email for assigner in - get_users_for_groups(list(user.groups.all()), - exact_match=True)]) + assigners_emails.extend( + [ + assigner.email + for assigner in get_users_for_groups( + list(user.groups.all()), exact_match=True + ) + ] + ) return set(assigners_emails) if message_type == MESSAGES.REQUEST_PROJECT_CHANGE: return [source.lead.email] if message_type == MESSAGES.SENT_TO_COMPLIANCE: - return get_compliance_email(target_user_gps=[CONTRACTING_GROUP_NAME, FINANCE_GROUP_NAME, STAFF_GROUP_NAME]) + return get_compliance_email( + target_user_gps=[ + CONTRACTING_GROUP_NAME, + FINANCE_GROUP_NAME, + STAFF_GROUP_NAME, + ] + ) if message_type == MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: return get_compliance_email(target_user_gps=[STAFF_GROUP_NAME]) @@ -318,7 +376,7 @@ def recipients(self, message_type, source, user, **kwargs): return self.reviewers(source) if message_type == MESSAGES.UPDATE_INVOICE_STATUS: - related = kwargs.get('related', None) + related = kwargs.get("related", None) if related: if related.status in {CHANGES_REQUESTED_BY_STAFF, DECLINED}: return [source.user.email] @@ -329,6 +387,7 @@ def recipients(self, message_type, source, user, **kwargs): CONTRACTING, INVOICING_AND_REPORTING, ) + if source.status == CONTRACTING: return get_compliance_email(target_user_gps=[CONTRACTING_GROUP_NAME]) if source.status == INVOICING_AND_REPORTING: @@ -338,8 +397,12 @@ def recipients(self, message_type, source, user, **kwargs): if user.is_apply_staff: return get_compliance_email(target_user_gps=[FINANCE_GROUP_NAME]) if settings.INVOICE_EXTENDED_WORKFLOW and user.is_finance_level_1: - finance_2_users_email = User.objects.active().filter(groups__name=FINANCE_GROUP_NAME).\ - filter(groups__name=APPROVER_GROUP_NAME).values_list('email', flat=True) + finance_2_users_email = ( + User.objects.active() + .filter(groups__name=FINANCE_GROUP_NAME) + .filter(groups__name=APPROVER_GROUP_NAME) + .values_list("email", flat=True) + ) return finance_2_users_email return [] @@ -362,8 +425,8 @@ def batch_recipients(self, message_type, sources, **kwargs): return [ { - 'recipients': [reviewer], - 'sources': sources, + "recipients": [reviewer], + "sources": sources, } for reviewer, sources in reviewers_to_message.items() ] @@ -379,19 +442,18 @@ def reviewers(self, source): def partners_updated_applicant(self, added, removed, **kwargs): if added: return self.render_message( - 'messages/email/partners_update_applicant.html', added=added, **kwargs + "messages/email/partners_update_applicant.html", added=added, **kwargs ) def partners_updated_partner(self, added, removed, **kwargs): for _partner in added: return self.render_message( - 'messages/email/partners_update_partner.html', **kwargs + "messages/email/partners_update_partner.html", **kwargs ) def render_message(self, template, **kwargs): - with language(settings.LANGUAGE_CODE): - text = render_to_string(template, kwargs, kwargs['request']) + text = render_to_string(template, kwargs, kwargs["request"]) return remove_extra_empty_lines(text) @@ -407,4 +469,4 @@ def send_message(self, message, source, subject, recipient, logs, **kwargs): try: send_mail(subject, message, from_email, [recipient], logs=logs) except Exception as e: - return 'Error: ' + str(e) + return "Error: " + str(e) diff --git a/hypha/apply/activity/adapters/slack.py b/hypha/apply/activity/adapters/slack.py index 5c62387f83..5925265e96 100644 --- a/hypha/apply/activity/adapters/slack.py +++ b/hypha/apply/activity/adapters/slack.py @@ -24,53 +24,111 @@ class SlackAdapter(AdapterBase): - """Notification Adaptor for internal staff on the configured slack channels. - """ + """Notification Adaptor for internal staff on the configured slack channels.""" + adapter_type = "Slack" always_send = True messages = { - MESSAGES.NEW_SUBMISSION: _('A new submission has been submitted for {source.page.title}: <{link}|{source.title}> by {user}'), - MESSAGES.UPDATE_LEAD: _('The lead of <{link}|{source.title}> has been updated from {old_lead} to {source.lead} by {user}'), - MESSAGES.BATCH_UPDATE_LEAD: 'handle_batch_lead', - MESSAGES.COMMENT: _('A new {comment.visibility} comment has been posted on <{link}|{source.title}> by {user}'), - MESSAGES.EDIT_SUBMISSION: _('{user} has edited <{link}|{source.title}>'), - MESSAGES.APPLICANT_EDIT: _('{user} has edited <{link}|{source.title}>'), - MESSAGES.REVIEWERS_UPDATED: 'reviewers_updated', - MESSAGES.BATCH_REVIEWERS_UPDATED: 'handle_batch_reviewers', - MESSAGES.PARTNERS_UPDATED: _('{user} has updated the partners on <{link}|{source.title}>'), - MESSAGES.TRANSITION: _('{user} has updated the status of <{link}|{source.title}>: {old_phase.display_name} → {source.phase}'), - MESSAGES.BATCH_TRANSITION: 'handle_batch_transition', - MESSAGES.DETERMINATION_OUTCOME: 'handle_determination', - MESSAGES.BATCH_DETERMINATION_OUTCOME: 'handle_batch_determination', - MESSAGES.PROPOSAL_SUBMITTED: _('A proposal has been submitted for review: <{link}|{source.title}>'), - MESSAGES.INVITED_TO_PROPOSAL: _('<{link}|{source.title}> by {source.user} has been invited to submit a proposal'), - MESSAGES.NEW_REVIEW: _('{user} has submitted a review for <{link}|{source.title}>. Outcome: {review.outcome}, Score: {review.get_score_display}'), - MESSAGES.READY_FOR_REVIEW: 'notify_reviewers', - MESSAGES.OPENED_SEALED: _('{user} has opened the sealed submission: <{link}|{source.title}>'), - MESSAGES.REVIEW_OPINION: _('{user} {opinion.opinion_display}s with {opinion.review.author}s review of <{link}|{source.title}>'), - MESSAGES.BATCH_READY_FOR_REVIEW: 'batch_notify_reviewers', - MESSAGES.DELETE_SUBMISSION: _('{user} has deleted {source.title}'), - MESSAGES.DELETE_REVIEW: _('{user} has deleted {review.author} review for <{link}|{source.title}>'), - MESSAGES.CREATED_PROJECT: _('{user} has created a Project: <{link}|{source.title}>'), - MESSAGES.UPDATE_PROJECT_LEAD: _('The lead of project <{link}|{source.title}> has been updated from {old_lead} to {source.lead} by {user}'), - MESSAGES.EDIT_REVIEW: _('{user} has edited {review.author} review for <{link}|{source.title}>'), - MESSAGES.SEND_FOR_APPROVAL: _('{user} has requested approval on project <{link}|{source.title}>'), - MESSAGES.APPROVE_PROJECT: _('{user} has approved project <{link}|{source.title}>'), - MESSAGES.REQUEST_PROJECT_CHANGE: _('{user} has requested changes for project acceptance on <{link}|{source.title}>'), - MESSAGES.UPLOAD_CONTRACT: _('{user} has uploaded a contract for <{link}|{source.title}>'), - MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: _('{user} has submitted the contracting document for project <{link}|{source.title}>'), - MESSAGES.APPROVE_CONTRACT: _('{user} has approved contract for <{link}|{source.title}>'), - MESSAGES.CREATE_INVOICE: _('{user} has created invoice for <{link}|{source.title}>'), - MESSAGES.UPDATE_INVOICE_STATUS: _('{user} has changed the status of <{link_related}|invoice> on <{link}|{source.title}> to {invoice.status_display}'), - MESSAGES.DELETE_INVOICE: _('{user} has deleted invoice from <{link}|{source.title}>'), - MESSAGES.UPDATE_INVOICE: _('{user} has updated invoice for <{link}|{source.title}>'), - MESSAGES.SUBMIT_REPORT: _('{user} has submitted a report for <{link}|{source.title}>'), - MESSAGES.BATCH_DELETE_SUBMISSION: 'handle_batch_delete_submission', - MESSAGES.STAFF_ACCOUNT_CREATED: _('{user} has created a new account for <{link}|{source}>'), - MESSAGES.STAFF_ACCOUNT_EDITED: _('{user} has edited account for <{link}|{source}> that now has following roles: {roles}'), - MESSAGES.BATCH_ARCHIVE_SUBMISSION: 'handle_batch_archive_submission', - MESSAGES.ARCHIVE_SUBMISSION: _('{user} has archived the submission: {source.title}'), - MESSAGES.UNARCHIVE_SUBMISSION: _('{user} has unarchived the submission: {source.title}'), + MESSAGES.NEW_SUBMISSION: _( + "A new submission has been submitted for {source.page.title}: <{link}|{source.title}> by {user}" + ), + MESSAGES.UPDATE_LEAD: _( + "The lead of <{link}|{source.title}> has been updated from {old_lead} to {source.lead} by {user}" + ), + MESSAGES.BATCH_UPDATE_LEAD: "handle_batch_lead", + MESSAGES.COMMENT: _( + "A new {comment.visibility} comment has been posted on <{link}|{source.title}> by {user}" + ), + MESSAGES.EDIT_SUBMISSION: _("{user} has edited <{link}|{source.title}>"), + MESSAGES.APPLICANT_EDIT: _("{user} has edited <{link}|{source.title}>"), + MESSAGES.REVIEWERS_UPDATED: "reviewers_updated", + MESSAGES.BATCH_REVIEWERS_UPDATED: "handle_batch_reviewers", + MESSAGES.PARTNERS_UPDATED: _( + "{user} has updated the partners on <{link}|{source.title}>" + ), + MESSAGES.TRANSITION: _( + "{user} has updated the status of <{link}|{source.title}>: {old_phase.display_name} → {source.phase}" + ), + MESSAGES.BATCH_TRANSITION: "handle_batch_transition", + MESSAGES.DETERMINATION_OUTCOME: "handle_determination", + MESSAGES.BATCH_DETERMINATION_OUTCOME: "handle_batch_determination", + MESSAGES.PROPOSAL_SUBMITTED: _( + "A proposal has been submitted for review: <{link}|{source.title}>" + ), + MESSAGES.INVITED_TO_PROPOSAL: _( + "<{link}|{source.title}> by {source.user} has been invited to submit a proposal" + ), + MESSAGES.NEW_REVIEW: _( + "{user} has submitted a review for <{link}|{source.title}>. Outcome: {review.outcome}, Score: {review.get_score_display}" + ), + MESSAGES.READY_FOR_REVIEW: "notify_reviewers", + MESSAGES.OPENED_SEALED: _( + "{user} has opened the sealed submission: <{link}|{source.title}>" + ), + MESSAGES.REVIEW_OPINION: _( + "{user} {opinion.opinion_display}s with {opinion.review.author}s review of <{link}|{source.title}>" + ), + MESSAGES.BATCH_READY_FOR_REVIEW: "batch_notify_reviewers", + MESSAGES.DELETE_SUBMISSION: _("{user} has deleted {source.title}"), + MESSAGES.DELETE_REVIEW: _( + "{user} has deleted {review.author} review for <{link}|{source.title}>" + ), + MESSAGES.CREATED_PROJECT: _( + "{user} has created a Project: <{link}|{source.title}>" + ), + MESSAGES.UPDATE_PROJECT_LEAD: _( + "The lead of project <{link}|{source.title}> has been updated from {old_lead} to {source.lead} by {user}" + ), + MESSAGES.EDIT_REVIEW: _( + "{user} has edited {review.author} review for <{link}|{source.title}>" + ), + MESSAGES.SEND_FOR_APPROVAL: _( + "{user} has requested approval on project <{link}|{source.title}>" + ), + MESSAGES.APPROVE_PROJECT: _( + "{user} has approved project <{link}|{source.title}>" + ), + MESSAGES.REQUEST_PROJECT_CHANGE: _( + "{user} has requested changes for project acceptance on <{link}|{source.title}>" + ), + MESSAGES.UPLOAD_CONTRACT: _( + "{user} has uploaded a contract for <{link}|{source.title}>" + ), + MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: _( + "{user} has submitted the contracting document for project <{link}|{source.title}>" + ), + MESSAGES.APPROVE_CONTRACT: _( + "{user} has approved contract for <{link}|{source.title}>" + ), + MESSAGES.CREATE_INVOICE: _( + "{user} has created invoice for <{link}|{source.title}>" + ), + MESSAGES.UPDATE_INVOICE_STATUS: _( + "{user} has changed the status of <{link_related}|invoice> on <{link}|{source.title}> to {invoice.status_display}" + ), + MESSAGES.DELETE_INVOICE: _( + "{user} has deleted invoice from <{link}|{source.title}>" + ), + MESSAGES.UPDATE_INVOICE: _( + "{user} has updated invoice for <{link}|{source.title}>" + ), + MESSAGES.SUBMIT_REPORT: _( + "{user} has submitted a report for <{link}|{source.title}>" + ), + MESSAGES.BATCH_DELETE_SUBMISSION: "handle_batch_delete_submission", + MESSAGES.STAFF_ACCOUNT_CREATED: _( + "{user} has created a new account for <{link}|{source}>" + ), + MESSAGES.STAFF_ACCOUNT_EDITED: _( + "{user} has edited account for <{link}|{source}> that now has following roles: {roles}" + ), + MESSAGES.BATCH_ARCHIVE_SUBMISSION: "handle_batch_archive_submission", + MESSAGES.ARCHIVE_SUBMISSION: _( + "{user} has archived the submission: {source.title}" + ), + MESSAGES.UNARCHIVE_SUBMISSION: _( + "{user} has unarchived the submission: {source.title}" + ), } def __init__(self): @@ -81,20 +139,20 @@ def __init__(self): self.comments_type = settings.SLACK_TYPE_COMMENTS def slack_links(self, links, sources): - return ', '.join(f'<{links[source.id]}|{source.title}>' for source in sources) + return ", ".join(f"<{links[source.id]}|{source.title}>" for source in sources) def extra_kwargs(self, message_type, **kwargs): - source = kwargs['source'] - sources = kwargs['sources'] - request = kwargs['request'] - related = kwargs['related'] + source = kwargs["source"] + sources = kwargs["sources"] + request = kwargs["request"] + related = kwargs["related"] link = link_to(source, request) link_related = link_to(related, request) links = {source.id: link_to(source, request) for source in sources} return { - 'link': link, - 'link_related': link_related, - 'links': links, + "link": link, + "link_related": link_related, + "links": links, } def recipients(self, message_type, source, related, **kwargs): @@ -102,7 +160,7 @@ def recipients(self, message_type, source, related, **kwargs): MESSAGES.STAFF_ACCOUNT_CREATED, MESSAGES.STAFF_ACCOUNT_EDITED, ]: - return [self.slack_id(kwargs['user'])] + return [self.slack_id(kwargs["user"])] if message_type == MESSAGES.SEND_FOR_APPROVAL: return [ @@ -153,44 +211,42 @@ def recipients(self, message_type, source, related, **kwargs): def batch_recipients(self, message_type, sources, **kwargs): # We group the messages by lead - leads = User.objects.filter(id__in=sources.values('lead')) + leads = User.objects.filter(id__in=sources.values("lead")) return [ { - 'recipients': [self.slack_id(lead)], - 'sources': sources.filter(lead=lead), + "recipients": [self.slack_id(lead)], + "sources": sources.filter(lead=lead), } for lead in leads ] - def reviewers_updated( - self, source, link, user, added=None, removed=None, **kwargs - ): + def reviewers_updated(self, source, link, user, added=None, removed=None, **kwargs): if added is None: added = [] if removed is None: removed = [] submission = source message = [ - _('{user} has updated the reviewers on <{link}|{title}>').format( + _("{user} has updated the reviewers on <{link}|{title}>").format( user=user, link=link, title=submission.title ) ] if added: - message.append(_('Added:')) + message.append(_("Added:")) message.extend(reviewers_message(added)) if removed: - message.append(_('Removed:')) + message.append(_("Removed:")) message.extend(reviewers_message(removed)) - return ' '.join(message) + return " ".join(message) def handle_batch_lead(self, sources, links, user, new_lead, **kwargs): submissions = sources submissions_text = self.slack_links(links, submissions) return _( - '{user} has batch changed lead to {new_lead} on: {submissions_text}' + "{user} has batch changed lead to {new_lead} on: {submissions_text}" ).format( user=user, submissions_text=submissions_text, @@ -200,15 +256,15 @@ def handle_batch_lead(self, sources, links, user, new_lead, **kwargs): def handle_batch_reviewers(self, sources, links, user, added, **kwargs): submissions = sources submissions_text = self.slack_links(links, submissions) - reviewers_text = ' '.join( + reviewers_text = " ".join( [ - _('{user} as {name},').format(user=str(user), name=role.name) + _("{user} as {name},").format(user=str(user), name=role.name) for role, user in added if user ] ) return _( - '{user} has batch added {reviewers_text} as reviewers on: {submissions_text}' + "{user} has batch added {reviewers_text} as reviewers on: {submissions_text}" ).format( user=user, submissions_text=submissions_text, @@ -218,17 +274,17 @@ def handle_batch_reviewers(self, sources, links, user, added, **kwargs): def handle_batch_transition(self, user, links, sources, transitions, **kwargs): submissions = sources submissions_text = [ - ': '.join( + ": ".join( [ self.slack_links(links, [submission]), - f'{transitions[submission.id].display_name} → {submission.phase}', + f"{transitions[submission.id].display_name} → {submission.phase}", ] ) for submission in submissions ] - submissions_links = ','.join(submissions_text) + submissions_links = ",".join(submissions_text) return _( - '{user} has transitioned the following submissions: {submissions_links}' + "{user} has transitioned the following submissions: {submissions_links}" ).format( user=user, submissions_links=submissions_links, @@ -238,14 +294,14 @@ def handle_determination(self, source, link, determination, **kwargs): submission = source if determination.send_notice: return _( - 'A determination for <{link}|{submission_title}> was sent by email. Outcome: {determination_outcome}' + "A determination for <{link}|{submission_title}> was sent by email. Outcome: {determination_outcome}" ).format( link=link, submission_title=submission.title, determination_outcome=determination.clean_outcome, ) return _( - 'A determination for <{link}|{submission_title}> was saved without sending an email. Outcome: {determination_outcome}' + "A determination for <{link}|{submission_title}> was saved without sending an email. Outcome: {determination_outcome}" ).format( link=link, submission_title=submission.title, @@ -254,14 +310,14 @@ def handle_determination(self, source, link, determination, **kwargs): def handle_batch_determination(self, sources, links, determinations, **kwargs): submissions = sources - submissions_links = ','.join( + submissions_links = ",".join( [self.slack_links(links, [submission]) for submission in submissions] ) outcome = determinations[submissions[0].id].clean_outcome return _( - 'Determinations of {outcome} was sent for: {submissions_links}' + "Determinations of {outcome} was sent for: {submissions_links}" ).format( outcome=outcome, submissions_links=submissions_links, @@ -269,15 +325,15 @@ def handle_batch_determination(self, sources, links, determinations, **kwargs): def handle_batch_delete_submission(self, sources, links, user, **kwargs): submissions = sources - submissions_text = ', '.join([submission.title for submission in submissions]) - return _('{user} has deleted submissions: {title}').format( + submissions_text = ", ".join([submission.title for submission in submissions]) + return _("{user} has deleted submissions: {title}").format( user=user, title=submissions_text ) def handle_batch_archive_submission(self, sources, links, user, **kwargs): submissions = sources - submissions_text = ', '.join([submission.title for submission in submissions]) - return _('{user} has archived submissions: {title}').format( + submissions_text = ", ".join([submission.title for submission in submissions]) + return _("{user} has archived submissions: {title}").format( user=user, title=submissions_text ) @@ -288,10 +344,10 @@ def notify_reviewers(self, source, link, **kwargs): if submission.phase.permissions.can_review(reviewer): reviewers_to_notify.append(reviewer) - reviewers = ', '.join(str(reviewer) for reviewer in reviewers_to_notify) + reviewers = ", ".join(str(reviewer) for reviewer in reviewers_to_notify) return _( - '<{link}|{title}> is ready for review. The following are assigned as reviewers: {reviewers}' + "<{link}|{title}> is ready for review. The following are assigned as reviewers: {reviewers}" ).format( link=link, reviewers=reviewers, @@ -299,27 +355,27 @@ def notify_reviewers(self, source, link, **kwargs): ) def batch_notify_reviewers(self, sources, links, **kwargs): - kwargs.pop('source') - kwargs.pop('link') - return '. '.join( + kwargs.pop("source") + kwargs.pop("link") + return ". ".join( self.notify_reviewers(source, link=links[source.id], **kwargs) for source in sources ) def slack_id(self, user): if user is None: - return '' + return "" if not user.slack: - return '' + return "" - return f'<{user.slack}>' + return f"<{user.slack}>" def slack_channels(self, source, **kwargs): # Set the default room as a start. target_rooms = [self.target_room] try: - fund_slack_channel = source.get_from_parent('slack_channel').split(',') + fund_slack_channel = source.get_from_parent("slack_channel").split(",") except AttributeError: # Not a submission object. pass @@ -330,7 +386,7 @@ def slack_channels(self, source, **kwargs): target_rooms = custom_rooms try: - comment = kwargs['comment'] + comment = kwargs["comment"] except KeyError: # Not a comment, no extra rooms. pass @@ -344,7 +400,7 @@ def slack_channels(self, source, **kwargs): # Make sure each channel name starts with a "#". target_rooms = [ - room.strip() if room.startswith('#') else '#' + room.strip() + room.strip() if room.startswith("#") else "#" + room.strip() for room in target_rooms if room ] @@ -357,20 +413,20 @@ def send_message(self, message, recipient, source, **kwargs): if not any(target_rooms) or not settings.SLACK_TOKEN: errors = [] if not target_rooms: - errors.append('Room ID') + errors.append("Room ID") if not settings.SLACK_TOKEN: - errors.append('Slack Token') - return 'Missing configuration: {}'.format(', '.join(errors)) + errors.append("Slack Token") + return "Missing configuration: {}".format(", ".join(errors)) - message = ' '.join([recipient, message]).strip() + message = " ".join([recipient, message]).strip() data = { "message": message, } for room in target_rooms: try: - slack_message('messages/slack_message.html', data, channel=room) + slack_message("messages/slack_message.html", data, channel=room) except Exception as e: logger.exception(e) - return '400: Bad Request' - return '200: OK' + return "400: Bad Request" + return "200: OK" diff --git a/hypha/apply/activity/adapters/utils.py b/hypha/apply/activity/adapters/utils.py index a85622472e..ecaffde8a6 100644 --- a/hypha/apply/activity/adapters/utils.py +++ b/hypha/apply/activity/adapters/utils.py @@ -24,8 +24,8 @@ def link_to(target, request): - if target and hasattr(target, 'get_absolute_url'): - return request.scheme + '://' + request.get_host() + target.get_absolute_url() + if target and hasattr(target, "get_absolute_url"): + return request.scheme + "://" + request.get_host() + target.get_absolute_url() def group_reviewers(reviewers): @@ -38,10 +38,10 @@ def group_reviewers(reviewers): def reviewers_message(reviewers): messages = [] for role, reviewers_ in group_reviewers(reviewers).items(): - message = ', '.join(str(reviewer) for reviewer in reviewers_) + message = ", ".join(str(reviewer) for reviewer in reviewers_) if role: - message += _(' as {role}').format(role=str(role)) - message += '.' + message += _(" as {role}").format(role=str(role)) + message += "." messages.append(message) return messages @@ -55,15 +55,28 @@ def is_ready_for_review(message_type): def is_invoice_public_transition(invoice): - if invoice.status in [SUBMITTED, RESUBMITTED, CHANGES_REQUESTED_BY_STAFF, APPROVED_BY_FINANCE_2, DECLINED, PAID]: + if invoice.status in [ + SUBMITTED, + RESUBMITTED, + CHANGES_REQUESTED_BY_STAFF, + APPROVED_BY_FINANCE_2, + DECLINED, + PAID, + ]: return True - if not settings.INVOICE_EXTENDED_WORKFLOW and invoice.status == APPROVED_BY_FINANCE_1: + if ( + not settings.INVOICE_EXTENDED_WORKFLOW + and invoice.status == APPROVED_BY_FINANCE_1 + ): return True return False def is_reviewer_update(message_type): - return message_type in [MESSAGES.REVIEWERS_UPDATED, MESSAGES.BATCH_REVIEWERS_UPDATED] + return message_type in [ + MESSAGES.REVIEWERS_UPDATED, + MESSAGES.BATCH_REVIEWERS_UPDATED, + ] def get_compliance_email(target_user_gps=None): @@ -111,12 +124,17 @@ def get_users_for_groups(groups, user_queryset=None, exact_match=False): if groups: if not user_queryset: if exact_match: - user_queryset = User.objects.active().annotate(group_count=Count('groups')).filter(group_count=len(groups), groups__name=groups.pop().name) + user_queryset = ( + User.objects.active() + .annotate(group_count=Count("groups")) + .filter(group_count=len(groups), groups__name=groups.pop().name) + ) else: - user_queryset = User.objects.active().filter(groups__name=groups.pop().name) + user_queryset = User.objects.active().filter( + groups__name=groups.pop().name + ) else: user_queryset = user_queryset.filter(groups__name=groups.pop().name) return get_users_for_groups(groups, user_queryset=user_queryset) else: return user_queryset - diff --git a/hypha/apply/activity/admin.py b/hypha/apply/activity/admin.py index e2c1051219..eba7b0ff8a 100644 --- a/hypha/apply/activity/admin.py +++ b/hypha/apply/activity/admin.py @@ -5,7 +5,7 @@ class MessageInline(admin.TabularInline): model = Message - readonly_fields = ('type', 'recipient', 'content', 'status', 'external_id') + readonly_fields = ("type", "recipient", "content", "status", "external_id") can_delete = False def has_add_permission(self, request, obj): @@ -13,9 +13,9 @@ def has_add_permission(self, request, obj): class EventAdmin(admin.ModelAdmin): - list_display = ('type', 'by', 'when', 'source') - list_filter = ('type', 'when') - readonly_fields = ('type', 'source', 'when', 'by') + list_display = ("type", "by", "when", "source") + list_filter = ("type", "when") + readonly_fields = ("type", "source", "when", "by") inlines = (MessageInline,) def has_add_permission(self, request): diff --git a/hypha/apply/activity/apps.py b/hypha/apply/activity/apps.py index e031309956..2202e11e75 100644 --- a/hypha/apply/activity/apps.py +++ b/hypha/apply/activity/apps.py @@ -2,7 +2,7 @@ class ActivityConfig(AppConfig): - name = 'hypha.apply.activity' + name = "hypha.apply.activity" def ready(self): from . import signals # NOQA diff --git a/hypha/apply/activity/context_processors.py b/hypha/apply/activity/context_processors.py index f8b08f7ffa..0a807d21ba 100644 --- a/hypha/apply/activity/context_processors.py +++ b/hypha/apply/activity/context_processors.py @@ -3,7 +3,11 @@ def notification_context(request): context_data = {} - if hasattr(request, 'user'): + if hasattr(request, "user"): if request.user.is_authenticated and request.user.is_apply_staff: - context_data['latest_notifications'] = Activity.objects.filter(current=True).latest().order_by('-timestamp')[:5] + context_data["latest_notifications"] = ( + Activity.objects.filter(current=True) + .latest() + .order_by("-timestamp")[:5] + ) return context_data diff --git a/hypha/apply/activity/filters.py b/hypha/apply/activity/filters.py index 899c5d5f53..b17fc24258 100644 --- a/hypha/apply/activity/filters.py +++ b/hypha/apply/activity/filters.py @@ -10,33 +10,40 @@ class NotificationFilter(django_filters.FilterSet): timestamp_choices = [ - ('today', _('Today')), - ('yesterday', _('Yesterday')), - ('week', _('Past 7 days')), - ('month', _('This month')) + ("today", _("Today")), + ("yesterday", _("Yesterday")), + ("week", _("Past 7 days")), + ("month", _("This month")), ] timestamp_filters = { - 'today': lambda qs, name: qs.filter(**{ - '%s__year' % name: now().year, - '%s__month' % name: now().month, - '%s__day' % name: now().day - }), - 'yesterday': lambda qs, name: qs.filter(**{ - '%s__year' % name: (now() - timedelta(days=1)).year, - '%s__month' % name: (now() - timedelta(days=1)).month, - '%s__day' % name: (now() - timedelta(days=1)).day, - }), - 'week': lambda qs, name: qs.filter(**{ - '%s__gte' % name: _truncate(now() - timedelta(days=7)), - '%s__lt' % name: _truncate(now() + timedelta(days=1)), - }), - 'month': lambda qs, name: qs.filter(**{ - '%s__year' % name: now().year, - '%s__month' % name: now().month - }) + "today": lambda qs, name: qs.filter( + **{ + "%s__year" % name: now().year, + "%s__month" % name: now().month, + "%s__day" % name: now().day, + } + ), + "yesterday": lambda qs, name: qs.filter( + **{ + "%s__year" % name: (now() - timedelta(days=1)).year, + "%s__month" % name: (now() - timedelta(days=1)).month, + "%s__day" % name: (now() - timedelta(days=1)).day, + } + ), + "week": lambda qs, name: qs.filter( + **{ + "%s__gte" % name: _truncate(now() - timedelta(days=7)), + "%s__lt" % name: _truncate(now() + timedelta(days=1)), + } + ), + "month": lambda qs, name: qs.filter( + **{"%s__year" % name: now().year, "%s__month" % name: now().month} + ), } - date = DateRangeFilter(field_name='timestamp', choices=timestamp_choices, filters=timestamp_filters) + date = DateRangeFilter( + field_name="timestamp", choices=timestamp_choices, filters=timestamp_filters + ) class Meta: model = Activity diff --git a/hypha/apply/activity/forms.py b/hypha/apply/activity/forms.py index 423864ba27..ec7fc37632 100644 --- a/hypha/apply/activity/forms.py +++ b/hypha/apply/activity/forms.py @@ -7,23 +7,23 @@ class CommentForm(forms.ModelForm): class Meta: model = Activity - fields = ('message', 'visibility') + fields = ("message", "visibility") labels = { - 'visibility': 'Visible to', - 'message': 'Message', + "visibility": "Visible to", + "message": "Message", } help_texts = { - 'visibility': 'Select a relevant user role. Staff can view every comment.' + "visibility": "Select a relevant user role. Staff can view every comment." } widgets = { - 'visibility': forms.RadioSelect(), - 'message': PagedownWidget(), + "visibility": forms.RadioSelect(), + "message": PagedownWidget(), } def __init__(self, *args, user=None, **kwargs): super().__init__(*args, **kwargs) self.visibility_choices = self._meta.model.visibility_choices_for(user) - visibility = self.fields['visibility'] + visibility = self.fields["visibility"] # Set default visibility to "Applicant" for staff and staff can view everything. visibility.initial = self.visibility_choices[0] if len(self.visibility_choices) > 1: diff --git a/hypha/apply/activity/management/commands/migrate_comments.py b/hypha/apply/activity/management/commands/migrate_comments.py index 728d795315..4ee27b28c8 100644 --- a/hypha/apply/activity/management/commands/migrate_comments.py +++ b/hypha/apply/activity/management/commands/migrate_comments.py @@ -16,11 +16,13 @@ class Command(BaseCommand): data = [] def add_arguments(self, parser): - parser.add_argument('source', type=argparse.FileType('r'), help='Migration source JSON file') + parser.add_argument( + "source", type=argparse.FileType("r"), help="Migration source JSON file" + ) @transaction.atomic def handle(self, *args, **options): - with options['source'] as json_data: + with options["source"] as json_data: self.data = json.load(json_data) for id in self.data: @@ -31,12 +33,14 @@ def process(self, id): try: activity = Activity.objects.create( - timestamp=datetime.fromtimestamp(int(comment['created']), timezone.utc), - user=self.get_user(comment['uid']), - submission=self.get_submission(comment['nid']), - message=self.get_message(comment['subject'], comment['comment_body']['value']), - type='comment', - visibility='internal', + timestamp=datetime.fromtimestamp(int(comment["created"]), timezone.utc), + user=self.get_user(comment["uid"]), + submission=self.get_submission(comment["nid"]), + message=self.get_message( + comment["subject"], comment["comment_body"]["value"] + ), + type="comment", + visibility="internal", ) # Disable auto_* on date fields so imported dates are used. for field in activity._meta.local_fields: @@ -44,9 +48,13 @@ def process(self, id): field.auto_now_add = False try: activity.save() - self.stdout.write(f"Processed \"{comment['subject']}\" ({comment['cid']})") + self.stdout.write( + f"Processed \"{comment['subject']}\" ({comment['cid']})" + ) except IntegrityError: - self.stdout.write(f"Skipped \"{comment['subject']}\" ({comment['cid']}) due to IntegrityError") + self.stdout.write( + f"Skipped \"{comment['subject']}\" ({comment['cid']}) due to IntegrityError" + ) pass except ValueError: pass @@ -66,7 +74,7 @@ def get_submission(self, nid): try: return ApplicationSubmission.objects.get(drupal_id=nid) except ApplicationSubmission.DoesNotExist: - return 'None' + return "None" def nl2br(self, value): - return value.replace('\r\n', '
\n') + return value.replace("\r\n", "
\n") diff --git a/hypha/apply/activity/management/commands/send_staff_email_digest.py b/hypha/apply/activity/management/commands/send_staff_email_digest.py index a12b33fbc1..2d4e846c16 100644 --- a/hypha/apply/activity/management/commands/send_staff_email_digest.py +++ b/hypha/apply/activity/management/commands/send_staff_email_digest.py @@ -69,9 +69,9 @@ def slack_message_to_markdown(msg): def to_href(match_obj): if match_obj.group() is not None: - return f'[{match_obj.group(2)}]({match_obj.group(1)})' + return f"[{match_obj.group(2)}]({match_obj.group(1)})" - return re.sub(r'<(.*)\|(.*)>', to_href, msg) + return re.sub(r"<(.*)\|(.*)>", to_href, msg) def prepare_and_send_activity_digest_email(to, subject, slack_messages): @@ -84,19 +84,19 @@ def prepare_and_send_activity_digest_email(to, subject, slack_messages): messages = [m for m in slack_messages if m.id not in exclude_ids] total_count = len(slack_messages) ctx = { - 'messages': messages, - 'submissions': submissions, - 'comments': comments, - 'reviews': reviews, - 'has_main_sections': bool(exclude_ids), - 'total_count': total_count, - 'ORG_LONG_NAME': settings.ORG_LONG_NAME, - 'ORG_SHORT_NAME': settings.ORG_SHORT_NAME, - 'ORG_URL': settings.ORG_URL, + "messages": messages, + "submissions": submissions, + "comments": comments, + "reviews": reviews, + "has_main_sections": bool(exclude_ids), + "total_count": total_count, + "ORG_LONG_NAME": settings.ORG_LONG_NAME, + "ORG_SHORT_NAME": settings.ORG_SHORT_NAME, + "ORG_URL": settings.ORG_URL, } if total_count: - email = MarkdownMail('messages/email/activity_summary.md') + email = MarkdownMail("messages/email/activity_summary.md") email.send( to=to, subject=subject, @@ -105,7 +105,7 @@ def prepare_and_send_activity_digest_email(to, subject, slack_messages): ) logger.info(f"Sent activity digest email to {to}") else: - logger.info('No email generated/sent, as there are no new activities.') + logger.info("No email generated/sent, as there are no new activities.") class Command(BaseCommand): @@ -120,14 +120,14 @@ class Command(BaseCommand): to that fund or lab to that email. """ - help = 'Sent email digest of all unsent activities (last 7 days) in hypha' + help = "Sent email digest of all unsent activities (last 7 days) in hypha" IGNORE_DAYS_BEFORE = 7 def handle(self, *args, **options): slack_messages = ( Message.objects.filter(type=SlackAdapter.adapter_type) - .select_related('event') - .order_by('-event__when') + .select_related("event") + .order_by("-event__when") .filter(sent_in_email_digest=False) .filter( event__when__gte=( @@ -143,7 +143,7 @@ def handle(self, *args, **options): if settings.ACTIVITY_DIGEST_RECIPIENT_EMAILS: prepare_and_send_activity_digest_email( to=settings.ACTIVITY_DIGEST_RECIPIENT_EMAILS, - subject=settings.EMAIL_SUBJECT_PREFIX + _('Summary of all activities'), + subject=settings.EMAIL_SUBJECT_PREFIX + _("Summary of all activities"), slack_messages=slack_messages, ) else: @@ -154,12 +154,12 @@ def handle(self, *args, **options): # Send digest of for funds that has "activity_digest_recipient_emails" set. for _id, messages in groupby_fund_lab_id(slack_messages): emails = extract_fund_or_lab_property( - messages[0].event, 'activity_digest_recipient_emails' + messages[0].event, "activity_digest_recipient_emails" ) if not emails: continue - title = extract_fund_or_lab_property(messages[0].event, 'title') - subject = settings.EMAIL_SUBJECT_PREFIX + _('Activities Summary - ') + title + title = extract_fund_or_lab_property(messages[0].event, "title") + subject = settings.EMAIL_SUBJECT_PREFIX + _("Activities Summary - ") + title prepare_and_send_activity_digest_email( subject=subject, diff --git a/hypha/apply/activity/messaging.py b/hypha/apply/activity/messaging.py index 8856193aae..31e69cf7a0 100644 --- a/hypha/apply/activity/messaging.py +++ b/hypha/apply/activity/messaging.py @@ -18,14 +18,7 @@ def __call__(self, *args, related=None, **kwargs): return self.send(*args, related=related, **kwargs) def send( - self, - message_type, - request, - user, - related, - source=None, - sources=None, - **kwargs + self, message_type, request, user, related, source=None, sources=None, **kwargs ): from .models import Event diff --git a/hypha/apply/activity/migrations/0001_initial.py b/hypha/apply/activity/migrations/0001_initial.py index 123a96d014..43dd338bb2 100644 --- a/hypha/apply/activity/migrations/0001_initial.py +++ b/hypha/apply/activity/migrations/0001_initial.py @@ -8,27 +8,47 @@ class Migration(migrations.Migration): - initial = True dependencies = [ - ('funds', '0025_update_with_file_blocks'), + ("funds", "0025_update_with_file_blocks"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( - name='Activity', + name="Activity", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('timestamp', models.DateTimeField(auto_now_add=True)), - ('message', models.TextField()), - ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationSubmission', related_name='activities')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("timestamp", models.DateTimeField(auto_now_add=True)), + ("message", models.TextField()), + ( + "submission", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationSubmission", + related_name="activities", + ), + ), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ - 'base_manager_name': 'objects', - 'ordering': ['-timestamp'], + "base_manager_name": "objects", + "ordering": ["-timestamp"], }, ), ] diff --git a/hypha/apply/activity/migrations/0002_activity_type.py b/hypha/apply/activity/migrations/0002_activity_type.py index bc7ca42a58..482a3550cd 100644 --- a/hypha/apply/activity/migrations/0002_activity_type.py +++ b/hypha/apply/activity/migrations/0002_activity_type.py @@ -6,16 +6,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0001_initial'), + ("activity", "0001_initial"), ] operations = [ migrations.AddField( - model_name='activity', - name='type', - field=models.CharField(choices=[('comment', 'Comment'), ('action', 'Action')], default='comment', max_length=30), + model_name="activity", + name="type", + field=models.CharField( + choices=[("comment", "Comment"), ("action", "Action")], + default="comment", + max_length=30, + ), preserve_default=False, ), ] diff --git a/hypha/apply/activity/migrations/0003_activity_visibility.py b/hypha/apply/activity/migrations/0003_activity_visibility.py index 5c0effb978..8f948615e4 100644 --- a/hypha/apply/activity/migrations/0003_activity_visibility.py +++ b/hypha/apply/activity/migrations/0003_activity_visibility.py @@ -6,15 +6,22 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0002_activity_type'), + ("activity", "0002_activity_type"), ] operations = [ migrations.AddField( - model_name='activity', - name='visibility', - field=models.CharField(choices=[('public', 'Public'), ('reviewers', 'Reviewers'), ('internal', 'Internal')], default='public', max_length=10), + model_name="activity", + name="visibility", + field=models.CharField( + choices=[ + ("public", "Public"), + ("reviewers", "Reviewers"), + ("internal", "Internal"), + ], + default="public", + max_length=10, + ), ), ] diff --git a/hypha/apply/activity/migrations/0004_update_on_delete_django2.py b/hypha/apply/activity/migrations/0004_update_on_delete_django2.py index 337cb2be28..4a802d4fb5 100644 --- a/hypha/apply/activity/migrations/0004_update_on_delete_django2.py +++ b/hypha/apply/activity/migrations/0004_update_on_delete_django2.py @@ -6,15 +6,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0003_activity_visibility'), + ("activity", "0003_activity_visibility"), ] operations = [ migrations.AlterField( - model_name='activity', - name='user', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="activity", + name="user", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL + ), ), ] diff --git a/hypha/apply/activity/migrations/0005_event.py b/hypha/apply/activity/migrations/0005_event.py index 635b8afef5..bff30aa4e5 100644 --- a/hypha/apply/activity/migrations/0005_event.py +++ b/hypha/apply/activity/migrations/0005_event.py @@ -6,20 +6,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0004_update_on_delete_django2'), + ("activity", "0004_update_on_delete_django2"), ] operations = [ migrations.CreateModel( - name='Event', + name="Event", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('when', models.DateTimeField(auto_now_add=True)), - ('type', models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('NEW_SUBMISSION', 'New Submission'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50)), - ('by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), - ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationSubmission', related_name='+')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("when", models.DateTimeField(auto_now_add=True)), + ( + "type", + models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("TRANSITION", "Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ], + max_length=50, + ), + ), + ( + "by", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "submission", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationSubmission", + related_name="+", + ), + ), ], ), ] diff --git a/hypha/apply/activity/migrations/0006_message.py b/hypha/apply/activity/migrations/0006_message.py index a55cde2ee8..e6a2ef6e8f 100644 --- a/hypha/apply/activity/migrations/0006_message.py +++ b/hypha/apply/activity/migrations/0006_message.py @@ -5,20 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0005_event'), + ("activity", "0005_event"), ] operations = [ migrations.CreateModel( - name='Message', + name="Message", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('type', models.CharField(max_length=15)), - ('content', models.TextField()), - ('recipient', models.CharField(max_length=250)), - ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='activity.Event')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("type", models.CharField(max_length=15)), + ("content", models.TextField()), + ("recipient", models.CharField(max_length=250)), + ( + "event", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="activity.Event" + ), + ), ], ), ] diff --git a/hypha/apply/activity/migrations/0007_message_status.py b/hypha/apply/activity/migrations/0007_message_status.py index 64789fcf70..aac58d15cf 100644 --- a/hypha/apply/activity/migrations/0007_message_status.py +++ b/hypha/apply/activity/migrations/0007_message_status.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0006_message'), + ("activity", "0006_message"), ] operations = [ migrations.AddField( - model_name='message', - name='status', - field=models.TextField(default=''), + model_name="message", + name="status", + field=models.TextField(default=""), preserve_default=False, ), ] diff --git a/hypha/apply/activity/migrations/0008_message_external_id.py b/hypha/apply/activity/migrations/0008_message_external_id.py index 6e2d8d5406..1c954de10b 100644 --- a/hypha/apply/activity/migrations/0008_message_external_id.py +++ b/hypha/apply/activity/migrations/0008_message_external_id.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0007_message_status'), + ("activity", "0007_message_status"), ] operations = [ migrations.AddField( - model_name='message', - name='external_id', + model_name="message", + name="external_id", field=models.CharField(blank=True, max_length=75, null=True), ), ] diff --git a/hypha/apply/activity/migrations/0009_add_private_option.py b/hypha/apply/activity/migrations/0009_add_private_option.py index 0f9a34f893..826c03ee63 100644 --- a/hypha/apply/activity/migrations/0009_add_private_option.py +++ b/hypha/apply/activity/migrations/0009_add_private_option.py @@ -4,15 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0008_message_external_id'), + ("activity", "0008_message_external_id"), ] operations = [ migrations.AlterField( - model_name='activity', - name='visibility', - field=models.CharField(choices=[('private', 'Private'), ('reviewers', 'Reviewers and Staff'), ('internal', 'Internal'), ('public', 'Public')], default='public', max_length=10), + model_name="activity", + name="visibility", + field=models.CharField( + choices=[ + ("private", "Private"), + ("reviewers", "Reviewers and Staff"), + ("internal", "Internal"), + ("public", "Public"), + ], + default="public", + max_length=10, + ), ), ] diff --git a/hypha/apply/activity/migrations/0011_add_new_event_type.py b/hypha/apply/activity/migrations/0011_add_new_event_type.py index f423168963..79dac1c7d1 100644 --- a/hypha/apply/activity/migrations/0011_add_new_event_type.py +++ b/hypha/apply/activity/migrations/0011_add_new_event_type.py @@ -4,15 +4,31 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0009_add_private_option'), + ("activity", "0009_add_private_option"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("TRANSITION", "Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0012_add_generic_relation_to_activity.py b/hypha/apply/activity/migrations/0012_add_generic_relation_to_activity.py index be9a21f8ab..0b8e52e1fa 100644 --- a/hypha/apply/activity/migrations/0012_add_generic_relation_to_activity.py +++ b/hypha/apply/activity/migrations/0012_add_generic_relation_to_activity.py @@ -5,21 +5,25 @@ class Migration(migrations.Migration): - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('activity', '0011_add_new_event_type'), + ("contenttypes", "0002_remove_content_type_name"), + ("activity", "0011_add_new_event_type"), ] operations = [ migrations.AddField( - model_name='activity', - name='content_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType'), + model_name="activity", + name="content_type", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="contenttypes.ContentType", + ), ), migrations.AddField( - model_name='activity', - name='object_id', + model_name="activity", + name="object_id", field=models.PositiveIntegerField(blank=True, null=True), ), ] diff --git a/hypha/apply/activity/migrations/0013_add_new_event_type_screening.py b/hypha/apply/activity/migrations/0013_add_new_event_type_screening.py index 065b7afa51..2040f65307 100644 --- a/hypha/apply/activity/migrations/0013_add_new_event_type_screening.py +++ b/hypha/apply/activity/migrations/0013_add_new_event_type_screening.py @@ -4,15 +4,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0012_add_generic_relation_to_activity'), + ("activity", "0012_add_generic_relation_to_activity"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0014_add_batch_reviewer_message.py b/hypha/apply/activity/migrations/0014_add_batch_reviewer_message.py index 261fc13324..c8e6ac98fe 100644 --- a/hypha/apply/activity/migrations/0014_add_batch_reviewer_message.py +++ b/hypha/apply/activity/migrations/0014_add_batch_reviewer_message.py @@ -4,15 +4,33 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0013_add_new_event_type_screening'), + ("activity", "0013_add_new_event_type_screening"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0015_add_batch_transition.py b/hypha/apply/activity/migrations/0015_add_batch_transition.py index 539c08b218..c533cd7d8c 100644 --- a/hypha/apply/activity/migrations/0015_add_batch_transition.py +++ b/hypha/apply/activity/migrations/0015_add_batch_transition.py @@ -4,15 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0014_add_batch_reviewer_message'), + ("activity", "0014_add_batch_reviewer_message"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0016_add_batch_ready.py b/hypha/apply/activity/migrations/0016_add_batch_ready.py index 558e135df3..d9f555aa2f 100644 --- a/hypha/apply/activity/migrations/0016_add_batch_ready.py +++ b/hypha/apply/activity/migrations/0016_add_batch_ready.py @@ -4,15 +4,35 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0015_add_batch_transition'), + ("activity", "0015_add_batch_transition"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0017_add_review_opinion.py b/hypha/apply/activity/migrations/0017_add_review_opinion.py index c59a1458a5..0c14e54488 100644 --- a/hypha/apply/activity/migrations/0017_add_review_opinion.py +++ b/hypha/apply/activity/migrations/0017_add_review_opinion.py @@ -4,15 +4,36 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0016_add_batch_ready'), + ("activity", "0016_add_batch_ready"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0018_add_batch_determine.py b/hypha/apply/activity/migrations/0018_add_batch_determine.py index b6b3f9f1a8..1bca18d774 100644 --- a/hypha/apply/activity/migrations/0018_add_batch_determine.py +++ b/hypha/apply/activity/migrations/0018_add_batch_determine.py @@ -2,15 +2,37 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0017_add_review_opinion'), + ("activity", "0017_add_review_opinion"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0019_partner_field_event.py b/hypha/apply/activity/migrations/0019_partner_field_event.py index 65dd47e142..6a8944d737 100644 --- a/hypha/apply/activity/migrations/0019_partner_field_event.py +++ b/hypha/apply/activity/migrations/0019_partner_field_event.py @@ -4,15 +4,38 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0018_add_batch_determine'), + ("activity", "0018_add_batch_determine"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0020_add_delete_event.py b/hypha/apply/activity/migrations/0020_add_delete_event.py index 3dcc564895..2539f8dcf1 100644 --- a/hypha/apply/activity/migrations/0020_add_delete_event.py +++ b/hypha/apply/activity/migrations/0020_add_delete_event.py @@ -4,15 +4,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0019_partner_field_event'), + ("activity", "0019_partner_field_event"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0021_add_review_delete_event.py b/hypha/apply/activity/migrations/0021_add_review_delete_event.py index d549e1cd66..e5ce0fd188 100644 --- a/hypha/apply/activity/migrations/0021_add_review_delete_event.py +++ b/hypha/apply/activity/migrations/0021_add_review_delete_event.py @@ -4,15 +4,40 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0020_add_delete_event'), + ("activity", "0020_add_delete_event"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0022_add_versioning_to_comments.py b/hypha/apply/activity/migrations/0022_add_versioning_to_comments.py index 10034b8d28..4c27f665b3 100644 --- a/hypha/apply/activity/migrations/0022_add_versioning_to_comments.py +++ b/hypha/apply/activity/migrations/0022_add_versioning_to_comments.py @@ -5,30 +5,33 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0021_add_review_delete_event'), + ("activity", "0021_add_review_delete_event"), ] operations = [ migrations.AlterField( - model_name='activity', - name='timestamp', + model_name="activity", + name="timestamp", field=models.DateTimeField(), ), migrations.AddField( - model_name='activity', - name='current', + model_name="activity", + name="current", field=models.BooleanField(default=True), ), migrations.AddField( - model_name='activity', - name='edited', + model_name="activity", + name="edited", field=models.DateTimeField(default=None, null=True), ), migrations.AddField( - model_name='activity', - name='previous', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='activity.Activity'), + model_name="activity", + name="previous", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="activity.Activity", + ), ), ] diff --git a/hypha/apply/activity/migrations/0023_notify_partners.py b/hypha/apply/activity/migrations/0023_notify_partners.py index 097c6f648a..a300b6f0de 100644 --- a/hypha/apply/activity/migrations/0023_notify_partners.py +++ b/hypha/apply/activity/migrations/0023_notify_partners.py @@ -4,15 +4,41 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0022_add_versioning_to_comments'), + ("activity", "0022_add_versioning_to_comments"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0024_add_review_edit_event.py b/hypha/apply/activity/migrations/0024_add_review_edit_event.py index e1387495ab..605a8ef83f 100644 --- a/hypha/apply/activity/migrations/0024_add_review_edit_event.py +++ b/hypha/apply/activity/migrations/0024_add_review_edit_event.py @@ -4,15 +4,42 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0023_notify_partners'), + ("activity", "0023_notify_partners"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('EDIT_REVIEW', 'Edit Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("EDIT_REVIEW", "Edit Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0025_add_batch_lead_event.py b/hypha/apply/activity/migrations/0025_add_batch_lead_event.py index 2e6c5ce399..19ba5158c1 100644 --- a/hypha/apply/activity/migrations/0025_add_batch_lead_event.py +++ b/hypha/apply/activity/migrations/0025_add_batch_lead_event.py @@ -4,15 +4,43 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0024_add_review_edit_event'), + ("activity", "0024_add_review_edit_event"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('EDIT_REVIEW', 'Edit Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("EDIT_REVIEW", "Edit Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0026_add_created_project_event.py b/hypha/apply/activity/migrations/0026_add_created_project_event.py index 05053e4d20..815adbba27 100644 --- a/hypha/apply/activity/migrations/0026_add_created_project_event.py +++ b/hypha/apply/activity/migrations/0026_add_created_project_event.py @@ -4,15 +4,44 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0025_add_batch_lead_event'), + ("activity", "0025_add_batch_lead_event"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('EDIT_REVIEW', 'Edit Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("EDIT_REVIEW", "Edit Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0026_update_visibility_options.py b/hypha/apply/activity/migrations/0026_update_visibility_options.py index 895ec389af..7059cfc8d0 100644 --- a/hypha/apply/activity/migrations/0026_update_visibility_options.py +++ b/hypha/apply/activity/migrations/0026_update_visibility_options.py @@ -6,16 +6,16 @@ def update_visibility_options(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') + Activity = apps.get_model("activity", "Activity") for comment in Activity.objects.filter(type=COMMENT): updated = False - if comment.visibility == 'private': + if comment.visibility == "private": comment.visibility = APPLICANT updated = True - elif comment.visibility == 'internal': + elif comment.visibility == "internal": comment.visibility = TEAM updated = True - elif comment.visibility == 'public': + elif comment.visibility == "public": comment.visibility = ALL updated = True @@ -24,16 +24,25 @@ def update_visibility_options(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('activity', '0025_add_batch_lead_event'), + ("activity", "0025_add_batch_lead_event"), ] operations = [ migrations.AlterField( - model_name='activity', - name='visibility', - field=models.CharField(choices=[('applicant', 'Applicant(s)'), ('team', 'Team'), ('reviewers', 'Reviewers'), ('partners', 'Partners'), ('all', 'All')], default='applicant', max_length=30), + model_name="activity", + name="visibility", + field=models.CharField( + choices=[ + ("applicant", "Applicant(s)"), + ("team", "Team"), + ("reviewers", "Reviewers"), + ("partners", "Partners"), + ("all", "All"), + ], + default="applicant", + max_length=30, + ), ), - migrations.RunPython(update_visibility_options, migrations.RunPython.noop) + migrations.RunPython(update_visibility_options, migrations.RunPython.noop), ] diff --git a/hypha/apply/activity/migrations/0027_add_update_project_lead.py b/hypha/apply/activity/migrations/0027_add_update_project_lead.py index e10f100e18..13d0ac1fc8 100644 --- a/hypha/apply/activity/migrations/0027_add_update_project_lead.py +++ b/hypha/apply/activity/migrations/0027_add_update_project_lead.py @@ -4,15 +4,45 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0026_add_created_project_event'), + ("activity", "0026_add_created_project_event"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0027_update_visibility_options_2.py b/hypha/apply/activity/migrations/0027_update_visibility_options_2.py index 3e2326065a..8a951f167a 100644 --- a/hypha/apply/activity/migrations/0027_update_visibility_options_2.py +++ b/hypha/apply/activity/migrations/0027_update_visibility_options_2.py @@ -6,13 +6,13 @@ def update_visibility_options(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') + Activity = apps.get_model("activity", "Activity") for activity in Activity.objects.filter(type=ACTION): updated = False - if activity.visibility == 'public': + if activity.visibility == "public": activity.visibility = ALL updated = True - elif activity.visibility == 'internal': + elif activity.visibility == "internal": activity.visibility = TEAM updated = True @@ -21,9 +21,8 @@ def update_visibility_options(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('activity', '0026_update_visibility_options'), + ("activity", "0026_update_visibility_options"), ] operations = [ diff --git a/hypha/apply/activity/migrations/0028_add_new_generic_relation.py b/hypha/apply/activity/migrations/0028_add_new_generic_relation.py index 545a19f6e6..6cdab5c02d 100644 --- a/hypha/apply/activity/migrations/0028_add_new_generic_relation.py +++ b/hypha/apply/activity/migrations/0028_add_new_generic_relation.py @@ -5,44 +5,60 @@ class Migration(migrations.Migration): - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('activity', '0027_add_update_project_lead'), + ("contenttypes", "0002_remove_content_type_name"), + ("activity", "0027_add_update_project_lead"), ] operations = [ # Updates to the existing GenericForeignKey to related objects migrations.RenameField( - model_name='activity', - old_name='object_id', - new_name='related_object_id', + model_name="activity", + old_name="object_id", + new_name="related_object_id", ), migrations.RenameField( - model_name='activity', - old_name='content_type', - new_name='related_content_type', + model_name="activity", + old_name="content_type", + new_name="related_content_type", ), migrations.AlterField( - model_name='activity', - name='related_content_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='activity_related', to='contenttypes.ContentType'), + model_name="activity", + name="related_content_type", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="activity_related", + to="contenttypes.ContentType", + ), ), # Add the new generic foreign key migrations.AddField( - model_name='activity', - name='source_content_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='activity_source', to='contenttypes.ContentType'), + model_name="activity", + name="source_content_type", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="activity_source", + to="contenttypes.ContentType", + ), ), migrations.AddField( - model_name='activity', - name='source_object_id', + model_name="activity", + name="source_object_id", field=models.PositiveIntegerField(blank=True, null=True), ), # Make the submission field nullable migrations.AlterField( - model_name='activity', - name='submission', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationSubmission', related_name='activities', null=True) + model_name="activity", + name="submission", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationSubmission", + related_name="activities", + null=True, + ), ), ] diff --git a/hypha/apply/activity/migrations/0028_migrate_messages_with_visibility.py b/hypha/apply/activity/migrations/0028_migrate_messages_with_visibility.py index 63827c9aa0..dccf979b35 100644 --- a/hypha/apply/activity/migrations/0028_migrate_messages_with_visibility.py +++ b/hypha/apply/activity/migrations/0028_migrate_messages_with_visibility.py @@ -7,24 +7,24 @@ def forward_visibility_options(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') + Activity = apps.get_model("activity", "Activity") for activity in Activity.objects.filter(type=ACTION): try: message = json.loads(activity.message) except json.JSONDecodeError: continue - if 'internal' in message and 'public' in message: + if "internal" in message and "public" in message: new_message = { - TEAM: message['internal'], - ALL: message['public'], + TEAM: message["internal"], + ALL: message["public"], } activity.message = json.dumps(new_message) activity.save() def backward_visibility_options(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') + Activity = apps.get_model("activity", "Activity") for activity in Activity.objects.filter(type=ACTION): try: message = json.loads(activity.message) @@ -32,17 +32,16 @@ def backward_visibility_options(apps, schema_editor): continue new_message = { - 'internal': message[TEAM], - 'public': message[ALL], + "internal": message[TEAM], + "public": message[ALL], } activity.message = json.dumps(new_message) activity.save() class Migration(migrations.Migration): - dependencies = [ - ('activity', '0027_update_visibility_options_2'), + ("activity", "0027_update_visibility_options_2"), ] operations = [ diff --git a/hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py b/hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py index 1c487b0f89..c0e1971e66 100644 --- a/hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py +++ b/hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py @@ -5,29 +5,28 @@ def submission_to_source(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') + Activity = apps.get_model("activity", "Activity") if Activity.objects.exists(): - ContentType = apps.get_model('contenttypes', 'ContentType') - content_type = ContentType.objects.get(model='applicationsubmission', app_label='funds') + ContentType = apps.get_model("contenttypes", "ContentType") + content_type = ContentType.objects.get( + model="applicationsubmission", app_label="funds" + ) Activity.objects.update( - source_object_id=F('submission_id'), + source_object_id=F("submission_id"), source_content_type=content_type, ) def source_to_submission(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') - Activity.objects.update(submission_id=F('source_object_id')) + Activity = apps.get_model("activity", "Activity") + Activity.objects.update(submission_id=F("source_object_id")) class Migration(migrations.Migration): - dependencies = [ - ('activity', '0028_add_new_generic_relation'), - ('funds', '0065_applicationsubmission_meta_categories'), - ('contenttypes', '0002_remove_content_type_name'), + ("activity", "0028_add_new_generic_relation"), + ("funds", "0065_applicationsubmission_meta_categories"), + ("contenttypes", "0002_remove_content_type_name"), ] - operations = [ - migrations.RunPython(submission_to_source, source_to_submission) - ] + operations = [migrations.RunPython(submission_to_source, source_to_submission)] diff --git a/hypha/apply/activity/migrations/0030_remove_old_relation.py b/hypha/apply/activity/migrations/0030_remove_old_relation.py index b524231576..9666d78a9e 100644 --- a/hypha/apply/activity/migrations/0030_remove_old_relation.py +++ b/hypha/apply/activity/migrations/0030_remove_old_relation.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0029_migrate_old_submission_relation'), + ("activity", "0029_migrate_old_submission_relation"), ] operations = [ migrations.RemoveField( - model_name='activity', - name='submission', + model_name="activity", + name="submission", ), ] diff --git a/hypha/apply/activity/migrations/0031_add_generic_fk_to_event.py b/hypha/apply/activity/migrations/0031_add_generic_fk_to_event.py index f67b8a245e..abdcb8a6a9 100644 --- a/hypha/apply/activity/migrations/0031_add_generic_fk_to_event.py +++ b/hypha/apply/activity/migrations/0031_add_generic_fk_to_event.py @@ -5,26 +5,35 @@ class Migration(migrations.Migration): - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('activity', '0030_remove_old_relation'), + ("contenttypes", "0002_remove_content_type_name"), + ("activity", "0030_remove_old_relation"), ] operations = [ migrations.AlterField( - model_name='event', - name='submission', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='funds.ApplicationSubmission'), + model_name="event", + name="submission", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="funds.ApplicationSubmission", + ), ), migrations.AddField( - model_name='event', - name='content_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType'), + model_name="event", + name="content_type", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="contenttypes.ContentType", + ), ), migrations.AddField( - model_name='event', - name='object_id', + model_name="event", + name="object_id", field=models.PositiveIntegerField(blank=True, null=True), ), ] diff --git a/hypha/apply/activity/migrations/0032_migrate_submission_to_generic_event.py b/hypha/apply/activity/migrations/0032_migrate_submission_to_generic_event.py index 137d80d9c0..2e9c373116 100644 --- a/hypha/apply/activity/migrations/0032_migrate_submission_to_generic_event.py +++ b/hypha/apply/activity/migrations/0032_migrate_submission_to_generic_event.py @@ -5,29 +5,28 @@ def submission_to_source(apps, schema_editor): - Event = apps.get_model('activity', 'Event') + Event = apps.get_model("activity", "Event") if Event.objects.exists(): - ContentType = apps.get_model('contenttypes', 'ContentType') - content_type = ContentType.objects.get(model='applicationsubmission', app_label='funds') + ContentType = apps.get_model("contenttypes", "ContentType") + content_type = ContentType.objects.get( + model="applicationsubmission", app_label="funds" + ) Event.objects.update( - object_id=F('submission_id'), + object_id=F("submission_id"), content_type=content_type, ) def source_to_submission(apps, schema_editor): - Event = apps.get_model('activity', 'Event') - Event.objects.update(submission_id=F('object_id')) + Event = apps.get_model("activity", "Event") + Event.objects.update(submission_id=F("object_id")) class Migration(migrations.Migration): - dependencies = [ - ('activity', '0031_add_generic_fk_to_event'), - ('funds', '0065_applicationsubmission_meta_categories'), - ('contenttypes', '0002_remove_content_type_name'), + ("activity", "0031_add_generic_fk_to_event"), + ("funds", "0065_applicationsubmission_meta_categories"), + ("contenttypes", "0002_remove_content_type_name"), ] - operations = [ - migrations.RunPython(submission_to_source, source_to_submission) - ] + operations = [migrations.RunPython(submission_to_source, source_to_submission)] diff --git a/hypha/apply/activity/migrations/0033_remove_old_submission_fk_event.py b/hypha/apply/activity/migrations/0033_remove_old_submission_fk_event.py index 6e76833da6..11361bb146 100644 --- a/hypha/apply/activity/migrations/0033_remove_old_submission_fk_event.py +++ b/hypha/apply/activity/migrations/0033_remove_old_submission_fk_event.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0032_migrate_submission_to_generic_event'), + ("activity", "0032_migrate_submission_to_generic_event"), ] operations = [ migrations.RemoveField( - model_name='event', - name='submission', + model_name="event", + name="submission", ), ] diff --git a/hypha/apply/activity/migrations/0034_add_send_for_approval.py b/hypha/apply/activity/migrations/0034_add_send_for_approval.py index 4dcb14b42a..ad732cc009 100644 --- a/hypha/apply/activity/migrations/0034_add_send_for_approval.py +++ b/hypha/apply/activity/migrations/0034_add_send_for_approval.py @@ -4,15 +4,46 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0033_remove_old_submission_fk_event'), + ("activity", "0033_remove_old_submission_fk_event"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0035_add_approve_project.py b/hypha/apply/activity/migrations/0035_add_approve_project.py index c1ebdd9e7b..26e17a34eb 100644 --- a/hypha/apply/activity/migrations/0035_add_approve_project.py +++ b/hypha/apply/activity/migrations/0035_add_approve_project.py @@ -4,15 +4,47 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0034_add_send_for_approval'), + ("activity", "0034_add_send_for_approval"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0036_add_reject_project.py b/hypha/apply/activity/migrations/0036_add_reject_project.py index 640d50dd02..5621e86d25 100644 --- a/hypha/apply/activity/migrations/0036_add_reject_project.py +++ b/hypha/apply/activity/migrations/0036_add_reject_project.py @@ -4,15 +4,48 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0035_add_approve_project'), + ("activity", "0035_add_approve_project"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0037_add_upload_document.py b/hypha/apply/activity/migrations/0037_add_upload_document.py index 6220a12883..5eace58da0 100644 --- a/hypha/apply/activity/migrations/0037_add_upload_document.py +++ b/hypha/apply/activity/migrations/0037_add_upload_document.py @@ -4,15 +4,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0036_add_reject_project'), + ("activity", "0036_add_reject_project"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REJECT_PROJECT', 'Project was Rejected'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REJECT_PROJECT", "Project was Rejected"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0038_auto_20190808_1142.py b/hypha/apply/activity/migrations/0038_auto_20190808_1142.py index 47109db845..40a59ac61a 100644 --- a/hypha/apply/activity/migrations/0038_auto_20190808_1142.py +++ b/hypha/apply/activity/migrations/0038_auto_20190808_1142.py @@ -4,15 +4,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0037_add_upload_document'), + ("activity", "0037_add_upload_document"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0039_add_remove_document.py b/hypha/apply/activity/migrations/0039_add_remove_document.py index c3014c711c..f23fbfebb9 100644 --- a/hypha/apply/activity/migrations/0039_add_remove_document.py +++ b/hypha/apply/activity/migrations/0039_add_remove_document.py @@ -4,15 +4,50 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0038_auto_20190808_1142'), + ("activity", "0038_auto_20190808_1142"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0040_merge_activity_update_and_generic_relations.py b/hypha/apply/activity/migrations/0040_merge_activity_update_and_generic_relations.py index e9ba430476..50a68480ce 100644 --- a/hypha/apply/activity/migrations/0040_merge_activity_update_and_generic_relations.py +++ b/hypha/apply/activity/migrations/0040_merge_activity_update_and_generic_relations.py @@ -4,11 +4,9 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0028_migrate_messages_with_visibility'), - ('activity', '0039_add_remove_document'), + ("activity", "0028_migrate_messages_with_visibility"), + ("activity", "0039_add_remove_document"), ] - operations = [ - ] + operations = [] diff --git a/hypha/apply/activity/migrations/0041_add_upload_contract.py b/hypha/apply/activity/migrations/0041_add_upload_contract.py index 6ff116ee91..3c314d2c93 100644 --- a/hypha/apply/activity/migrations/0041_add_upload_contract.py +++ b/hypha/apply/activity/migrations/0041_add_upload_contract.py @@ -4,15 +4,51 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0040_merge_activity_update_and_generic_relations'), + ("activity", "0040_merge_activity_update_and_generic_relations"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0042_add_approve_contract.py b/hypha/apply/activity/migrations/0042_add_approve_contract.py index 2eb0e19a20..a4270978e8 100644 --- a/hypha/apply/activity/migrations/0042_add_approve_contract.py +++ b/hypha/apply/activity/migrations/0042_add_approve_contract.py @@ -4,15 +4,52 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0041_add_upload_contract'), + ("activity", "0041_add_upload_contract"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0043_add_request_payment.py b/hypha/apply/activity/migrations/0043_add_request_payment.py index 3544f9796c..0bab694093 100644 --- a/hypha/apply/activity/migrations/0043_add_request_payment.py +++ b/hypha/apply/activity/migrations/0043_add_request_payment.py @@ -4,15 +4,53 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0042_add_approve_contract'), + ("activity", "0042_add_approve_contract"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0044_add_update_payment_request_status.py b/hypha/apply/activity/migrations/0044_add_update_payment_request_status.py index 22ebb62bf2..98effc877e 100644 --- a/hypha/apply/activity/migrations/0044_add_update_payment_request_status.py +++ b/hypha/apply/activity/migrations/0044_add_update_payment_request_status.py @@ -4,15 +4,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0043_add_request_payment'), + ("activity", "0043_add_request_payment"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0045_add_delete_payment_request.py b/hypha/apply/activity/migrations/0045_add_delete_payment_request.py index 394919e34a..3359567876 100644 --- a/hypha/apply/activity/migrations/0045_add_delete_payment_request.py +++ b/hypha/apply/activity/migrations/0045_add_delete_payment_request.py @@ -4,15 +4,55 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0044_add_update_payment_request_status'), + ("activity", "0044_add_update_payment_request_status"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0046_add_sent_to_compliance.py b/hypha/apply/activity/migrations/0046_add_sent_to_compliance.py index 3b9491d91d..2bce1cbbf7 100644 --- a/hypha/apply/activity/migrations/0046_add_sent_to_compliance.py +++ b/hypha/apply/activity/migrations/0046_add_sent_to_compliance.py @@ -4,15 +4,56 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0045_add_delete_payment_request'), + ("activity", "0045_add_delete_payment_request"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0047_add_update_payment_request.py b/hypha/apply/activity/migrations/0047_add_update_payment_request.py index 07e51482ea..5689735557 100644 --- a/hypha/apply/activity/migrations/0047_add_update_payment_request.py +++ b/hypha/apply/activity/migrations/0047_add_update_payment_request.py @@ -4,15 +4,57 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0046_add_sent_to_compliance'), + ("activity", "0046_add_sent_to_compliance"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0048_add_project_transition.py b/hypha/apply/activity/migrations/0048_add_project_transition.py index b576b1ed89..2d67162781 100644 --- a/hypha/apply/activity/migrations/0048_add_project_transition.py +++ b/hypha/apply/activity/migrations/0048_add_project_transition.py @@ -4,15 +4,58 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0047_add_update_payment_request'), + ("activity", "0047_add_update_payment_request"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0049_auto_20191112_1227.py b/hypha/apply/activity/migrations/0049_auto_20191112_1227.py index a79cea1728..b0fa092e50 100644 --- a/hypha/apply/activity/migrations/0049_auto_20191112_1227.py +++ b/hypha/apply/activity/migrations/0049_auto_20191112_1227.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0048_add_project_transition'), + ("activity", "0048_add_project_transition"), ] operations = [ migrations.AlterField( - model_name='activity', - name='source_object_id', + model_name="activity", + name="source_object_id", field=models.PositiveIntegerField(blank=True, db_index=True, null=True), ), ] diff --git a/hypha/apply/activity/migrations/0050_add_submit_report.py b/hypha/apply/activity/migrations/0050_add_submit_report.py index 570a0e32ce..d49201a9fa 100644 --- a/hypha/apply/activity/migrations/0050_add_submit_report.py +++ b/hypha/apply/activity/migrations/0050_add_submit_report.py @@ -4,15 +4,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0049_auto_20191112_1227'), + ("activity", "0049_auto_20191112_1227"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0051_add_report_skipping_activity.py b/hypha/apply/activity/migrations/0051_add_report_skipping_activity.py index f410ec1db2..0997d1e88b 100644 --- a/hypha/apply/activity/migrations/0051_add_report_skipping_activity.py +++ b/hypha/apply/activity/migrations/0051_add_report_skipping_activity.py @@ -4,15 +4,60 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0050_add_submit_report'), + ("activity", "0050_add_submit_report"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0052_report_frequency_change.py b/hypha/apply/activity/migrations/0052_report_frequency_change.py index e6db41b015..be013aaaf1 100644 --- a/hypha/apply/activity/migrations/0052_report_frequency_change.py +++ b/hypha/apply/activity/migrations/0052_report_frequency_change.py @@ -4,15 +4,61 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0051_add_report_skipping_activity'), + ("activity", "0051_add_report_skipping_activity"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0053_nullable_by_report_notify.py b/hypha/apply/activity/migrations/0053_nullable_by_report_notify.py index 5f4facc46b..b9d49a4131 100644 --- a/hypha/apply/activity/migrations/0053_nullable_by_report_notify.py +++ b/hypha/apply/activity/migrations/0053_nullable_by_report_notify.py @@ -6,20 +6,71 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0052_report_frequency_change'), + ("activity", "0052_report_frequency_change"), ] operations = [ migrations.AlterField( - model_name='event', - name='by', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="event", + name="by", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0054_add_create_reminder_delete_reminder_and_review_reminder.py b/hypha/apply/activity/migrations/0054_add_create_reminder_delete_reminder_and_review_reminder.py index 34df18e2c6..893f9bcb95 100644 --- a/hypha/apply/activity/migrations/0054_add_create_reminder_delete_reminder_and_review_reminder.py +++ b/hypha/apply/activity/migrations/0054_add_create_reminder_delete_reminder_and_review_reminder.py @@ -4,15 +4,65 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0053_nullable_by_report_notify'), + ("activity", "0053_nullable_by_report_notify"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0055_add_batch_delete_submission.py b/hypha/apply/activity/migrations/0055_add_batch_delete_submission.py index fd10e524bc..29f250f0ed 100644 --- a/hypha/apply/activity/migrations/0055_add_batch_delete_submission.py +++ b/hypha/apply/activity/migrations/0055_add_batch_delete_submission.py @@ -4,15 +4,66 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0054_add_create_reminder_delete_reminder_and_review_reminder'), + ("activity", "0054_add_create_reminder_delete_reminder_and_review_reminder"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0056_add_updated_vendor.py b/hypha/apply/activity/migrations/0056_add_updated_vendor.py index f3c4416972..0f35fe8c6c 100644 --- a/hypha/apply/activity/migrations/0056_add_updated_vendor.py +++ b/hypha/apply/activity/migrations/0056_add_updated_vendor.py @@ -4,15 +4,67 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0055_add_batch_delete_submission'), + ("activity", "0055_add_batch_delete_submission"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Vendor'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Vendor"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0057_add_invoices.py b/hypha/apply/activity/migrations/0057_add_invoices.py index ae05335920..f9c563bbe6 100644 --- a/hypha/apply/activity/migrations/0057_add_invoices.py +++ b/hypha/apply/activity/migrations/0057_add_invoices.py @@ -4,15 +4,68 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0056_add_updated_vendor'), + ("activity", "0056_add_updated_vendor"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Vendor'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('CREATE_INVOICE', 'Invoice was created for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Vendor"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("CREATE_INVOICE", "Invoice was created for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0058_add_project_invoicing.py b/hypha/apply/activity/migrations/0058_add_project_invoicing.py index d244da829a..17c4c736f8 100644 --- a/hypha/apply/activity/migrations/0058_add_project_invoicing.py +++ b/hypha/apply/activity/migrations/0058_add_project_invoicing.py @@ -4,15 +4,71 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0057_add_invoices'), + ("activity", "0057_add_invoices"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Vendor'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('CREATE_INVOICE', 'Invoice was created for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('UPDATE_INVOICE_STATUS', 'Updated Invoice Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('DELETE_INVOICE', 'Delete Invoice'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('UPDATE_INVOICE', 'Updated Invoice'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Vendor"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("CREATE_INVOICE", "Invoice was created for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("UPDATE_INVOICE_STATUS", "Updated Invoice Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("DELETE_INVOICE", "Delete Invoice"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("UPDATE_INVOICE", "Updated Invoice"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0059_rename_team_staff.py b/hypha/apply/activity/migrations/0059_rename_team_staff.py index 0fe6adfccd..577a1eb1c9 100644 --- a/hypha/apply/activity/migrations/0059_rename_team_staff.py +++ b/hypha/apply/activity/migrations/0059_rename_team_staff.py @@ -4,15 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0058_add_project_invoicing'), + ("activity", "0058_add_project_invoicing"), ] operations = [ migrations.AlterField( - model_name='activity', - name='visibility', - field=models.CharField(choices=[('applicant', 'Applicant(s)'), ('team', 'Staff'), ('reviewers', 'Reviewers'), ('partners', 'Partners'), ('all', 'All')], default='applicant', max_length=30), + model_name="activity", + name="visibility", + field=models.CharField( + choices=[ + ("applicant", "Applicant(s)"), + ("team", "Staff"), + ("reviewers", "Reviewers"), + ("partners", "Partners"), + ("all", "All"), + ], + default="applicant", + max_length=30, + ), ), ] diff --git a/hypha/apply/activity/migrations/0060_contracting_name_update.py b/hypha/apply/activity/migrations/0060_contracting_name_update.py index c1eca37913..731c3ae0d1 100644 --- a/hypha/apply/activity/migrations/0060_contracting_name_update.py +++ b/hypha/apply/activity/migrations/0060_contracting_name_update.py @@ -4,15 +4,71 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0059_rename_team_staff'), + ("activity", "0059_rename_team_staff"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Contracting information'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('REQUEST_PAYMENT', 'Payment was requested for Project'), ('CREATE_INVOICE', 'Invoice was created for Project'), ('UPDATE_PAYMENT_REQUEST_STATUS', 'Updated Payment Request Status'), ('UPDATE_INVOICE_STATUS', 'Updated Invoice Status'), ('DELETE_PAYMENT_REQUEST', 'Delete Payment Request'), ('DELETE_INVOICE', 'Delete Invoice'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_PAYMENT_REQUEST', 'Updated Payment Request'), ('UPDATE_INVOICE', 'Updated Invoice'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Contracting information"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("REQUEST_PAYMENT", "Payment was requested for Project"), + ("CREATE_INVOICE", "Invoice was created for Project"), + ("UPDATE_PAYMENT_REQUEST_STATUS", "Updated Payment Request Status"), + ("UPDATE_INVOICE_STATUS", "Updated Invoice Status"), + ("DELETE_PAYMENT_REQUEST", "Delete Payment Request"), + ("DELETE_INVOICE", "Delete Invoice"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_PAYMENT_REQUEST", "Updated Payment Request"), + ("UPDATE_INVOICE", "Updated Invoice"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0061_payment_requests_cleanup.py b/hypha/apply/activity/migrations/0061_payment_requests_cleanup.py index a88fb085f4..22646dd744 100644 --- a/hypha/apply/activity/migrations/0061_payment_requests_cleanup.py +++ b/hypha/apply/activity/migrations/0061_payment_requests_cleanup.py @@ -4,15 +4,67 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0060_contracting_name_update'), + ("activity", "0060_contracting_name_update"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Contracting information'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('CREATE_INVOICE', 'Invoice was created for Project'), ('UPDATE_INVOICE_STATUS', 'Updated Invoice Status'), ('DELETE_INVOICE', 'Delete Invoice'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_INVOICE', 'Updated Invoice'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminde to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Contracting information"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("CREATE_INVOICE", "Invoice was created for Project"), + ("UPDATE_INVOICE_STATUS", "Updated Invoice Status"), + ("DELETE_INVOICE", "Delete Invoice"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_INVOICE", "Updated Invoice"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminde to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0062_remove_payment_requests_activities.py b/hypha/apply/activity/migrations/0062_remove_payment_requests_activities.py index 6326f6c3e4..36da5f6c36 100644 --- a/hypha/apply/activity/migrations/0062_remove_payment_requests_activities.py +++ b/hypha/apply/activity/migrations/0062_remove_payment_requests_activities.py @@ -4,13 +4,13 @@ def remove_payment_request_activities(apps, schema_editor): - Activity = apps.get_model('activity', 'Activity') - Activity.objects.filter(related_content_type__model='paymentrequest').delete() + Activity = apps.get_model("activity", "Activity") + Activity.objects.filter(related_content_type__model="paymentrequest").delete() -class Migration(migrations.Migration): +class Migration(migrations.Migration): dependencies = [ - ('activity', '0061_payment_requests_cleanup'), + ("activity", "0061_payment_requests_cleanup"), ] operations = [ diff --git a/hypha/apply/activity/migrations/0063_alter_event_type.py b/hypha/apply/activity/migrations/0063_alter_event_type.py index 6bc9d7fcb4..e6daffa1ba 100644 --- a/hypha/apply/activity/migrations/0063_alter_event_type.py +++ b/hypha/apply/activity/migrations/0063_alter_event_type.py @@ -4,15 +4,67 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0062_remove_payment_requests_activities'), + ("activity", "0062_remove_payment_requests_activities"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT_SUBMISSION', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Contracting information'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('CREATE_INVOICE', 'Invoice was created for Project'), ('UPDATE_INVOICE_STATUS', 'Updated Invoice Status'), ('DELETE_INVOICE', 'Delete Invoice'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_INVOICE', 'Updated Invoice'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminder to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT_SUBMISSION", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Contracting information"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("CREATE_INVOICE", "Invoice was created for Project"), + ("UPDATE_INVOICE_STATUS", "Updated Invoice Status"), + ("DELETE_INVOICE", "Delete Invoice"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_INVOICE", "Updated Invoice"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminder to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0064_alter_event_type.py b/hypha/apply/activity/migrations/0064_alter_event_type.py index 018d77d5e7..2ac7c85dc8 100644 --- a/hypha/apply/activity/migrations/0064_alter_event_type.py +++ b/hypha/apply/activity/migrations/0064_alter_event_type.py @@ -4,15 +4,68 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0063_alter_event_type'), + ("activity", "0063_alter_event_type"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('BATCH_UPDATE_LEAD', 'Batch Update Lead'), ('EDIT_SUBMISSION', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('PARTNERS_UPDATED_PARTNER', 'Partners Updated Partner'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion'), ('DELETE_SUBMISSION', 'Delete Submission'), ('DELETE_REVIEW', 'Delete Review'), ('CREATED_PROJECT', 'Created Project'), ('UPDATED_VENDOR', 'Updated Contracting information'), ('UPDATE_PROJECT_LEAD', 'Update Project Lead'), ('EDIT_REVIEW', 'Edit Review'), ('SEND_FOR_APPROVAL', 'Send for Approval'), ('APPROVE_PROJECT', 'Project was Approved'), ('PROJECT_FINAL_APPROVAL', 'Send for Final Approval'), ('PROJECT_TRANSITION', 'Project was Transitioned'), ('REQUEST_PROJECT_CHANGE', 'Project change requested'), ('UPLOAD_DOCUMENT', 'Document was Uploaded to Project'), ('REMOVE_DOCUMENT', 'Document was Removed from Project'), ('UPLOAD_CONTRACT', 'Contract was Uploaded to Project'), ('APPROVE_CONTRACT', 'Contract was Approved'), ('CREATE_INVOICE', 'Invoice was created for Project'), ('UPDATE_INVOICE_STATUS', 'Updated Invoice Status'), ('DELETE_INVOICE', 'Delete Invoice'), ('SENT_TO_COMPLIANCE', 'Project was sent to Compliance'), ('UPDATE_INVOICE', 'Updated Invoice'), ('SUBMIT_REPORT', 'Submit Report'), ('SKIPPED_REPORT', 'Skipped Report'), ('REPORT_FREQUENCY_CHANGED', 'Report Frequency Changed'), ('REPORT_NOTIFY', 'Report Notify'), ('CREATE_REMINDER', 'Reminder Created'), ('DELETE_REMINDER', 'Reminder Deleted'), ('REVIEW_REMINDER', 'Reminder to Review'), ('BATCH_DELETE_SUBMISSION', 'Delete Batch Submissions')], max_length=50), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "Update Lead"), + ("BATCH_UPDATE_LEAD", "Batch Update Lead"), + ("EDIT_SUBMISSION", "Edit"), + ("APPLICANT_EDIT", "Applicant Edit"), + ("NEW_SUBMISSION", "New Submission"), + ("SCREENING", "Screening"), + ("TRANSITION", "Transition"), + ("BATCH_TRANSITION", "Batch Transition"), + ("DETERMINATION_OUTCOME", "Determination Outcome"), + ("BATCH_DETERMINATION_OUTCOME", "Batch Determination Outcome"), + ("INVITED_TO_PROPOSAL", "Invited To Proposal"), + ("REVIEWERS_UPDATED", "Reviewers Updated"), + ("BATCH_REVIEWERS_UPDATED", "Batch Reviewers Updated"), + ("PARTNERS_UPDATED", "Partners Updated"), + ("PARTNERS_UPDATED_PARTNER", "Partners Updated Partner"), + ("READY_FOR_REVIEW", "Ready For Review"), + ("BATCH_READY_FOR_REVIEW", "Batch Ready For Review"), + ("NEW_REVIEW", "New Review"), + ("COMMENT", "Comment"), + ("PROPOSAL_SUBMITTED", "Proposal Submitted"), + ("OPENED_SEALED", "Opened Sealed Submission"), + ("REVIEW_OPINION", "Review Opinion"), + ("DELETE_SUBMISSION", "Delete Submission"), + ("DELETE_REVIEW", "Delete Review"), + ("CREATED_PROJECT", "Created Project"), + ("UPDATED_VENDOR", "Updated Contracting information"), + ("UPDATE_PROJECT_LEAD", "Update Project Lead"), + ("EDIT_REVIEW", "Edit Review"), + ("SEND_FOR_APPROVAL", "Send for Approval"), + ("APPROVE_PROJECT", "Project was Approved"), + ("PROJECT_FINAL_APPROVAL", "Send for Final Approval"), + ("PROJECT_TRANSITION", "Project was Transitioned"), + ("REQUEST_PROJECT_CHANGE", "Project change requested"), + ("UPLOAD_DOCUMENT", "Document was Uploaded to Project"), + ("REMOVE_DOCUMENT", "Document was Removed from Project"), + ("UPLOAD_CONTRACT", "Contract was Uploaded to Project"), + ("APPROVE_CONTRACT", "Contract was Approved"), + ("CREATE_INVOICE", "Invoice was created for Project"), + ("UPDATE_INVOICE_STATUS", "Updated Invoice Status"), + ("DELETE_INVOICE", "Delete Invoice"), + ("SENT_TO_COMPLIANCE", "Project was sent to Compliance"), + ("UPDATE_INVOICE", "Updated Invoice"), + ("SUBMIT_REPORT", "Submit Report"), + ("SKIPPED_REPORT", "Skipped Report"), + ("REPORT_FREQUENCY_CHANGED", "Report Frequency Changed"), + ("REPORT_NOTIFY", "Report Notify"), + ("CREATE_REMINDER", "Reminder Created"), + ("DELETE_REMINDER", "Reminder Deleted"), + ("REVIEW_REMINDER", "Reminder to Review"), + ("BATCH_DELETE_SUBMISSION", "Delete Batch Submissions"), + ], + max_length=50, + ), ), ] diff --git a/hypha/apply/activity/migrations/0065_auto_20221006_1115.py b/hypha/apply/activity/migrations/0065_auto_20221006_1115.py index b14314f7fd..686819b685 100644 --- a/hypha/apply/activity/migrations/0065_auto_20221006_1115.py +++ b/hypha/apply/activity/migrations/0065_auto_20221006_1115.py @@ -4,20 +4,76 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0064_alter_event_type'), + ("activity", "0064_alter_event_type"), ] operations = [ migrations.AddField( - model_name='message', - name='sent_in_email_digest', + model_name="message", + name="sent_in_email_digest", field=models.BooleanField(default=False), ), migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('PROJECT_FINAL_APPROVAL', 'sent project for final approval'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("PROJECT_FINAL_APPROVAL", "sent project for final approval"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0066_alter_event_type.py b/hypha/apply/activity/migrations/0066_alter_event_type.py index 30c955eaf7..f6143babf1 100644 --- a/hypha/apply/activity/migrations/0066_alter_event_type.py +++ b/hypha/apply/activity/migrations/0066_alter_event_type.py @@ -4,15 +4,72 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0065_auto_20221006_1115'), + ("activity", "0065_auto_20221006_1115"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('PROJECT_FINAL_APPROVAL', 'sent project for final approval'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("PROJECT_FINAL_APPROVAL", "sent project for final approval"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0067_add_draft_submission.py b/hypha/apply/activity/migrations/0067_add_draft_submission.py index 4dc804087f..a9c09dac90 100644 --- a/hypha/apply/activity/migrations/0067_add_draft_submission.py +++ b/hypha/apply/activity/migrations/0067_add_draft_submission.py @@ -4,15 +4,73 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0066_alter_event_type'), + ("activity", "0066_alter_event_type"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('PROJECT_FINAL_APPROVAL', 'sent project for final approval'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("PROJECT_FINAL_APPROVAL", "sent project for final approval"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0068_add_archive_unarchive.py b/hypha/apply/activity/migrations/0068_add_archive_unarchive.py index 7184a51b60..c18b137501 100644 --- a/hypha/apply/activity/migrations/0068_add_archive_unarchive.py +++ b/hypha/apply/activity/migrations/0068_add_archive_unarchive.py @@ -4,15 +4,75 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0067_add_draft_submission'), + ("activity", "0067_add_draft_submission"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('PROJECT_FINAL_APPROVAL', 'sent project for final approval'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("PROJECT_FINAL_APPROVAL", "sent project for final approval"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0069_alter_event_type_add_disable_reporting.py b/hypha/apply/activity/migrations/0069_alter_event_type_add_disable_reporting.py index 84738cd306..40b865c966 100644 --- a/hypha/apply/activity/migrations/0069_alter_event_type_add_disable_reporting.py +++ b/hypha/apply/activity/migrations/0069_alter_event_type_add_disable_reporting.py @@ -4,15 +4,76 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0068_add_archive_unarchive'), + ("activity", "0068_add_archive_unarchive"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('PROJECT_FINAL_APPROVAL', 'sent project for final approval'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('DISABLED_REPORTING', 'disabled reporting'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("PROJECT_FINAL_APPROVAL", "sent project for final approval"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("DISABLED_REPORTING", "disabled reporting"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0070_alter_event_type.py b/hypha/apply/activity/migrations/0070_alter_event_type.py index 73ee812a01..19f25fc28b 100644 --- a/hypha/apply/activity/migrations/0070_alter_event_type.py +++ b/hypha/apply/activity/migrations/0070_alter_event_type.py @@ -4,15 +4,77 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0069_alter_event_type_add_disable_reporting'), + ("activity", "0069_alter_event_type_add_disable_reporting"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('APPROVE_PAF', 'approved paf'), ('PROJECT_FINAL_APPROVAL', 'sent project for final approval'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('DISABLED_REPORTING', 'disabled reporting'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("APPROVE_PAF", "approved paf"), + ("PROJECT_FINAL_APPROVAL", "sent project for final approval"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("DISABLED_REPORTING", "disabled reporting"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0071_alter_event_type.py b/hypha/apply/activity/migrations/0071_alter_event_type.py index 9c13d2709c..3c08dcdb62 100644 --- a/hypha/apply/activity/migrations/0071_alter_event_type.py +++ b/hypha/apply/activity/migrations/0071_alter_event_type.py @@ -4,15 +4,76 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0070_alter_event_type'), + ("activity", "0070_alter_event_type"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('APPROVE_PAF', 'approved paf'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('DISABLED_REPORTING', 'disabled reporting'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("APPROVE_PAF", "approved paf"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("DISABLED_REPORTING", "disabled reporting"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0072_alter_event_type.py b/hypha/apply/activity/migrations/0072_alter_event_type.py index 0220d07166..96a6865f74 100644 --- a/hypha/apply/activity/migrations/0072_alter_event_type.py +++ b/hypha/apply/activity/migrations/0072_alter_event_type.py @@ -4,15 +4,77 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0071_alter_event_type'), + ("activity", "0071_alter_event_type"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('APPROVE_PAF', 'approved paf'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('SUBMIT_CONTRACT_DOCUMENTS', 'submitted contract documents'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('DISABLED_REPORTING', 'disabled reporting'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("APPROVE_PAF", "approved paf"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("SUBMIT_CONTRACT_DOCUMENTS", "submitted contract documents"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("DISABLED_REPORTING", "disabled reporting"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0073_add_approve_invoice.py b/hypha/apply/activity/migrations/0073_add_approve_invoice.py index 3bfea04050..e12dc8b7be 100644 --- a/hypha/apply/activity/migrations/0073_add_approve_invoice.py +++ b/hypha/apply/activity/migrations/0073_add_approve_invoice.py @@ -4,15 +4,78 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0072_alter_event_type'), + ("activity", "0072_alter_event_type"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('APPROVE_PAF', 'approved paf'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('SUBMIT_CONTRACT_DOCUMENTS', 'submitted contract documents'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('APPROVE_INVOICE', 'approve invoice'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('DISABLED_REPORTING', 'disabled reporting'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("APPROVE_PAF", "approved paf"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("SUBMIT_CONTRACT_DOCUMENTS", "submitted contract documents"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("APPROVE_INVOICE", "approve invoice"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("DISABLED_REPORTING", "disabled reporting"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0074_alter_event_type.py b/hypha/apply/activity/migrations/0074_alter_event_type.py index ecca83337b..520f91264b 100644 --- a/hypha/apply/activity/migrations/0074_alter_event_type.py +++ b/hypha/apply/activity/migrations/0074_alter_event_type.py @@ -4,15 +4,79 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0073_add_approve_invoice'), + ("activity", "0073_add_approve_invoice"), ] operations = [ migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'updated lead'), ('BATCH_UPDATE_LEAD', 'batch updated lead'), ('EDIT_SUBMISSION', 'edited submission'), ('APPLICANT_EDIT', 'edited applicant'), ('NEW_SUBMISSION', 'submitted new submission'), ('DRAFT_SUBMISSION', 'submitted new draft submission'), ('SCREENING', 'screened'), ('TRANSITION', 'transitioned'), ('BATCH_TRANSITION', 'batch transitioned'), ('DETERMINATION_OUTCOME', 'sent determination outcome'), ('BATCH_DETERMINATION_OUTCOME', 'sent batch determination outcome'), ('INVITED_TO_PROPOSAL', 'invited to proposal'), ('REVIEWERS_UPDATED', 'updated reviewers'), ('BATCH_REVIEWERS_UPDATED', 'batch updated reviewers'), ('PARTNERS_UPDATED', 'updated partners'), ('PARTNERS_UPDATED_PARTNER', 'partners updated partner'), ('READY_FOR_REVIEW', 'marked ready for review'), ('BATCH_READY_FOR_REVIEW', 'marked batch ready for review'), ('NEW_REVIEW', 'added new review'), ('COMMENT', 'added comment'), ('PROPOSAL_SUBMITTED', 'submitted proposal'), ('OPENED_SEALED', 'opened sealed submission'), ('REVIEW_OPINION', 'reviewed opinion'), ('DELETE_SUBMISSION', 'deleted submission'), ('DELETE_REVIEW', 'deleted review'), ('CREATED_PROJECT', 'created project'), ('UPDATED_VENDOR', 'updated contracting information'), ('UPDATE_PROJECT_LEAD', 'updated project lead'), ('EDIT_REVIEW', 'edited review'), ('SEND_FOR_APPROVAL', 'sent for approval'), ('APPROVE_PROJECT', 'approved project'), ('ASSIGN_PAF_APPROVER', 'assign paf approver'), ('APPROVE_PAF', 'approved paf'), ('PROJECT_TRANSITION', 'transitioned project'), ('REQUEST_PROJECT_CHANGE', 'requested project change'), ('SUBMIT_CONTRACT_DOCUMENTS', 'submitted contract documents'), ('UPLOAD_DOCUMENT', 'uploaded document to project'), ('REMOVE_DOCUMENT', 'removed document from project'), ('UPLOAD_CONTRACT', 'uploaded contract to project'), ('APPROVE_CONTRACT', 'approved contract'), ('CREATE_INVOICE', 'created invoice for project'), ('UPDATE_INVOICE_STATUS', 'updated invoice status'), ('APPROVE_INVOICE', 'approve invoice'), ('DELETE_INVOICE', 'deleted invoice'), ('SENT_TO_COMPLIANCE', 'sent project to compliance'), ('UPDATE_INVOICE', 'updated invoice'), ('SUBMIT_REPORT', 'submitted report'), ('SKIPPED_REPORT', 'skipped report'), ('REPORT_FREQUENCY_CHANGED', 'changed report frequency'), ('DISABLED_REPORTING', 'disabled reporting'), ('REPORT_NOTIFY', 'notified report'), ('CREATE_REMINDER', 'created reminder'), ('DELETE_REMINDER', 'deleted reminder'), ('REVIEW_REMINDER', 'reminder to review'), ('BATCH_DELETE_SUBMISSION', 'batch deleted submissions'), ('BATCH_ARCHIVE_SUBMISSION', 'batch archive submissions'), ('STAFF_ACCOUNT_CREATED', 'created new account'), ('STAFF_ACCOUNT_EDITED', 'edited account'), ('ARCHIVE_SUBMISSION', 'archived submission'), ('UNARCHIVE_SUBMISSION', 'unarchived submission')], max_length=50, verbose_name='verb'), + model_name="event", + name="type", + field=models.CharField( + choices=[ + ("UPDATE_LEAD", "updated lead"), + ("BATCH_UPDATE_LEAD", "batch updated lead"), + ("EDIT_SUBMISSION", "edited submission"), + ("APPLICANT_EDIT", "edited applicant"), + ("NEW_SUBMISSION", "submitted new submission"), + ("DRAFT_SUBMISSION", "submitted new draft submission"), + ("SCREENING", "screened"), + ("TRANSITION", "transitioned"), + ("BATCH_TRANSITION", "batch transitioned"), + ("DETERMINATION_OUTCOME", "sent determination outcome"), + ("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"), + ("INVITED_TO_PROPOSAL", "invited to proposal"), + ("REVIEWERS_UPDATED", "updated reviewers"), + ("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"), + ("PARTNERS_UPDATED", "updated partners"), + ("PARTNERS_UPDATED_PARTNER", "partners updated partner"), + ("READY_FOR_REVIEW", "marked ready for review"), + ("BATCH_READY_FOR_REVIEW", "marked batch ready for review"), + ("NEW_REVIEW", "added new review"), + ("COMMENT", "added comment"), + ("PROPOSAL_SUBMITTED", "submitted proposal"), + ("OPENED_SEALED", "opened sealed submission"), + ("REVIEW_OPINION", "reviewed opinion"), + ("DELETE_SUBMISSION", "deleted submission"), + ("DELETE_REVIEW", "deleted review"), + ("CREATED_PROJECT", "created project"), + ("UPDATED_VENDOR", "updated contracting information"), + ("UPDATE_PROJECT_LEAD", "updated project lead"), + ("EDIT_REVIEW", "edited review"), + ("SEND_FOR_APPROVAL", "sent for approval"), + ("APPROVE_PROJECT", "approved project"), + ("ASSIGN_PAF_APPROVER", "assign paf approver"), + ("APPROVE_PAF", "approved paf"), + ("PROJECT_TRANSITION", "transitioned project"), + ("REQUEST_PROJECT_CHANGE", "requested project change"), + ("SUBMIT_CONTRACT_DOCUMENTS", "submitted contract documents"), + ("UPLOAD_DOCUMENT", "uploaded document to project"), + ("REMOVE_DOCUMENT", "removed document from project"), + ("UPLOAD_CONTRACT", "uploaded contract to project"), + ("APPROVE_CONTRACT", "approved contract"), + ("CREATE_INVOICE", "created invoice for project"), + ("UPDATE_INVOICE_STATUS", "updated invoice status"), + ("APPROVE_INVOICE", "approve invoice"), + ("DELETE_INVOICE", "deleted invoice"), + ("SENT_TO_COMPLIANCE", "sent project to compliance"), + ("UPDATE_INVOICE", "updated invoice"), + ("SUBMIT_REPORT", "submitted report"), + ("SKIPPED_REPORT", "skipped report"), + ("REPORT_FREQUENCY_CHANGED", "changed report frequency"), + ("DISABLED_REPORTING", "disabled reporting"), + ("REPORT_NOTIFY", "notified report"), + ("CREATE_REMINDER", "created reminder"), + ("DELETE_REMINDER", "deleted reminder"), + ("REVIEW_REMINDER", "reminder to review"), + ("BATCH_DELETE_SUBMISSION", "batch deleted submissions"), + ("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"), + ("STAFF_ACCOUNT_CREATED", "created new account"), + ("STAFF_ACCOUNT_EDITED", "edited account"), + ("ARCHIVE_SUBMISSION", "archived submission"), + ("UNARCHIVE_SUBMISSION", "unarchived submission"), + ], + max_length=50, + verbose_name="verb", + ), ), ] diff --git a/hypha/apply/activity/migrations/0075_alter_activity_visibility.py b/hypha/apply/activity/migrations/0075_alter_activity_visibility.py index 4c0b62ff82..33378f4f31 100644 --- a/hypha/apply/activity/migrations/0075_alter_activity_visibility.py +++ b/hypha/apply/activity/migrations/0075_alter_activity_visibility.py @@ -4,15 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('activity', '0074_alter_event_type'), + ("activity", "0074_alter_event_type"), ] operations = [ migrations.AlterField( - model_name='activity', - name='visibility', - field=models.CharField(choices=[('applicant', 'Applicants'), ('team', 'Staff only'), ('reviewers', 'Reviewers'), ('partners', 'Partners'), ('all', 'All')], default='applicant', max_length=30), + model_name="activity", + name="visibility", + field=models.CharField( + choices=[ + ("applicant", "Applicants"), + ("team", "Staff only"), + ("reviewers", "Reviewers"), + ("partners", "Partners"), + ("all", "All"), + ], + default="applicant", + max_length=30, + ), ), ] diff --git a/hypha/apply/activity/models.py b/hypha/apply/activity/models.py index 9b53016f0a..0e438c7061 100644 --- a/hypha/apply/activity/models.py +++ b/hypha/apply/activity/models.py @@ -9,26 +9,26 @@ from .options import MESSAGES -COMMENT = 'comment' -ACTION = 'action' +COMMENT = "comment" +ACTION = "action" ACTIVITY_TYPES = { - COMMENT: 'Comment', - ACTION: 'Action', + COMMENT: "Comment", + ACTION: "Action", } -APPLICANT = 'applicant' -TEAM = 'team' -REVIEWER = 'reviewers' -PARTNER = 'partners' -ALL = 'all' +APPLICANT = "applicant" +TEAM = "team" +REVIEWER = "reviewers" +PARTNER = "partners" +ALL = "all" VISIBILITY = { - APPLICANT: 'Applicants', - TEAM: 'Staff only', - REVIEWER: 'Reviewers', - PARTNER: 'Partners', - ALL: 'All', + APPLICANT: "Applicants", + TEAM: "Staff only", + REVIEWER: "Reviewers", + PARTNER: "Partners", + ALL: "All", } @@ -37,11 +37,12 @@ def visible_to(self, user): # To hide reviews from the applicant's activity feed # Todo: It is just for historic data and not be needed for new data after this. from .messaging import ActivityAdapter + messages = ActivityAdapter.messages if user.is_applicant: - return self.exclude( - message=messages.get(MESSAGES.NEW_REVIEW) - ).filter(visibility__in=self.model.visibility_for(user)) + return self.exclude(message=messages.get(MESSAGES.NEW_REVIEW)).filter( + visibility__in=self.model.visibility_for(user) + ) return self.filter(visibility__in=self.model.visibility_for(user)) @@ -57,7 +58,9 @@ def actions(self): return self.filter(type=ACTION) def latest(self): - return self.filter(timestamp__gte=(timezone.now() - timezone.timedelta(days=30))) + return self.filter( + timestamp__gte=(timezone.now() - timezone.timedelta(days=30)) + ) class ActivityBaseManager(models.Manager): @@ -66,9 +69,13 @@ def create(self, **kwargs): return super().create(**kwargs) def get_queryset(self): - return super().get_queryset().filter( - type=self.type, - current=True, + return ( + super() + .get_queryset() + .filter( + type=self.type, + current=True, + ) ) @@ -93,12 +100,20 @@ class Activity(models.Model): type = models.CharField(choices=ACTIVITY_TYPES.items(), max_length=30) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) - source_content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.CASCADE, related_name='activity_source') + source_content_type = models.ForeignKey( + ContentType, + blank=True, + null=True, + on_delete=models.CASCADE, + related_name="activity_source", + ) source_object_id = models.PositiveIntegerField(blank=True, null=True, db_index=True) - source = GenericForeignKey('source_content_type', 'source_object_id') + source = GenericForeignKey("source_content_type", "source_object_id") message = models.TextField() - visibility = models.CharField(choices=list(VISIBILITY.items()), default=APPLICANT, max_length=30) + visibility = models.CharField( + choices=list(VISIBILITY.items()), default=APPLICANT, max_length=30 + ) # Fields for handling versioning of the comment activity models edited = models.DateTimeField(default=None, null=True) @@ -106,9 +121,15 @@ class Activity(models.Model): previous = models.ForeignKey("self", on_delete=models.CASCADE, null=True) # Fields for generic relations to other objects. related_object should implement `get_absolute_url` - related_content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.CASCADE, related_name='activity_related') + related_content_type = models.ForeignKey( + ContentType, + blank=True, + null=True, + on_delete=models.CASCADE, + related_name="activity_related", + ) related_object_id = models.PositiveIntegerField(blank=True, null=True) - related_object = GenericForeignKey('related_content_type', 'related_object_id') + related_object = GenericForeignKey("related_content_type", "related_object_id") objects = models.Manager.from_queryset(ActivityQuerySet)() comments = CommentManger.from_queryset(CommentQueryset)() @@ -117,8 +138,8 @@ class Activity(models.Model): wagtail_reference_index_ignore = True class Meta: - ordering = ['-timestamp'] - base_manager_name = 'objects' + ordering = ["-timestamp"] + base_manager_name = "objects" @property def priviledged(self): @@ -143,7 +164,11 @@ def visibility_for(cls, user): # for project part return [TEAM, APPLICANT, REVIEWER, PARTNER, ALL] if user.is_applicant or user.is_partner: - return [APPLICANT, PARTNER, ALL] # using partner just for existing activities. + return [ + APPLICANT, + PARTNER, + ALL, + ] # using partner just for existing activities. return [ALL] @@ -154,7 +179,12 @@ def visibility_choices_for(cls, user): if user.is_reviewer: return [(REVIEWER, VISIBILITY[REVIEWER])] if user.is_apply_staff: - return [(TEAM, VISIBILITY[TEAM]), (APPLICANT, VISIBILITY[APPLICANT]), (REVIEWER, VISIBILITY[REVIEWER]), (ALL, VISIBILITY[ALL])] + return [ + (TEAM, VISIBILITY[TEAM]), + (APPLICANT, VISIBILITY[APPLICANT]), + (REVIEWER, VISIBILITY[REVIEWER]), + (ALL, VISIBILITY[ALL]), + ] if user.is_finance or user.is_contracting: return [(TEAM, VISIBILITY[TEAM]), (APPLICANT, VISIBILITY[APPLICANT])] return [(ALL, VISIBILITY[ALL])] @@ -162,20 +192,25 @@ def visibility_choices_for(cls, user): class Event(models.Model): """Model to track when messages are triggered""" + wagtail_reference_index_ignore = True when = models.DateTimeField(auto_now_add=True) type = models.CharField(_("verb"), choices=MESSAGES.choices, max_length=50) - by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True) - content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.CASCADE) + by = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True + ) + content_type = models.ForeignKey( + ContentType, blank=True, null=True, on_delete=models.CASCADE + ) object_id = models.PositiveIntegerField(blank=True, null=True) - source = GenericForeignKey('content_type', 'object_id') + source = GenericForeignKey("content_type", "object_id") def __str__(self): if self.source and hasattr(self.source, "title"): - return f'{self.by} {self.get_type_display()} - {self.source.title }' + return f"{self.by} {self.get_type_display()} - {self.source.title }" else: - return f'{self.by} {self.get_type_display()}' + return f"{self.by} {self.get_type_display()}" class MessagesQueryset(models.QuerySet): @@ -183,9 +218,9 @@ def update_status(self, status): if status: return self.update( status=Case( - When(status='', then=Value(status)), - default=Concat('status', Value('
' + status)), - output_field=models.TextField() + When(status="", then=Value(status)), + default=Concat("status", Value("
" + status)), + output_field=models.TextField(), ), ) @@ -200,18 +235,20 @@ class Message(models.Model): recipient = models.CharField(max_length=250) event = models.ForeignKey(Event, on_delete=models.CASCADE) status = models.TextField() - external_id = models.CharField(max_length=75, null=True, blank=True) # Stores the id of the object from an external system + external_id = models.CharField( + max_length=75, null=True, blank=True + ) # Stores the id of the object from an external system sent_in_email_digest = models.BooleanField(default=False) objects = MessagesQueryset.as_manager() def __str__(self): - return f'[{self.type}][{self.status}] {self.content}' + return f"[{self.type}][{self.status}] {self.content}" def update_status(self, status): if status: self.status = Case( - When(status='', then=Value(status)), - default=Concat('status', Value('
' + status)), - output_field=models.TextField() + When(status="", then=Value(status)), + default=Concat("status", Value("
" + status)), + output_field=models.TextField(), ) self.save() diff --git a/hypha/apply/activity/options.py b/hypha/apply/activity/options.py index 7ba8bba056..bb3861fa7e 100644 --- a/hypha/apply/activity/options.py +++ b/hypha/apply/activity/options.py @@ -4,63 +4,71 @@ class MESSAGES(TextChoices): # Format: {Python Value} = {DB Value} {Display Text or Verb} - UPDATE_LEAD = 'UPDATE_LEAD', _('updated lead') - BATCH_UPDATE_LEAD = 'BATCH_UPDATE_LEAD', _('batch updated lead') - EDIT_SUBMISSION = 'EDIT_SUBMISSION', _('edited submission') - APPLICANT_EDIT = 'APPLICANT_EDIT', _("edited applicant") - NEW_SUBMISSION = 'NEW_SUBMISSION', _('submitted new submission') - DRAFT_SUBMISSION = 'DRAFT_SUBMISSION', _('submitted new draft submission') - SCREENING = 'SCREENING', _('screened') - TRANSITION = 'TRANSITION', _('transitioned') - BATCH_TRANSITION = 'BATCH_TRANSITION', _('batch transitioned') - DETERMINATION_OUTCOME = 'DETERMINATION_OUTCOME', _('sent determination outcome') - BATCH_DETERMINATION_OUTCOME = 'BATCH_DETERMINATION_OUTCOME', _('sent batch determination outcome') - INVITED_TO_PROPOSAL = 'INVITED_TO_PROPOSAL', _('invited to proposal') - REVIEWERS_UPDATED = 'REVIEWERS_UPDATED', _('updated reviewers') - BATCH_REVIEWERS_UPDATED = 'BATCH_REVIEWERS_UPDATED', _('batch updated reviewers') - PARTNERS_UPDATED = 'PARTNERS_UPDATED', _('updated partners') - PARTNERS_UPDATED_PARTNER = 'PARTNERS_UPDATED_PARTNER', _('partners updated partner') - READY_FOR_REVIEW = 'READY_FOR_REVIEW', _('marked ready for review') - BATCH_READY_FOR_REVIEW = 'BATCH_READY_FOR_REVIEW', _('marked batch ready for review') - NEW_REVIEW = 'NEW_REVIEW', _('added new review') - COMMENT = 'COMMENT', _('added comment') - PROPOSAL_SUBMITTED = 'PROPOSAL_SUBMITTED', _('submitted proposal') - OPENED_SEALED = 'OPENED_SEALED', _('opened sealed submission') - REVIEW_OPINION = 'REVIEW_OPINION', _('reviewed opinion') - DELETE_SUBMISSION = 'DELETE_SUBMISSION', _('deleted submission') - DELETE_REVIEW = 'DELETE_REVIEW', _('deleted review') - CREATED_PROJECT = 'CREATED_PROJECT', _('created project') - UPDATED_VENDOR = 'UPDATED_VENDOR', _('updated contracting information') - UPDATE_PROJECT_LEAD = 'UPDATE_PROJECT_LEAD', _('updated project lead') - EDIT_REVIEW = 'EDIT_REVIEW', _('edited review') - SEND_FOR_APPROVAL = 'SEND_FOR_APPROVAL', _('sent for approval') - APPROVE_PROJECT = 'APPROVE_PROJECT', _('approved project') - ASSIGN_PAF_APPROVER = 'ASSIGN_PAF_APPROVER', _('assign paf approver') - APPROVE_PAF = 'APPROVE_PAF', _('approved paf') - PROJECT_TRANSITION = 'PROJECT_TRANSITION', _('transitioned project') - REQUEST_PROJECT_CHANGE = 'REQUEST_PROJECT_CHANGE', _('requested project change') - SUBMIT_CONTRACT_DOCUMENTS = 'SUBMIT_CONTRACT_DOCUMENTS', _('submitted contract documents') - UPLOAD_DOCUMENT = 'UPLOAD_DOCUMENT', _('uploaded document to project') - REMOVE_DOCUMENT = 'REMOVE_DOCUMENT', _('removed document from project') - UPLOAD_CONTRACT = 'UPLOAD_CONTRACT', _('uploaded contract to project') - APPROVE_CONTRACT = 'APPROVE_CONTRACT', _('approved contract') - CREATE_INVOICE = 'CREATE_INVOICE', _('created invoice for project') - UPDATE_INVOICE_STATUS = 'UPDATE_INVOICE_STATUS', _('updated invoice status') - APPROVE_INVOICE = 'APPROVE_INVOICE', _('approve invoice') - DELETE_INVOICE = 'DELETE_INVOICE', _('deleted invoice') - SENT_TO_COMPLIANCE = 'SENT_TO_COMPLIANCE', _('sent project to compliance') - UPDATE_INVOICE = 'UPDATE_INVOICE', _('updated invoice') - SUBMIT_REPORT = 'SUBMIT_REPORT', _('submitted report') - SKIPPED_REPORT = 'SKIPPED_REPORT', _('skipped report') - REPORT_FREQUENCY_CHANGED = 'REPORT_FREQUENCY_CHANGED', _('changed report frequency') - DISABLED_REPORTING = 'DISABLED_REPORTING', _('disabled reporting') - REPORT_NOTIFY = 'REPORT_NOTIFY', _('notified report') - CREATE_REMINDER = 'CREATE_REMINDER', _('created reminder') - DELETE_REMINDER = 'DELETE_REMINDER', _('deleted reminder') - REVIEW_REMINDER = 'REVIEW_REMINDER', _('reminder to review') - BATCH_DELETE_SUBMISSION = 'BATCH_DELETE_SUBMISSION', _('batch deleted submissions') - BATCH_ARCHIVE_SUBMISSION = 'BATCH_ARCHIVE_SUBMISSION', _('batch archive submissions') - STAFF_ACCOUNT_CREATED = 'STAFF_ACCOUNT_CREATED', _('created new account') - STAFF_ACCOUNT_EDITED = 'STAFF_ACCOUNT_EDITED', _('edited account') - ARCHIVE_SUBMISSION = 'ARCHIVE_SUBMISSION', _('archived submission') - UNARCHIVE_SUBMISSION = 'UNARCHIVE_SUBMISSION', _('unarchived submission') + UPDATE_LEAD = "UPDATE_LEAD", _("updated lead") + BATCH_UPDATE_LEAD = "BATCH_UPDATE_LEAD", _("batch updated lead") + EDIT_SUBMISSION = "EDIT_SUBMISSION", _("edited submission") + APPLICANT_EDIT = "APPLICANT_EDIT", _("edited applicant") + NEW_SUBMISSION = "NEW_SUBMISSION", _("submitted new submission") + DRAFT_SUBMISSION = "DRAFT_SUBMISSION", _("submitted new draft submission") + SCREENING = "SCREENING", _("screened") + TRANSITION = "TRANSITION", _("transitioned") + BATCH_TRANSITION = "BATCH_TRANSITION", _("batch transitioned") + DETERMINATION_OUTCOME = "DETERMINATION_OUTCOME", _("sent determination outcome") + BATCH_DETERMINATION_OUTCOME = "BATCH_DETERMINATION_OUTCOME", _( + "sent batch determination outcome" + ) + INVITED_TO_PROPOSAL = "INVITED_TO_PROPOSAL", _("invited to proposal") + REVIEWERS_UPDATED = "REVIEWERS_UPDATED", _("updated reviewers") + BATCH_REVIEWERS_UPDATED = "BATCH_REVIEWERS_UPDATED", _("batch updated reviewers") + PARTNERS_UPDATED = "PARTNERS_UPDATED", _("updated partners") + PARTNERS_UPDATED_PARTNER = "PARTNERS_UPDATED_PARTNER", _("partners updated partner") + READY_FOR_REVIEW = "READY_FOR_REVIEW", _("marked ready for review") + BATCH_READY_FOR_REVIEW = "BATCH_READY_FOR_REVIEW", _( + "marked batch ready for review" + ) + NEW_REVIEW = "NEW_REVIEW", _("added new review") + COMMENT = "COMMENT", _("added comment") + PROPOSAL_SUBMITTED = "PROPOSAL_SUBMITTED", _("submitted proposal") + OPENED_SEALED = "OPENED_SEALED", _("opened sealed submission") + REVIEW_OPINION = "REVIEW_OPINION", _("reviewed opinion") + DELETE_SUBMISSION = "DELETE_SUBMISSION", _("deleted submission") + DELETE_REVIEW = "DELETE_REVIEW", _("deleted review") + CREATED_PROJECT = "CREATED_PROJECT", _("created project") + UPDATED_VENDOR = "UPDATED_VENDOR", _("updated contracting information") + UPDATE_PROJECT_LEAD = "UPDATE_PROJECT_LEAD", _("updated project lead") + EDIT_REVIEW = "EDIT_REVIEW", _("edited review") + SEND_FOR_APPROVAL = "SEND_FOR_APPROVAL", _("sent for approval") + APPROVE_PROJECT = "APPROVE_PROJECT", _("approved project") + ASSIGN_PAF_APPROVER = "ASSIGN_PAF_APPROVER", _("assign paf approver") + APPROVE_PAF = "APPROVE_PAF", _("approved paf") + PROJECT_TRANSITION = "PROJECT_TRANSITION", _("transitioned project") + REQUEST_PROJECT_CHANGE = "REQUEST_PROJECT_CHANGE", _("requested project change") + SUBMIT_CONTRACT_DOCUMENTS = "SUBMIT_CONTRACT_DOCUMENTS", _( + "submitted contract documents" + ) + UPLOAD_DOCUMENT = "UPLOAD_DOCUMENT", _("uploaded document to project") + REMOVE_DOCUMENT = "REMOVE_DOCUMENT", _("removed document from project") + UPLOAD_CONTRACT = "UPLOAD_CONTRACT", _("uploaded contract to project") + APPROVE_CONTRACT = "APPROVE_CONTRACT", _("approved contract") + CREATE_INVOICE = "CREATE_INVOICE", _("created invoice for project") + UPDATE_INVOICE_STATUS = "UPDATE_INVOICE_STATUS", _("updated invoice status") + APPROVE_INVOICE = "APPROVE_INVOICE", _("approve invoice") + DELETE_INVOICE = "DELETE_INVOICE", _("deleted invoice") + SENT_TO_COMPLIANCE = "SENT_TO_COMPLIANCE", _("sent project to compliance") + UPDATE_INVOICE = "UPDATE_INVOICE", _("updated invoice") + SUBMIT_REPORT = "SUBMIT_REPORT", _("submitted report") + SKIPPED_REPORT = "SKIPPED_REPORT", _("skipped report") + REPORT_FREQUENCY_CHANGED = "REPORT_FREQUENCY_CHANGED", _("changed report frequency") + DISABLED_REPORTING = "DISABLED_REPORTING", _("disabled reporting") + REPORT_NOTIFY = "REPORT_NOTIFY", _("notified report") + CREATE_REMINDER = "CREATE_REMINDER", _("created reminder") + DELETE_REMINDER = "DELETE_REMINDER", _("deleted reminder") + REVIEW_REMINDER = "REVIEW_REMINDER", _("reminder to review") + BATCH_DELETE_SUBMISSION = "BATCH_DELETE_SUBMISSION", _("batch deleted submissions") + BATCH_ARCHIVE_SUBMISSION = "BATCH_ARCHIVE_SUBMISSION", _( + "batch archive submissions" + ) + STAFF_ACCOUNT_CREATED = "STAFF_ACCOUNT_CREATED", _("created new account") + STAFF_ACCOUNT_EDITED = "STAFF_ACCOUNT_EDITED", _("edited account") + ARCHIVE_SUBMISSION = "ARCHIVE_SUBMISSION", _("archived submission") + UNARCHIVE_SUBMISSION = "UNARCHIVE_SUBMISSION", _("unarchived submission") diff --git a/hypha/apply/activity/services.py b/hypha/apply/activity/services.py index e91c511457..af3dcf2f3f 100644 --- a/hypha/apply/activity/services.py +++ b/hypha/apply/activity/services.py @@ -16,9 +16,9 @@ def get_related_actions_for_user(obj, user): return ( Activity.actions.filter(**{related_query: obj}) - .select_related('user') + .select_related("user") .prefetch_related( - 'related_object', + "related_object", ) .visible_to(user) ) @@ -39,9 +39,9 @@ def get_related_comments_for_user(obj, user): return ( Activity.comments.filter(**{related_query: obj}) - .select_related('user') + .select_related("user") .prefetch_related( - 'related_object', + "related_object", ) .visible_to(user) ) diff --git a/hypha/apply/activity/signals.py b/hypha/apply/activity/signals.py index 11794ddc17..ebb0b6b4bc 100644 --- a/hypha/apply/activity/signals.py +++ b/hypha/apply/activity/signals.py @@ -6,7 +6,7 @@ @receiver(tracking) def handle_event(sender, event, esp_name, **kwargs): - status = 'Webhook received: {} [{}]'.format(event.event_type, event.timestamp) + status = "Webhook received: {} [{}]".format(event.event_type, event.timestamp) if event.description: - status += ' ' + event.description + status += " " + event.description Message.objects.get(external_id=event.message_id).update_status(status) diff --git a/hypha/apply/activity/tasks.py b/hypha/apply/activity/tasks.py index cc4c13f21a..07995731c0 100644 --- a/hypha/apply/activity/tasks.py +++ b/hypha/apply/activity/tasks.py @@ -2,9 +2,9 @@ from django.conf import settings from django.core.mail import EmailMessage -app = Celery('tasks') +app = Celery("tasks") -app.config_from_object(settings, namespace='CELERY', force=True) +app.config_from_object(settings, namespace="CELERY", force=True) def send_mail(subject, message, from_address, recipients, logs=None): @@ -13,10 +13,10 @@ def send_mail(subject, message, from_address, recipients, logs=None): # Convenience method to wrap the tasks and handle the callback send_mail_task.apply_async( kwargs={ - 'subject': subject, - 'body': message, - 'from_email': from_address, - 'to': recipients, + "subject": subject, + "body": message, + "from_email": from_address, + "to": recipients, }, link=update_message_status.s([log.pk for log in logs]), ) @@ -24,20 +24,20 @@ def send_mail(subject, message, from_address, recipients, logs=None): @app.task def send_mail_task(**kwargs): - response = {'status': '', 'id': None} + response = {"status": "", "id": None} email = EmailMessage(**kwargs) try: email.send() except Exception as e: - response['status'] = 'Error: ' + str(e) + response["status"] = "Error: " + str(e) else: try: return { - 'status': email.anymail_status.status.pop(), - 'id': email.anymail_status.message_id, + "status": email.anymail_status.status.pop(), + "id": email.anymail_status.message_id, } except AttributeError: - response['status'] = 'sent' + response["status"] = "sent" return response @@ -45,6 +45,7 @@ def send_mail_task(**kwargs): @app.task def update_message_status(response, message_pks): from .models import Message + messages = Message.objects.filter(pk__in=message_pks) - messages.update(external_id=response['id']) - messages.update_status(response['status']) + messages.update(external_id=response["id"]) + messages.update_status(response["status"]) diff --git a/hypha/apply/activity/templates/activity/include/action_list.html b/hypha/apply/activity/templates/activity/include/action_list.html index 858131d59d..e1028e5bc1 100644 --- a/hypha/apply/activity/templates/activity/include/action_list.html +++ b/hypha/apply/activity/templates/activity/include/action_list.html @@ -2,5 +2,5 @@ {% for action in actions %} {% include "activity/include/listing_base.html" with activity=action %} {% empty %} -{% trans "There are no actions." %} + {% trans "There are no actions." %} {% endfor %} diff --git a/hypha/apply/activity/templates/activity/include/listing_base.html b/hypha/apply/activity/templates/activity/include/listing_base.html index 94c0a192f4..450b1dc5b7 100644 --- a/hypha/apply/activity/templates/activity/include/listing_base.html +++ b/hypha/apply/activity/templates/activity/include/listing_base.html @@ -22,10 +22,10 @@

{% endif %} - +

@@ -35,9 +35,9 @@ {% if editable %}

+ data-visibility-options="{{activity|visibility_options:activity.user}}" + data-visibility="{{activity.visibility}}" + data-edit-url="{% url 'api:v1:comments-edit' pk=activity.pk %}"> {{ activity|display_for:request.user|submission_links|markdown|bleach }}
@@ -49,9 +49,9 @@ {% if not submission_title and activity|user_can_see_related:request.user %} {% with url=activity.related_object.get_absolute_url %} {% if url %} - - {% trans "View " %}{{ activity.related_object|model_verbose_name }} - + + {% trans "View " %}{{ activity.related_object|model_verbose_name }} + {% endif %} {% endwith %} {% endif %} diff --git a/hypha/apply/activity/templates/activity/include/notifications_dropdown.html b/hypha/apply/activity/templates/activity/include/notifications_dropdown.html index a1c538d4da..65d7830fba 100644 --- a/hypha/apply/activity/templates/activity/include/notifications_dropdown.html +++ b/hypha/apply/activity/templates/activity/include/notifications_dropdown.html @@ -8,12 +8,12 @@ {% for activity in latest_notifications %} -

- {{ activity.source_content_type.name|source_type }} - {{ activity.source.title|capfirst|truncatechars:15 }} - : {{ activity.user.get_full_name }} {% if activity.type == 'comment' %}{% trans "made a comment" %}{% else %} {{ activity|display_for:request.user }}{% endif %} - {% if activity.related_object %}{{ activity.related_object|model_verbose_name }}{% endif %} -

+

+ {{ activity.source_content_type.name|source_type }} + {{ activity.source.title|capfirst|truncatechars:15 }} + : {{ activity.user.get_full_name }} {% if activity.type == 'comment' %}{% trans "made a comment" %}{% else %} {{ activity|display_for:request.user }}{% endif %} + {% if activity.related_object %}{{ activity.related_object|model_verbose_name }}{% endif %} +

{% endfor %} diff --git a/hypha/apply/activity/templates/activity/notifications.html b/hypha/apply/activity/templates/activity/notifications.html index 293f9a09cf..ebe60b9a8b 100644 --- a/hypha/apply/activity/templates/activity/notifications.html +++ b/hypha/apply/activity/templates/activity/notifications.html @@ -2,68 +2,68 @@ {% load i18n static activity_tags apply_tags bleach_tags markdown_tags submission_tags %} {% block content %} -
-
-
-

{% trans "Notifications" %}

-
- {{ filter.form }} - -
-
+
+
+
+

{% trans "Notifications" %}

+
+ {{ filter.form }} + +
+
- -
-
+
{# Tab 1 #} -
- {% for activity in object_list %} - {% if activity.type == 'comment' %} -
-
-

{{ activity.source_content_type.name|source_type }}

-
-
-
-

{{ activity.source.title|capfirst }} - : {{ activity.user.get_full_name }} {% trans "made a comment" %} {{ activity.timestamp|date:"SHORT_DATETIME_FORMAT" }}

+
+ {% for activity in object_list %} + {% if activity.type == 'comment' %} +
+
+

{{ activity.source_content_type.name|source_type }}

+
+
+
+

{{ activity.source.title|capfirst }} + : {{ activity.user.get_full_name }} {% trans "made a comment" %} {{ activity.timestamp|date:"SHORT_DATETIME_FORMAT" }}

+
-
- {% endif %} - {% endfor %} -
+ {% endif %} + {% endfor %} +
{# Tab 2 #} -
- {% for activity in object_list %} - {% if activity.type == 'action' %} -
-
-

{{ activity.source_content_type.name|source_type }}

-
-
-
-

{{ activity.source.title|capfirst }} - : {{ activity.user.get_full_name }} {{ activity|display_for:request.user }} {{ activity.timestamp|date:"SHORT_DATETIME_FORMAT" }} {% if activity.related_object %}{{ activity.related_object|model_verbose_name }} {% endif %}

+
+ {% for activity in object_list %} + {% if activity.type == 'action' %} +
+
+

{{ activity.source_content_type.name|source_type }}

+
+
+
+

{{ activity.source.title|capfirst }} + : {{ activity.user.get_full_name }} {{ activity|display_for:request.user }} {{ activity.timestamp|date:"SHORT_DATETIME_FORMAT" }} {% if activity.related_object %}{{ activity.related_object|model_verbose_name }} {% endif %}

+
-
- {% endif %} - {% endfor %} + {% endif %} + {% endfor %} +
-
{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/applicant_base.html b/hypha/apply/activity/templates/messages/email/applicant_base.html index 636c74b1e1..add652564c 100644 --- a/hypha/apply/activity/templates/messages/email/applicant_base.html +++ b/hypha/apply/activity/templates/messages/email/applicant_base.html @@ -4,8 +4,8 @@ {% block salutation %}{% blocktrans with name=source.user.get_full_name|default:"applicant" %}Dear {{ name }},{% endblocktrans %}{% endblock %} {% block more_info %}{% trans "Link to your application" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications + {% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications -{% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }} + {% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }} -{% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %}{% endblock %} + {% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %}{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/assign_paf_approvers.html b/hypha/apply/activity/templates/messages/email/assign_paf_approvers.html index e87757f02a..260d98bbf7 100644 --- a/hypha/apply/activity/templates/messages/email/assign_paf_approvers.html +++ b/hypha/apply/activity/templates/messages/email/assign_paf_approvers.html @@ -4,11 +4,11 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "Project documents are ready to be assigned for approval." %} + {% trans "Project documents are ready to be assigned for approval." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} -{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} + {% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/base.html b/hypha/apply/activity/templates/messages/email/base.html index 32d0a614dc..d1d595f06c 100644 --- a/hypha/apply/activity/templates/messages/email/base.html +++ b/hypha/apply/activity/templates/messages/email/base.html @@ -6,9 +6,9 @@ {% block more_info %}{% endblock %} {% blocktrans %}Kind Regards, -The {{ ORG_SHORT_NAME }} Team{% endblocktrans %} + The {{ ORG_SHORT_NAME }} Team{% endblocktrans %} --- +-- {{ ORG_LONG_NAME }} {% if PUBLIC_SITE.root_url %}{{ PUBLIC_SITE.root_url }}{% elif ORG_URL %}{{ ORG_URL }}{% endif %} {% block post_signature_content %}{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/batch_ready_to_review.html b/hypha/apply/activity/templates/messages/email/batch_ready_to_review.html index 476ec5111c..acdb60888d 100644 --- a/hypha/apply/activity/templates/messages/email/batch_ready_to_review.html +++ b/hypha/apply/activity/templates/messages/email/batch_ready_to_review.html @@ -4,11 +4,11 @@ {% block salutation %}{% trans "Dear Reviewer," %}{% endblock %} {% block content %} -{% trans "New applications have been added to your review list." %} -{% for submission in sources %} + {% trans "New applications have been added to your review list." %} + {% for submission in sources %} -{% trans "Title" %}: {{ submission.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }} -{% endfor %} + {% trans "Title" %}: {{ submission.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }} + {% endfor %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/comment.html b/hypha/apply/activity/templates/messages/email/comment.html index 10c9c2d76a..adcc0d0a07 100644 --- a/hypha/apply/activity/templates/messages/email/comment.html +++ b/hypha/apply/activity/templates/messages/email/comment.html @@ -3,8 +3,8 @@ {% load i18n %} {% block content %}{% blocktrans with title=source.title user=comment.user %}There has been a new comment on "{{ title }}" by {{ user }}.{% endblocktrans %} -{% trans "Read the full comment here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications{% endblock %} + {% trans "Read the full comment here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications{% endblock %} {% block more_info %} -{% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %} + {% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/contract_uploaded.html b/hypha/apply/activity/templates/messages/email/contract_uploaded.html index d83771099f..efe88ae8fa 100644 --- a/hypha/apply/activity/templates/messages/email/contract_uploaded.html +++ b/hypha/apply/activity/templates/messages/email/contract_uploaded.html @@ -3,33 +3,33 @@ {% load i18n %} {% block salutation %} -{% if request.user != source.user %} -{% blocktrans with name=source.user.get_full_name|default:"vendor" %}Dear {{ name }},{% endblocktrans %} -{% endif %} + {% if request.user != source.user %} + {% blocktrans with name=source.user.get_full_name|default:"vendor" %}Dear {{ name }},{% endblocktrans %} + {% endif %} {% endblock %} {% block content %} -{% trans "A new contract has been added to your Project" %}: + {% trans "A new contract has been added to your Project" %}: -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% if contract.is_signed %} -{% trans "This contract has already been signed and there is no action for you to take." %} -{% else %} -{% blocktrans %}Please review the contract and sign it before reuploading it to your Project page for the {{ ORG_SHORT_NAME }} Team to approve.{% endblocktrans %} -{% endif %} + {% if contract.is_signed %} + {% trans "This contract has already been signed and there is no action for you to take." %} + {% else %} + {% blocktrans %}Please review the contract and sign it before reuploading it to your Project page for the {{ ORG_SHORT_NAME }} Team to approve.{% endblocktrans %} + {% endif %} {% endblock %} {% block more_info %} -{% if request.user != source.user %} -{% trans "Link to your application" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications + {% if request.user != source.user %} + {% trans "Link to your application" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications -{% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }} + {% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }} -{% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %} -{% endif %} + {% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %} + {% endif %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/determination.html b/hypha/apply/activity/templates/messages/email/determination.html index f47f293f49..99f53547de 100644 --- a/hypha/apply/activity/templates/messages/email/determination.html +++ b/hypha/apply/activity/templates/messages/email/determination.html @@ -3,6 +3,6 @@ {% block content %}{% trans "Your application has been reviewed and the outcome is" %}: {{ determination.clean_outcome }} -{{ determination.message|bleach|striptags }} + {{ determination.message|bleach|striptags }} -{% trans "Read the full determination here" %}: {{ request.scheme }}://{{ request.get_host }}{{ determination.get_absolute_url }}{% endblock %} + {% trans "Read the full determination here" %}: {{ request.scheme }}://{{ request.get_host }}{{ determination.get_absolute_url }}{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/invited_to_proposal.html b/hypha/apply/activity/templates/messages/email/invited_to_proposal.html index 27bac4f1be..02bf64edc4 100644 --- a/hypha/apply/activity/templates/messages/email/invited_to_proposal.html +++ b/hypha/apply/activity/templates/messages/email/invited_to_proposal.html @@ -3,11 +3,11 @@ {% load i18n %} {% block content %}{% blocktrans %}We’ve reviewed your Concept note and think it could be a good fit for {{ ORG_SHORT_NAME }} funding. We would like to invite you to submit a Proposal with more details about your project. You will receive a second email linking to a determination message with detailed feedback.{% endblocktrans %} -{% blocktrans %}Please review our Proposal Guide at {{ ORG_GUIDE_URL }} to learn more about the information we’d like to see. In the proposal please also address the feedback we provided in the concept note determination.{% endblocktrans %}{% endblock %} + {% blocktrans %}Please review our Proposal Guide at {{ ORG_GUIDE_URL }} to learn more about the information we’d like to see. In the proposal please also address the feedback we provided in the concept note determination.{% endblocktrans %}{% endblock %} {% block more_info %}{% trans "Here is the link to start creating your proposal" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications + {% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications -{% blocktrans %}The system will allow you to save a draft of your proposal as you work on it. When you feel it is ready for our review, please click the “Submit” button and we’ll know to take a look at it. We’ll reply to you with feedback on your Proposal as quickly as possible.{% endblocktrans %} + {% blocktrans %}The system will allow you to save a draft of your proposal as you work on it. When you feel it is ready for our review, please click the “Submit” button and we’ll know to take a look at it. We’ll reply to you with feedback on your Proposal as quickly as possible.{% endblocktrans %} -{% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %}{% endblock %} + {% blocktrans %}If you have any issues accessing the submission system or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %}{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/invoice_approved.html b/hypha/apply/activity/templates/messages/email/invoice_approved.html index bfd469580e..722cb477e4 100644 --- a/hypha/apply/activity/templates/messages/email/invoice_approved.html +++ b/hypha/apply/activity/templates/messages/email/invoice_approved.html @@ -4,11 +4,11 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "An Invoice is waiting for your approval." %} + {% trans "An Invoice is waiting for your approval." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }} -{% trans "Project" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }} + {% trans "Project" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/invoice_status_updated.html b/hypha/apply/activity/templates/messages/email/invoice_status_updated.html index beb1dde56a..0aeba8e538 100644 --- a/hypha/apply/activity/templates/messages/email/invoice_status_updated.html +++ b/hypha/apply/activity/templates/messages/email/invoice_status_updated.html @@ -2,18 +2,18 @@ {% load i18n invoice_tools %} {% block content %} -{% display_invoice_status_for_user source.user invoice as invoice_status %} -{% blocktrans with title=source.title date_from=invoice.date_from date_to=invoice.date_to %}An {{ ORG_SHORT_NAME }} staff member has updated your invoice for {{ title }} for period {{ date_from }} to {{ date_to }}.{% endblocktrans %} + {% display_invoice_status_for_user source.user invoice as invoice_status %} + {% blocktrans with title=source.title date_from=invoice.date_from date_to=invoice.date_to %}An {{ ORG_SHORT_NAME }} staff member has updated your invoice for {{ title }} for period {{ date_from }} to {{ date_to }}.{% endblocktrans %} -{% blocktrans %}It is now {{ invoice_status }}.{% endblocktrans %} + {% blocktrans %}It is now {{ invoice_status }}.{% endblocktrans %} -{% if has_changes_requested and invoice.comment %} -{% trans "The staff member left this comment" %}: + {% if has_changes_requested and invoice.comment %} + {% trans "The staff member left this comment" %}: - {{ invoice.comment }} -{% endif %} + {{ invoice.comment }} + {% endif %} -{% trans "Invoice Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }} -{% trans "Title" %}: {{ source.title }} -{% trans "Project Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Invoice Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Project Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/invoice_updated.html b/hypha/apply/activity/templates/messages/email/invoice_updated.html index f20f2a81e9..df64ca24cf 100644 --- a/hypha/apply/activity/templates/messages/email/invoice_updated.html +++ b/hypha/apply/activity/templates/messages/email/invoice_updated.html @@ -2,11 +2,11 @@ {% load i18n invoice_tools %} {% block content %} -{% display_invoice_status_for_user source.user invoice as invoice_status %} + {% display_invoice_status_for_user source.user invoice as invoice_status %} -{% blocktrans with title=source.title date_from=invoice.date_from date_to=invoice.date_to %}An {{ ORG_SHORT_NAME }} staff member has updated your invoice for {{ title }} for period {{ date_from }} to {{ date_to }}.{% endblocktrans %} -{% blocktrans %}It is now {{ invoice_status }}.{% endblocktrans %} + {% blocktrans with title=source.title date_from=invoice.date_from date_to=invoice.date_to %}An {{ ORG_SHORT_NAME }} staff member has updated your invoice for {{ title }} for period {{ date_from }} to {{ date_to }}.{% endblocktrans %} + {% blocktrans %}It is now {{ invoice_status }}.{% endblocktrans %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/paf_for_approval.html b/hypha/apply/activity/templates/messages/email/paf_for_approval.html index 628b6a7e60..979e0d6945 100644 --- a/hypha/apply/activity/templates/messages/email/paf_for_approval.html +++ b/hypha/apply/activity/templates/messages/email/paf_for_approval.html @@ -4,11 +4,11 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "A Project is awaiting your review." %} + {% trans "A Project is awaiting your review." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} -{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} + {% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/partners_update_applicant.html b/hypha/apply/activity/templates/messages/email/partners_update_applicant.html index 494b7d34b0..bb32ef59dc 100644 --- a/hypha/apply/activity/templates/messages/email/partners_update_applicant.html +++ b/hypha/apply/activity/templates/messages/email/partners_update_applicant.html @@ -2,10 +2,10 @@ {% load i18n %} {% block content %} -{% trans "New partner(s) has been added to your submission." %} -{% for partner in added %} -* {{ partner }} -{% endfor %} -{% trans "Title" %}: {{ submission.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }} + {% trans "New partner(s) has been added to your submission." %} + {% for partner in added %} + * {{ partner }} + {% endfor %} + {% trans "Title" %}: {{ submission.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/partners_update_partner.html b/hypha/apply/activity/templates/messages/email/partners_update_partner.html index 4707dc924a..e81705377b 100644 --- a/hypha/apply/activity/templates/messages/email/partners_update_partner.html +++ b/hypha/apply/activity/templates/messages/email/partners_update_partner.html @@ -4,8 +4,8 @@ {% block salutation %}{% trans "Dear Partner," %}{% endblock %} {% block content %} -{% trans "You have been added as a partner the following submission." %} + {% trans "You have been added as a partner the following submission." %} -{% trans "Title" %}: {{ submission.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }} + {% trans "Title" %}: {{ submission.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/project_final_approval.html b/hypha/apply/activity/templates/messages/email/project_final_approval.html index 762e63e1a1..84a31ca594 100644 --- a/hypha/apply/activity/templates/messages/email/project_final_approval.html +++ b/hypha/apply/activity/templates/messages/email/project_final_approval.html @@ -4,11 +4,11 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "A Project is awaiting final approval." %} + {% trans "A Project is awaiting final approval." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} -{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} + {% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/project_request_change.html b/hypha/apply/activity/templates/messages/email/project_request_change.html index 64bf7ae516..1482407df7 100644 --- a/hypha/apply/activity/templates/messages/email/project_request_change.html +++ b/hypha/apply/activity/templates/messages/email/project_request_change.html @@ -4,9 +4,9 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "A Project has been rejected by PAF reviewers, please update it accordingly and resubmit it to the reviewers." %} + {% trans "A Project has been rejected by PAF reviewers, please update it accordingly and resubmit it to the reviewers." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:detail' pk=source.pk %} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:detail' pk=source.pk %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/ready_for_contracting.html b/hypha/apply/activity/templates/messages/email/ready_for_contracting.html index 9748a6c5ae..a1065fa4a8 100644 --- a/hypha/apply/activity/templates/messages/email/ready_for_contracting.html +++ b/hypha/apply/activity/templates/messages/email/ready_for_contracting.html @@ -4,12 +4,12 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "A Project is waiting for contract" %} + {% trans "A Project is waiting for contract" %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:detail' pk=source.pk %} -{% trans "Project Approval Form" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} -{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:detail' pk=source.pk %} + {% trans "Project Approval Form" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} + {% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/ready_for_invoicing.html b/hypha/apply/activity/templates/messages/email/ready_for_invoicing.html index bae568e1f1..6e9d1d1c8e 100644 --- a/hypha/apply/activity/templates/messages/email/ready_for_invoicing.html +++ b/hypha/apply/activity/templates/messages/email/ready_for_invoicing.html @@ -4,8 +4,8 @@ {% block content %}{% blocktrans with title=source.title %}The contract for your project "{{ title }}" has approved. Now, your project is ready for invoicing.{% endblocktrans %}{% endblock %} {% block more_info %}{% trans "Link to your project" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications + {% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications -{% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }} + {% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }} -{% blocktrans %}If you have any issues accessing the project or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %}{% endblock %} + {% blocktrans %}If you have any issues accessing the project or other general inquiries, please email us at {{ ORG_EMAIL }}{% endblocktrans %}{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/ready_to_review.html b/hypha/apply/activity/templates/messages/email/ready_to_review.html index 0e2174d775..1938cea4e9 100644 --- a/hypha/apply/activity/templates/messages/email/ready_to_review.html +++ b/hypha/apply/activity/templates/messages/email/ready_to_review.html @@ -3,14 +3,14 @@ {% load i18n %} {% block salutation %}{% trans "Dear Reviewer," %}{% endblock %} {% block content %} -{% trans "This application is awaiting your review." %} + {% trans "This application is awaiting your review." %} -{% trans "Title" %}: {{ source.title }} -{% if related.title %} -{% trans "Reminder Title" %}: {{ related.title }} -{% endif %} -{% if related.description %} -{% trans "Reminder Description" %}: {{ related.description }} -{% endif %} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% if related.title %} + {% trans "Reminder Title" %}: {{ related.title }} + {% endif %} + {% if related.description %} + {% trans "Reminder Description" %}: {{ related.description }} + {% endif %} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/report_frequency.html b/hypha/apply/activity/templates/messages/email/report_frequency.html index 63633b9404..6d7f92bbd2 100644 --- a/hypha/apply/activity/templates/messages/email/report_frequency.html +++ b/hypha/apply/activity/templates/messages/email/report_frequency.html @@ -3,12 +3,12 @@ {% load i18n %} {% block content %} -{% blocktrans with title=source.title %}An {{ ORG_SHORT_NAME }} staff member has changed the reporting frequency of {{ title }}.{% endblocktrans %} + {% blocktrans with title=source.title %}An {{ ORG_SHORT_NAME }} staff member has changed the reporting frequency of {{ title }}.{% endblocktrans %} -{% trans "The new schedule is" %}: {{ config.get_frequency_display }} + {% trans "The new schedule is" %}: {{ config.get_frequency_display }} -{% trans "The next report is due" %}: {{ config.current_due_report.end_date }} + {% trans "The next report is due" %}: {{ config.current_due_report.end_date }} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/report_notify.html b/hypha/apply/activity/templates/messages/email/report_notify.html index 0bb6cfb002..5cf3ca270b 100644 --- a/hypha/apply/activity/templates/messages/email/report_notify.html +++ b/hypha/apply/activity/templates/messages/email/report_notify.html @@ -3,9 +3,9 @@ {% load i18n %} {% block content %} -{% blocktrans with title=source.title end_date=report.end_date %}A report is due for {{ title }} on {{ end_date }}.{% endblocktrans %} + {% blocktrans with title=source.title end_date=report.end_date %}A report is due for {{ title }} on {{ end_date }}.{% endblocktrans %} -{% blocktrans %}More information can be found on the project page:{% endblocktrans %} -{{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% blocktrans %}More information can be found on the project page:{% endblocktrans %} + {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/report_skipped.html b/hypha/apply/activity/templates/messages/email/report_skipped.html index 0b86d85748..7419063f1b 100644 --- a/hypha/apply/activity/templates/messages/email/report_skipped.html +++ b/hypha/apply/activity/templates/messages/email/report_skipped.html @@ -3,12 +3,12 @@ {% load i18n %} {% block content %} -{% blocktrans %}An {{ ORG_SHORT_NAME }} staff member has marked a report as {% endblocktrans %}{% if report.skipped %}{% trans "no longer required" %}{% else %}{% trans "required" %}{% endif %}{% blocktrans with title=source.title start_date=report.start_date end_date=report.end_date %} for {{ title }} for period {{ start_date }} to {{ end_date }}.{% endblocktrans %} + {% blocktrans %}An {{ ORG_SHORT_NAME }} staff member has marked a report as {% endblocktrans %}{% if report.skipped %}{% trans "no longer required" %}{% else %}{% trans "required" %}{% endif %}{% blocktrans with title=source.title start_date=report.start_date end_date=report.end_date %} for {{ title }} for period {{ start_date }} to {{ end_date }}.{% endblocktrans %} -{% if not report.skipped %} -{% trans "This report was previously not required. Please ensure you now complete the report." %} -{% endif %} + {% if not report.skipped %} + {% trans "This report was previously not required. Please ensure you now complete the report." %} + {% endif %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/report_submitted.html b/hypha/apply/activity/templates/messages/email/report_submitted.html index d948fff052..c67a17bc74 100644 --- a/hypha/apply/activity/templates/messages/email/report_submitted.html +++ b/hypha/apply/activity/templates/messages/email/report_submitted.html @@ -2,10 +2,10 @@ {% load i18n %} {% block content %} -{% blocktrans with title=source.title start_date=report.start_date end_date=report.end_date %}An {{ ORG_SHORT_NAME }} staff member has submitted a report for {{ title }} for period {{ start_date }} to {{ end_date }}.{% endblocktrans %} + {% blocktrans with title=source.title start_date=report.start_date end_date=report.end_date %}An {{ ORG_SHORT_NAME }} staff member has submitted a report for {{ title }} for period {{ start_date }} to {{ end_date }}.{% endblocktrans %} -{% trans "You can review the report here" %}: {{ request.scheme }}://{{ request.get_host }}{{ report.get_absolute_url }} + {% trans "You can review the report here" %}: {{ request.scheme }}://{{ request.get_host }}{{ report.get_absolute_url }} -{% trans "Project" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Project" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/sent_to_compliance.html b/hypha/apply/activity/templates/messages/email/sent_to_compliance.html index 628b6a7e60..979e0d6945 100644 --- a/hypha/apply/activity/templates/messages/email/sent_to_compliance.html +++ b/hypha/apply/activity/templates/messages/email/sent_to_compliance.html @@ -4,11 +4,11 @@ {% block salutation %}{% endblock %} {% block content %} -{% trans "A Project is awaiting your review." %} + {% trans "A Project is awaiting your review." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} -{% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %} + {% trans "Original Submission" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:submissions:simplified' pk=source.submission.pk %} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/submission_confirmation.html b/hypha/apply/activity/templates/messages/email/submission_confirmation.html index 84c1eea07c..04d2a51030 100644 --- a/hypha/apply/activity/templates/messages/email/submission_confirmation.html +++ b/hypha/apply/activity/templates/messages/email/submission_confirmation.html @@ -3,16 +3,16 @@ {% load i18n %} {% block content %}{% blocktrans with title=source.title %}We appreciate your {{ title }} application submission to the {{ ORG_LONG_NAME }}.{% endblocktrans %} -{% if source.is_draft %}{% trans "Please note that it is not submitted for review because it's still in draft." %} {% trans "You can access the draft at" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}{% else %}{% trans "We will review and reply to your submission as quickly as possible." %}{% endif %} + {% if source.is_draft %}{% trans "Please note that it is not submitted for review because it's still in draft." %} {% trans "You can access the draft at" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}{% else %}{% trans "We will review and reply to your submission as quickly as possible." %}{% endif %} -{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications + {% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications -{% blocktrans %}If you have issues accessing the submission system or general inquiries, please email us at {{ ORG_EMAIL }}.{% endblocktrans %} + {% blocktrans %}If you have issues accessing the submission system or general inquiries, please email us at {{ ORG_EMAIL }}.{% endblocktrans %} -{% blocktrans %}For more information about our support options, review process, and selection criteria, please visit our website at {{ ORG_URL }}.{% endblocktrans %} + {% blocktrans %}For more information about our support options, review process, and selection criteria, please visit our website at {{ ORG_URL }}.{% endblocktrans %} -{% with email_context=source.page.specific %}{{ email_context.confirmation_text_extra }}{% endwith %} + {% with email_context=source.page.specific %}{{ email_context.confirmation_text_extra }}{% endwith %} -{% trans "Project name" %}: {{ source.title }} -{% trans "Contact name" %}: {{ source.user.get_full_name }} -{% trans "Contact email" %}: {{ source.user.email }}{% endblock %} + {% trans "Project name" %}: {{ source.title }} + {% trans "Contact name" %}: {{ source.user.get_full_name }} + {% trans "Contact email" %}: {{ source.user.email }}{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/submission_edit.html b/hypha/apply/activity/templates/messages/email/submission_edit.html index 3ffec01938..a5148a24a5 100644 --- a/hypha/apply/activity/templates/messages/email/submission_edit.html +++ b/hypha/apply/activity/templates/messages/email/submission_edit.html @@ -2,5 +2,5 @@ {% load i18n %} {% block content %} -{% trans "Your submission has been edited by a member of staff." %} + {% trans "Your submission has been edited by a member of staff." %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/submit_contract_documents.html b/hypha/apply/activity/templates/messages/email/submit_contract_documents.html index 1d2840ebff..83d6401da5 100644 --- a/hypha/apply/activity/templates/messages/email/submit_contract_documents.html +++ b/hypha/apply/activity/templates/messages/email/submit_contract_documents.html @@ -6,10 +6,10 @@ {% endblock %} {% block content %} -{% trans "A Project's contract is awaiting your review." %} + {% trans "A Project's contract is awaiting your review." %} -{% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Title" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} + {% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/transition.html b/hypha/apply/activity/templates/messages/email/transition.html index 4188597a68..ebb78fb817 100644 --- a/hypha/apply/activity/templates/messages/email/transition.html +++ b/hypha/apply/activity/templates/messages/email/transition.html @@ -3,4 +3,4 @@ {% load i18n %} {% block content %}{% blocktrans with old_status=old_phase.public_name new_status=source.phase.public_name %}Your application is now in "{{ new_status }}" status (progressed from "{{ old_status }}").{% endblocktrans %} -{% trans "Please submit any questions related to your application here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications{% endblock %} + {% trans "Please submit any questions related to your application here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications{% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/vendor_setup_needed.html b/hypha/apply/activity/templates/messages/email/vendor_setup_needed.html index 53d1339fdb..15e6267b8a 100644 --- a/hypha/apply/activity/templates/messages/email/vendor_setup_needed.html +++ b/hypha/apply/activity/templates/messages/email/vendor_setup_needed.html @@ -2,11 +2,11 @@ {% load i18n %} {% block content %} -{% blocktrans %}A Project has been created for your submission on {{ ORG_SHORT_NAME }}.{% endblocktrans %} + {% blocktrans %}A Project has been created for your submission on {{ ORG_SHORT_NAME }}.{% endblocktrans %} -{% trans "Next step is to complete Contracting Information by visiting project detail page." %} + {% trans "Next step is to complete Contracting Information by visiting project detail page." %} -{% trans "Project" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} -{% trans "Submission" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.submission.get_absolute_url }} + {% trans "Project" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Submission" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.submission.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/email/vendor_updated.html b/hypha/apply/activity/templates/messages/email/vendor_updated.html index 818cb1afb2..a585c5a53f 100644 --- a/hypha/apply/activity/templates/messages/email/vendor_updated.html +++ b/hypha/apply/activity/templates/messages/email/vendor_updated.html @@ -2,8 +2,8 @@ {% load i18n %} {% block content %} -{% blocktrans with title=source.title %}Contracting Information has been updated on {{ title }}.{% endblocktrans %} + {% blocktrans with title=source.title %}Contracting Information has been updated on {{ title }}.{% endblocktrans %} -{% trans "Project" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} + {% trans "Project" %}: {{ source.title }} + {% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %} diff --git a/hypha/apply/activity/templates/messages/slack_message.html b/hypha/apply/activity/templates/messages/slack_message.html index 1974748d10..61cc29ce67 100644 --- a/hypha/apply/activity/templates/messages/slack_message.html +++ b/hypha/apply/activity/templates/messages/slack_message.html @@ -2,5 +2,5 @@ {% block text %} -{{ message|safe }} + {{ message|safe }} {% endblock %} diff --git a/hypha/apply/activity/templatetags/activity_tags.py b/hypha/apply/activity/templatetags/activity_tags.py index 1aa8d779dd..d514d3c44c 100644 --- a/hypha/apply/activity/templatetags/activity_tags.py +++ b/hypha/apply/activity/templatetags/activity_tags.py @@ -14,10 +14,14 @@ @register.filter def display_author(activity, user): - if user.is_applicant and (activity.user.is_apply_staff or activity.user.is_finance or activity.user.is_contracting): + if user.is_applicant and ( + activity.user.is_apply_staff + or activity.user.is_finance + or activity.user.is_contracting + ): return settings.ORG_LONG_NAME if isinstance(activity.related_object, Review) and activity.source.user == user: - return 'Reviewer' + return "Reviewer" return activity.user.get_full_name_with_group() diff --git a/hypha/apply/activity/tests/factories.py b/hypha/apply/activity/tests/factories.py index 34bbce84be..6f98839cee 100644 --- a/hypha/apply/activity/tests/factories.py +++ b/hypha/apply/activity/tests/factories.py @@ -25,7 +25,7 @@ class Params: source = factory.SubFactory(ApplicationSubmissionFactory) user = factory.SubFactory(UserFactory) - message = factory.Faker('sentence') + message = factory.Faker("sentence") timestamp = factory.LazyFunction(timezone.now) @@ -48,8 +48,8 @@ class MessageFactory(factory.django.DjangoModelFactory): class Meta: model = Message - type = 'Email' - content = factory.Faker('sentence') - recipient = factory.Faker('email') + type = "Email" + content = factory.Faker("sentence") + recipient = factory.Faker("email") event = factory.SubFactory(EventFactory) - external_id = factory.LazyFunction(lambda: '<{}>'.format(uuid.uuid4())) + external_id = factory.LazyFunction(lambda: "<{}>".format(uuid.uuid4())) diff --git a/hypha/apply/activity/tests/test_messaging.py b/hypha/apply/activity/tests/test_messaging.py index 35dfd159db..79ef43c635 100644 --- a/hypha/apply/activity/tests/test_messaging.py +++ b/hypha/apply/activity/tests/test_messaging.py @@ -34,11 +34,9 @@ class TestAdapter(AdapterBase): """A test class which will pass the message type to send_message""" - adapter_type = 'Test Adapter' - messages = { - enum: enum.value - for enum in MESSAGES.__members__.values() - } + + adapter_type = "Test Adapter" + messages = {enum: enum.value for enum in MESSAGES.__members__.values()} def send_message(self, message, **kwargs): pass @@ -50,22 +48,22 @@ def log_message(self, message, recipient, event, status): pass -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class AdapterMixin(TestCase): adapter = None source_factory = None def process_kwargs(self, message_type, **kwargs): - if 'user' not in kwargs: - kwargs['user'] = UserFactory() - if 'source' not in kwargs: - kwargs['source'] = self.source_factory() - if 'request' not in kwargs: - kwargs['request'] = make_request() + if "user" not in kwargs: + kwargs["user"] = UserFactory() + if "source" not in kwargs: + kwargs["source"] = self.source_factory() + if "request" not in kwargs: + kwargs["request"] = make_request() if message_type in neat_related: - kwargs['related'] = kwargs.get('related', 'a thing') + kwargs["related"] = kwargs.get("related", "a thing") else: - kwargs['related'] = None + kwargs["related"] = None return kwargs @@ -73,7 +71,7 @@ def adapter_process(self, message_type, adapter=None, **kwargs): if not adapter: adapter = self.adapter kwargs = self.process_kwargs(message_type, **kwargs) - event = EventFactory(source=kwargs['source']) + event = EventFactory(source=kwargs["source"]) adapter.process(message_type, event=event, **kwargs) @@ -82,10 +80,10 @@ class TestBaseAdapter(AdapterMixin, TestCase): source_factory = ApplicationSubmissionFactory def setUp(self): - patched_class = patch.object(TestAdapter, 'send_message') + patched_class = patch.object(TestAdapter, "send_message") self.mock_adapter = patched_class.start() self.adapter = TestAdapter() - self.adapter.send_message.return_value = 'dummy_message' + self.adapter.send_message.return_value = "dummy_message" self.addCleanup(patched_class.stop) def test_can_send_a_message(self): @@ -96,13 +94,13 @@ def test_can_send_a_message(self): self.assertEqual(self.adapter.send_message.call_args[0], (message_type.value,)) def test_doesnt_send_a_message_if_not_configured(self): - self.adapter_process('this_is_not_a_message_type') + self.adapter_process("this_is_not_a_message_type") self.adapter.send_message.assert_not_called() def test_calls_method_if_avaliable(self): - method_name = 'new_method' - return_message = 'Returned message' + method_name = "new_method" + return_message = "Returned message" setattr(self.adapter, method_name, lambda **kw: return_message) self.adapter.messages[method_name] = method_name @@ -113,7 +111,7 @@ def test_calls_method_if_avaliable(self): def test_that_kwargs_passed_to_send_message(self): message_type = MESSAGES.UPDATE_LEAD - kwargs = {'test': 'that', 'these': 'exist'} + kwargs = {"test": "that", "these": "exist"} self.adapter_process(message_type, **kwargs) self.adapter.send_message.assert_called_once() @@ -122,9 +120,9 @@ def test_that_kwargs_passed_to_send_message(self): def test_that_message_is_formatted(self): message_type = MESSAGES.UPDATE_LEAD - message = 'message value' + message = "message value" - with patch.dict(self.adapter.messages, {message_type: '{message_to_format}'}): + with patch.dict(self.adapter.messages, {message_type: "{message_to_format}"}): self.adapter_process(message_type, message_to_format=message) self.adapter.send_message.assert_called_once() @@ -133,12 +131,14 @@ def test_that_message_is_formatted(self): def test_can_include_extra_kwargs(self): message_type = MESSAGES.UPDATE_LEAD - with patch.dict(self.adapter.messages, {message_type: '{extra}'}): - with patch.object(self.adapter, 'extra_kwargs', return_value={'extra': 'extra'}): + with patch.dict(self.adapter.messages, {message_type: "{extra}"}): + with patch.object( + self.adapter, "extra_kwargs", return_value={"extra": "extra"} + ): self.adapter_process(message_type) self.adapter.send_message.assert_called_once() - self.assertTrue('extra' in self.adapter.send_message.call_args[1]) + self.assertTrue("extra" in self.adapter.send_message.call_args[1]) @override_settings(SEND_MESSAGES=False) def test_django_messages_used(self): @@ -158,10 +158,10 @@ def setUp(self): self.mocked_adapter = Mock(AdapterBase) self.backend = MessengerBackend self.kwargs = { - 'related': None, - 'request': None, - 'user': UserFactory(), - 'source': self.source_factory(), + "related": None, + "request": None, + "user": UserFactory(), + "source": self.source_factory(), } def test_message_sent_to_adapter(self): @@ -170,7 +170,9 @@ def test_message_sent_to_adapter(self): messenger(MESSAGES.UPDATE_LEAD, **self.kwargs) - adapter.process.assert_called_once_with(MESSAGES.UPDATE_LEAD, Event.objects.first(), **self.kwargs) + adapter.process.assert_called_once_with( + MESSAGES.UPDATE_LEAD, Event.objects.first(), **self.kwargs + ) def test_message_sent_to_all_adapter(self): adapters = [self.mocked_adapter(), self.mocked_adapter()] @@ -191,7 +193,9 @@ def test_event_created(self): self.assertEqual(Event.objects.count(), 1) self.assertEqual(Event.objects.first().type, MESSAGES.UPDATE_LEAD.name) - self.assertEqual(Event.objects.first().get_type_display(), MESSAGES.UPDATE_LEAD.label) + self.assertEqual( + Event.objects.first().get_type_display(), MESSAGES.UPDATE_LEAD.label + ) self.assertEqual(Event.objects.first().by, user) @@ -205,11 +209,13 @@ def setUp(self): self.adapter = ActivityAdapter() def test_activity_created(self): - message = 'test message' + message = "test message" user = UserFactory() submission = ApplicationSubmissionFactory() - self.adapter.send_message(message, user=user, source=submission, sources=[], related=None) + self.adapter.send_message( + message, user=user, source=submission, sources=[], related=None + ) self.assertEqual(Activity.objects.count(), 1) activity = Activity.objects.first() @@ -222,24 +228,24 @@ def test_reviewers_message_no_removed(self): message = self.adapter.reviewers_updated([assigned_reviewer], []) - self.assertTrue('Added' in message) - self.assertFalse('Removed' in message) + self.assertTrue("Added" in message) + self.assertFalse("Removed" in message) self.assertTrue(str(assigned_reviewer.reviewer) in message) def test_reviewers_message_no_added(self): assigned_reviewer = AssignedReviewersFactory() message = self.adapter.reviewers_updated([], [assigned_reviewer]) - self.assertFalse('Added' in message) - self.assertTrue('Removed' in message) + self.assertFalse("Added" in message) + self.assertTrue("Removed" in message) self.assertTrue(str(assigned_reviewer.reviewer) in message) def test_reviewers_message_both(self): added, removed = AssignedReviewersFactory.create_batch(2) message = self.adapter.reviewers_updated([added], [removed]) - self.assertTrue('Added' in message) - self.assertTrue('Removed' in message) + self.assertTrue("Added" in message) + self.assertTrue("Removed" in message) self.assertTrue(str(added.reviewer) in message) self.assertTrue(str(removed.reviewer) in message) @@ -258,19 +264,23 @@ def test_reviewers_with_and_without_role(self): self.assertTrue(str(without_role.reviewer) in message) def test_internal_transition_kwarg_for_invisible_transition(self): - submission = ApplicationSubmissionFactory(status='post_review_discussion') - kwargs = self.adapter.extra_kwargs(MESSAGES.TRANSITION, source=submission, sources=None) + submission = ApplicationSubmissionFactory(status="post_review_discussion") + kwargs = self.adapter.extra_kwargs( + MESSAGES.TRANSITION, source=submission, sources=None + ) - self.assertEqual(kwargs['visibility'], TEAM) + self.assertEqual(kwargs["visibility"], TEAM) def test_public_transition_kwargs(self): submission = ApplicationSubmissionFactory() - kwargs = self.adapter.extra_kwargs(MESSAGES.TRANSITION, source=submission, sources=None) + kwargs = self.adapter.extra_kwargs( + MESSAGES.TRANSITION, source=submission, sources=None + ) - self.assertNotIn('visibility', kwargs) + self.assertNotIn("visibility", kwargs) def test_handle_transition_public_to_public(self): - submission = ApplicationSubmissionFactory(status='more_info') + submission = ApplicationSubmissionFactory(status="more_info") old_phase = submission.workflow.phases_for()[0] message = self.adapter.handle_transition(old_phase, submission) @@ -282,7 +292,7 @@ def test_handle_transition_public_to_public(self): self.assertIn(old_phase.public_name, message[ALL]) def test_handle_transition_to_private_to_public(self): - submission = ApplicationSubmissionFactory(status='more_info') + submission = ApplicationSubmissionFactory(status="more_info") old_phase = submission.workflow.phases_for()[1] message = self.adapter.handle_transition(old_phase, submission) @@ -294,7 +304,7 @@ def test_handle_transition_to_private_to_public(self): self.assertIn(old_phase.public_name, message[ALL]) def test_handle_transition_to_public_to_private(self): - submission = ApplicationSubmissionFactory(status='internal_review') + submission = ApplicationSubmissionFactory(status="internal_review") old_phase = submission.workflow.phases_for()[0] message = self.adapter.handle_transition(old_phase, submission) @@ -305,14 +315,16 @@ def test_handle_transition_to_public_to_private(self): def test_lead_saved_on_activity(self): submission = ApplicationSubmissionFactory() user = UserFactory() - self.adapter.send_message('a message', user=user, source=submission, sources=[], related=user) + self.adapter.send_message( + "a message", user=user, source=submission, sources=[], related=user + ) activity = Activity.objects.first() self.assertEqual(activity.related_object, user) def test_review_saved_on_activity(self): review = ReviewFactory() self.adapter.send_message( - 'a message', + "a message", user=review.author.reviewer, source=review.submission, sources=[], @@ -325,10 +337,10 @@ def test_review_saved_on_activity(self): class TestSlackAdapter(AdapterMixin, TestCase): source_factory = ApplicationSubmissionFactory - backend = 'django_slack.backends.TestBackend' - target_url = 'https://my-slack-backend.com/incoming/my-very-secret-key' - target_room = '#' - token = 'fake-token' + backend = "django_slack.backends.TestBackend" + target_url = "https://my-slack-backend.com/incoming/my-very-secret-key" + target_room = "#" + token = "fake-token" @override_settings( SLACK_ENDPOINT_URL=target_url, @@ -340,7 +352,7 @@ def test_cant_send_with_no_room(self): error_message = "Missing configuration: Room ID" adapter = SlackAdapter() submission = ApplicationSubmissionFactory() - messages = adapter.send_message('my message', '', source=submission) + messages = adapter.send_message("my message", "", source=submission) self.assertEqual(messages, error_message) @override_settings( @@ -353,7 +365,7 @@ def test_cant_send_with_no_token(self): error_message = "Missing configuration: Slack Token" adapter = SlackAdapter() submission = ApplicationSubmissionFactory() - messages = adapter.send_message('my message', '', source=submission) + messages = adapter.send_message("my message", "", source=submission) self.assertEqual(messages, error_message) @override_settings( @@ -367,12 +379,12 @@ def test_correct_payload(self): backend.reset_messages() submission = ApplicationSubmissionFactory() adapter = SlackAdapter() - message = 'my message' - adapter.send_message(message, '', source=submission) + message = "my message" + adapter.send_message(message, "", source=submission) messages = backend.retrieve_messages() self.assertEqual(len(messages), 1) - message_payload = json.loads(messages[0]['payload']) - self.assertEqual(message_payload['text'], message) + message_payload = json.loads(messages[0]["payload"]) + self.assertEqual(message_payload["text"], message) @override_settings( SLACK_ENDPOINT_URL=target_url, @@ -383,16 +395,16 @@ def test_correct_payload(self): def test_fund_custom_slack_channel(self): backend = get_backend() backend.reset_messages() - responses.add(responses.POST, self.target_url, status=200, body='OK') - submission = ApplicationSubmissionFactory(round__parent__slack_channel='dummy') + responses.add(responses.POST, self.target_url, status=200, body="OK") + submission = ApplicationSubmissionFactory(round__parent__slack_channel="dummy") adapter = SlackAdapter() - message = 'my message' - adapter.send_message(message, '', source=submission) + message = "my message" + adapter.send_message(message, "", source=submission) messages = backend.retrieve_messages() self.assertEqual(len(messages), 1) - message_payload = json.loads(messages[0]['payload']) - self.assertEqual(message_payload['text'], message) - self.assertEqual(message_payload['channel'], '#dummy') + message_payload = json.loads(messages[0]["payload"]) + self.assertEqual(message_payload["text"], message) + self.assertEqual(message_payload["channel"], "#dummy") @override_settings( SLACK_ENDPOINT_URL=target_url, @@ -403,27 +415,33 @@ def test_fund_custom_slack_channel(self): def test_fund_multiple_custom_slack_channel(self): backend = get_backend() backend.reset_messages() - submission = ApplicationSubmissionFactory(round__parent__slack_channel='dummy1, dummy2') + submission = ApplicationSubmissionFactory( + round__parent__slack_channel="dummy1, dummy2" + ) adapter = SlackAdapter() - message = 'my message' - adapter.send_message(message, '', source=submission) + message = "my message" + adapter.send_message(message, "", source=submission) messages = backend.retrieve_messages() self.assertEqual(len(messages), 2) for index, sent_message in enumerate(messages): - message_payload = json.loads(sent_message['payload']) - self.assertEqual(message_payload['text'], message) - self.assertEqual(message_payload['channel'], '#dummy' + str(index + 1)) + message_payload = json.loads(sent_message["payload"]) + self.assertEqual(message_payload["text"], message) + self.assertEqual(message_payload["channel"], "#dummy" + str(index + 1)) def test_gets_lead_if_slack_set(self): adapter = SlackAdapter() submission = ApplicationSubmissionFactory() - recipients = adapter.recipients(MESSAGES.COMMENT, source=submission, related=None) + recipients = adapter.recipients( + MESSAGES.COMMENT, source=submission, related=None + ) self.assertTrue(submission.lead.slack in recipients[0]) def test_gets_blank_if_slack_not_set(self): adapter = SlackAdapter() - submission = ApplicationSubmissionFactory(lead__slack='') - recipients = adapter.recipients(MESSAGES.COMMENT, source=submission, related=None) + submission = ApplicationSubmissionFactory(lead__slack="") + recipients = adapter.recipients( + MESSAGES.COMMENT, source=submission, related=None + ) self.assertTrue(submission.lead.slack in recipients[0]) @override_settings( @@ -437,8 +455,11 @@ def test_message_with_good_response(self): self.adapter_process(MESSAGES.NEW_SUBMISSION) self.assertEqual(Message.objects.count(), 1) sent_message = Message.objects.first() - self.assertEqual(sent_message.content[0:10], self.adapter.messages[MESSAGES.NEW_SUBMISSION][0:10]) - self.assertEqual(sent_message.status, '200: OK') + self.assertEqual( + sent_message.content[0:10], + self.adapter.messages[MESSAGES.NEW_SUBMISSION][0:10], + ) + self.assertEqual(sent_message.status, "200: OK") @override_settings( SLACK_ENDPOINT_URL=target_url, @@ -451,11 +472,11 @@ def test_400_bad_request(self): backend.reset_messages() submission = ApplicationSubmissionFactory() adapter = SlackAdapter() - message = '' - message_status = adapter.send_message(message, '', source=submission) + message = "" + message_status = adapter.send_message(message, "", source=submission) messages = backend.retrieve_messages() self.assertEqual(len(messages), 0) - self.assertEqual(message_status, '400: Bad Request') + self.assertEqual(message_status, "400: Bad Request") @override_settings(SEND_MESSAGES=True) @@ -480,58 +501,67 @@ def test_no_email_own_comment(self): application = ApplicationSubmissionFactory() comment = CommentFactory(user=application.user, source=application) - self.adapter_process(MESSAGES.COMMENT, related=comment, user=comment.user, source=comment.source) + self.adapter_process( + MESSAGES.COMMENT, related=comment, user=comment.user, source=comment.source + ) self.assertEqual(len(mail.outbox), 0) def test_reviewers_email(self): reviewers = ReviewerFactory.create_batch(4) - submission = ApplicationSubmissionFactory(status='external_review', reviewers=reviewers, workflow_stages=2) + submission = ApplicationSubmissionFactory( + status="external_review", reviewers=reviewers, workflow_stages=2 + ) self.adapter_process(MESSAGES.READY_FOR_REVIEW, source=submission) self.assertEqual(len(mail.outbox), 4) - self.assertTrue(mail.outbox[0].subject, 'ready to review') + self.assertTrue(mail.outbox[0].subject, "ready to review") def test_reviewer_update_email(self): reviewers = ReviewerFactory.create_batch(4) - submission = ApplicationSubmissionFactory(status='external_review', reviewers=reviewers, workflow_stages=2) + submission = ApplicationSubmissionFactory( + status="external_review", reviewers=reviewers, workflow_stages=2 + ) added = [AssignedReviewersFactory(submission=submission, reviewer=reviewers[0])] self.adapter_process(MESSAGES.REVIEWERS_UPDATED, source=submission, added=added) self.assertEqual(len(mail.outbox), 1) - self.assertTrue(mail.outbox[0].subject, 'ready to review') + self.assertTrue(mail.outbox[0].subject, "ready to review") def test_email_sent(self): self.adapter_process(MESSAGES.NEW_SUBMISSION) self.assertEqual(Message.objects.count(), 1) sent_message = Message.objects.first() - self.assertEqual(sent_message.status, 'sent') + self.assertEqual(sent_message.status, "sent") def test_email_failed(self): - with patch('django.core.mail.backends.locmem.EmailBackend.send_messages', side_effect=Exception('An error occurred')): + with patch( + "django.core.mail.backends.locmem.EmailBackend.send_messages", + side_effect=Exception("An error occurred"), + ): self.adapter_process(MESSAGES.NEW_SUBMISSION) self.assertEqual(Message.objects.count(), 1) sent_message = Message.objects.first() - self.assertEqual(sent_message.status, 'Error: An error occurred') + self.assertEqual(sent_message.status, "Error: An error occurred") @override_settings( SEND_MESSAGES=True, - EMAIL_BACKEND='anymail.backends.test.EmailBackend', + EMAIL_BACKEND="anymail.backends.test.EmailBackend", ) class TestAnyMailBehaviour(AdapterMixin, TestCase): adapter = EmailAdapter() - TEST_API_KEY = 'TEST_API_KEY' + TEST_API_KEY = "TEST_API_KEY" # from: https://github.com/anymail/django-anymail/blob/7d8dbdace92d8addfcf0a517be0aaf481da11952/tests/test_mailgun_webhooks.py#L19 def mailgun_sign(self, data, api_key=TEST_API_KEY): """Add a Mailgun webhook signature to data dict""" # Modifies the dict in place - data.setdefault('timestamp', '1234567890') - data.setdefault('token', '1234567890abcdef1234567890abcdef') - data['signature'] = hmac.new( - key=api_key.encode('ascii'), - msg='{timestamp}{token}'.format(**data).encode('ascii'), + data.setdefault("timestamp", "1234567890") + data.setdefault("token", "1234567890abcdef1234567890abcdef") + data["signature"] = hmac.new( + key=api_key.encode("ascii"), + msg="{timestamp}{token}".format(**data).encode("ascii"), digestmod=hashlib.sha256, ).hexdigest() @@ -544,45 +574,46 @@ def test_email_new_submission(self): self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].to, [submission.user.email]) message = Message.objects.first() - self.assertEqual(message.status, 'sent') + self.assertEqual(message.status, "sent") # Anymail test Backend uses the index of the email as id: '0' - self.assertEqual(message.external_id, '0') + self.assertEqual(message.external_id, "0") @override_settings(ANYMAIL_MAILGUN_API_KEY=TEST_API_KEY) def test_webhook_updates_status(self): message = MessageFactory() response = self.client.post( - '/activity/anymail/mailgun/tracking/', - data=self.mailgun_sign({ - 'event': 'delivered', - 'Message-Id': message.external_id - }), + "/activity/anymail/mailgun/tracking/", + data=self.mailgun_sign( + {"event": "delivered", "Message-Id": message.external_id} + ), secure=True, json=True, ) self.assertEqual(response.status_code, 200) message.refresh_from_db() - self.assertTrue('delivered' in message.status) + self.assertTrue("delivered" in message.status) @override_settings(ANYMAIL_MAILGUN_API_KEY=TEST_API_KEY) def test_webhook_adds_reject_reason(self): message = MessageFactory() response = self.client.post( - '/activity/anymail/mailgun/tracking/', - data=self.mailgun_sign({ - 'event': 'dropped', - 'reason': 'hardfail', - 'code': 607, - 'description': 'Marked as spam', - 'Message-Id': message.external_id - }), + "/activity/anymail/mailgun/tracking/", + data=self.mailgun_sign( + { + "event": "dropped", + "reason": "hardfail", + "code": 607, + "description": "Marked as spam", + "Message-Id": message.external_id, + } + ), secure=True, json=True, ) self.assertEqual(response.status_code, 200) message.refresh_from_db() - self.assertTrue('rejected' in message.status) - self.assertTrue('spam' in message.status) + self.assertTrue("rejected" in message.status) + self.assertTrue("spam" in message.status) class TestAdaptersForProject(AdapterMixin, TestCase): @@ -590,10 +621,10 @@ class TestAdaptersForProject(AdapterMixin, TestCase): activity = ActivityAdapter source_factory = ProjectFactory # Slack - backend = 'django_slack.backends.TestBackend' - target_url = 'https://my-slack-backend.com/incoming/my-very-secret-key' - target_room = '#' - token = 'fake-token' + backend = "django_slack.backends.TestBackend" + target_url = "https://my-slack-backend.com/incoming/my-very-secret-key" + target_room = "#" + token = "fake-token" def test_activity_lead_change(self): old_lead = UserFactory() @@ -615,11 +646,11 @@ def test_activity_lead_change_from_none(self): MESSAGES.UPDATE_PROJECT_LEAD, adapter=self.activity(), source=project, - related='Unassigned', + related="Unassigned", ) self.assertEqual(Activity.objects.count(), 1) activity = Activity.objects.first() - self.assertIn(str('Unassigned'), activity.message) + self.assertIn(str("Unassigned"), activity.message) self.assertIn(str(project.lead), activity.message) def test_activity_created(self): @@ -654,9 +685,9 @@ def test_slack_created(self): ) messages = backend.retrieve_messages() self.assertEqual(len(messages), 1) - message_payload = json.loads(messages[0]['payload']) - self.assertIn(str(user), message_payload['text']) - self.assertIn(str(project), message_payload['text']) + message_payload = json.loads(messages[0]["payload"]) + self.assertIn(str(user), message_payload["text"]) + self.assertIn(str(project), message_payload["text"]) @override_settings( SLACK_ENDPOINT_URL=target_url, @@ -678,9 +709,9 @@ def test_slack_lead_change(self): ) messages = backend.retrieve_messages() self.assertEqual(len(messages), 1) - message_payload = json.loads(messages[0]['payload']) - self.assertIn(str(user), message_payload['text']) - self.assertIn(str(project), message_payload['text']) + message_payload = json.loads(messages[0]["payload"]) + self.assertIn(str(user), message_payload["text"]) + self.assertIn(str(project), message_payload["text"]) @override_settings( SLACK_ENDPOINT_URL=target_url, @@ -705,9 +736,9 @@ def test_slack_applicant_update_invoice(self): messages = backend.retrieve_messages() self.assertEqual(len(messages), 1) - message_payload = json.loads(messages[0]['payload']) - self.assertIn(str(applicant), message_payload['text']) - self.assertIn(str(project), message_payload['text']) + message_payload = json.loads(messages[0]["payload"]) + self.assertIn(str(applicant), message_payload["text"]) + self.assertIn(str(project), message_payload["text"]) @override_settings( SLACK_ENDPOINT_URL=target_url, diff --git a/hypha/apply/activity/tests/test_tasks.py b/hypha/apply/activity/tests/test_tasks.py index 1be7c93335..ece65d0a8e 100644 --- a/hypha/apply/activity/tests/test_tasks.py +++ b/hypha/apply/activity/tests/test_tasks.py @@ -7,19 +7,19 @@ class TestSendEmail(TestCase): - @patch('hypha.apply.activity.tasks.EmailMessage', autospec=True) + @patch("hypha.apply.activity.tasks.EmailMessage", autospec=True) def test_args_passed_to_django(self, email_mock): kwargs = { - 'subject': 'subject', - 'body': 'body', - 'from_email': 'from_email', - 'to': 'to', + "subject": "subject", + "body": "body", + "from_email": "from_email", + "to": "to", } - with self.settings(EMAIL_SUBJECT_PREFIX=''): + with self.settings(EMAIL_SUBJECT_PREFIX=""): send_mail(*kwargs, logs=[MessageFactory()]) email_mock.assert_called_once_with(**kwargs) - with self.settings(EMAIL_SUBJECT_PREFIX='[PREFIX] '): + with self.settings(EMAIL_SUBJECT_PREFIX="[PREFIX] "): send_mail(*kwargs, logs=[MessageFactory()]) - kwargs['subject'] = '[PREFIX] subject' + kwargs["subject"] = "[PREFIX] subject" email_mock.assert_called_with(**kwargs) diff --git a/hypha/apply/activity/urls.py b/hypha/apply/activity/urls.py index 4ba4a55f80..eebe907ae0 100644 --- a/hypha/apply/activity/urls.py +++ b/hypha/apply/activity/urls.py @@ -2,10 +2,10 @@ from .views import NotificationsView -app_name = 'activity' +app_name = "activity" urlpatterns = [ - path('anymail/', include('anymail.urls')), - path('notifications/', NotificationsView.as_view(), name='notifications') + path("anymail/", include("anymail.urls")), + path("notifications/", NotificationsView.as_view(), name="notifications"), ] diff --git a/hypha/apply/activity/views.py b/hypha/apply/activity/views.py index caadfa4946..36b5d91e2d 100644 --- a/hypha/apply/activity/views.py +++ b/hypha/apply/activity/views.py @@ -13,23 +13,23 @@ class ActivityContextMixin: - """Mixin to add related 'comments' of the current view's 'self.object' - """ + """Mixin to add related 'comments' of the current view's 'self.object'""" + def get_context_data(self, **kwargs): extra = { # Do not prefetch on the related_object__author as the models # are not homogeneous and this will fail - 'comments': get_related_comments_for_user(self.object, self.request.user) + "comments": get_related_comments_for_user(self.object, self.request.user) } return super().get_context_data(**extra, **kwargs) class CommentFormView(DelegatedViewMixin, CreateView): form_class = CommentForm - context_name = 'comment_form' + context_name = "comment_form" def form_valid(self, form): - source = self.kwargs['object'] + source = self.kwargs["object"] form.instance.user = self.request.user form.instance.source = source form.instance.type = COMMENT @@ -45,28 +45,28 @@ def form_valid(self, form): return response def get_success_url(self): - return self.object.source.get_absolute_url() + '#communications' + return self.object.source.get_absolute_url() + "#communications" def get_form_kwargs(self): # We dont want to pass the submission as the instance kwargs = super().get_form_kwargs() - kwargs.pop('instance') + kwargs.pop("instance") return kwargs -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class NotificationsView(ListView): model = Activity - template_name = 'activity/notifications.html' + template_name = "activity/notifications.html" filterset_class = NotificationFilter def get_queryset(self): # List only last 30 days' activities queryset = Activity.objects.filter(current=True).latest() self.filterset = self.filterset_class(self.request.GET, queryset=queryset) - return self.filterset.qs.distinct().order_by('-timestamp') + return self.filterset.qs.distinct().order_by("-timestamp") def get_context_data(self, *, object_list=None, **kwargs): context = super(NotificationsView, self).get_context_data() - context['filter'] = self.filterset + context["filter"] = self.filterset return context diff --git a/hypha/apply/api/urls.py b/hypha/apply/api/urls.py index ef7da2aba4..56bb45ad61 100644 --- a/hypha/apply/api/urls.py +++ b/hypha/apply/api/urls.py @@ -5,16 +5,16 @@ from .v1 import urls as v1_urls -app_name = 'api' +app_name = "api" schema_url_patterns_v1 = [ - path('api/v1/', include(v1_urls)), + path("api/v1/", include(v1_urls)), ] schema_view_v1 = get_schema_view( openapi.Info( title="Hypha API", - default_version='v1', + default_version="v1", description="Hypha APIs specification", ), public=False, @@ -23,6 +23,10 @@ ) urlpatterns = [ - path('v1/', include(v1_urls)), - path('v1/doc/', schema_view_v1.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), + path("v1/", include(v1_urls)), + path( + "v1/doc/", + schema_view_v1.with_ui("swagger", cache_timeout=0), + name="schema-swagger-ui", + ), ] diff --git a/hypha/apply/api/v1/determination/permissions.py b/hypha/apply/api/v1/determination/permissions.py index 38e6c45b8b..78d4b00dd3 100644 --- a/hypha/apply/api/v1/determination/permissions.py +++ b/hypha/apply/api/v1/determination/permissions.py @@ -10,6 +10,7 @@ class HasDeterminationCreatePermission(permissions.BasePermission): """ Custom permission that user should have for creating determination. """ + def has_permission(self, request, view): try: submission = view.get_submission_object() @@ -22,6 +23,7 @@ class HasDeterminationDraftPermission(permissions.BasePermission): """ Custom permission that user should have for editing determination. """ + def has_object_permission(self, request, view, obj): submission = view.get_submission_object() return can_edit_determination(request.user, obj, submission) diff --git a/hypha/apply/api/v1/determination/serializers.py b/hypha/apply/api/v1/determination/serializers.py index 3989821a56..13f74c6d4f 100644 --- a/hypha/apply/api/v1/determination/serializers.py +++ b/hypha/apply/api/v1/determination/serializers.py @@ -6,30 +6,34 @@ class SubmissionDeterminationSerializer(serializers.ModelSerializer): class Meta: model = Determination - fields = ['id', 'is_draft', ] + fields = [ + "id", + "is_draft", + ] extra_kwargs = { - 'is_draft': {'required': False}, + "is_draft": {"required": False}, } def validate(self, data): validated_data = super().validate(data) - validated_data['form_data'] = dict(validated_data.items()) + validated_data["form_data"] = dict(validated_data.items()) return validated_data def update(self, instance, validated_data): instance = super().update(instance, validated_data) instance.send_notice = ( self.validated_data[instance.send_notice_field.id] - if instance.send_notice_field else True + if instance.send_notice_field + else True ) message = self.validated_data[instance.message_field.id] - instance.message = '' if message is None else message + instance.message = "" if message is None else message try: instance.outcome = int(self.validated_data[instance.determination_field.id]) # Need to catch KeyError as outcome field would not exist in case of edit. except KeyError: pass - instance.is_draft = self.validated_data.get('is_draft', False) - instance.form_data = self.validated_data['form_data'] + instance.is_draft = self.validated_data.get("is_draft", False) + instance.form_data = self.validated_data["form_data"] instance.save() return instance diff --git a/hypha/apply/api/v1/determination/utils.py b/hypha/apply/api/v1/determination/utils.py index d260a3ee7e..fdc0d6a89f 100644 --- a/hypha/apply/api/v1/determination/utils.py +++ b/hypha/apply/api/v1/determination/utils.py @@ -8,7 +8,7 @@ def get_fields_for_stage(submission): - forms = submission.get_from_parent('determination_forms').all() + forms = submission.get_from_parent("determination_forms").all() index = submission.workflow.stages.index(submission.stage) try: return forms[index].form.form_fields @@ -22,7 +22,7 @@ def outcome_choices_for_phase(submission, user): We need to filter out non-matching choices. i.e. a transition to In Review is not a determination, while Needs more info or Rejected are. """ - available_choices = [('', _('-- No determination selected -- '))] + available_choices = [("", _("-- No determination selected -- "))] choices = dict(DETERMINATION_CHOICES) for transition_name in determination_actions(user, submission): try: diff --git a/hypha/apply/api/v1/determination/views.py b/hypha/apply/api/v1/determination/views.py index d61cb9ab7b..d90653c812 100644 --- a/hypha/apply/api/v1/determination/views.py +++ b/hypha/apply/api/v1/determination/views.py @@ -34,24 +34,33 @@ class SubmissionDeterminationViewSet( - BaseStreamForm, - WagtailSerializer, - SubmissionNestedMixin, - viewsets.GenericViewSet + BaseStreamForm, WagtailSerializer, SubmissionNestedMixin, viewsets.GenericViewSet ): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) permission_classes_by_action = { - 'create': [permissions.IsAuthenticated, HasDeterminationCreatePermission, IsApplyStaffUser, ], - 'draft': [permissions.IsAuthenticated, HasDeterminationDraftPermission, IsApplyStaffUser, ], + "create": [ + permissions.IsAuthenticated, + HasDeterminationCreatePermission, + IsApplyStaffUser, + ], + "draft": [ + permissions.IsAuthenticated, + HasDeterminationDraftPermission, + IsApplyStaffUser, + ], } serializer_class = SubmissionDeterminationSerializer def get_permissions(self): try: # return permission_classes depending on `action` - return [permission() for permission in self.permission_classes_by_action[self.action]] + return [ + permission() + for permission in self.permission_classes_by_action[self.action] + ] except KeyError: # action is not set return default permission_classes return [permission() for permission in self.permission_classes] @@ -62,7 +71,7 @@ def get_defined_fields(self): These form fields will be used to get respective serializer fields. """ - if self.action in ['retrieve', 'update']: + if self.action in ["retrieve", "update"]: # For detail and edit api form fields used while submitting # determination should be used. determination = self.get_object() @@ -76,13 +85,13 @@ def get_serializer_class(self): if the request is to save as draft or the determination submitted is saved as draft. """ - if self.action == 'retrieve': + if self.action == "retrieve": determination = self.get_object() draft = determination.is_draft - elif self.action == 'draft': + elif self.action == "draft": draft = True else: - draft = self.request.data.get('is_draft', False) + draft = self.request.data.get("is_draft", False) return super().get_serializer_class(draft) def get_queryset(self): @@ -94,7 +103,7 @@ def get_object(self): Get the determination object by id. If not found raise 404. """ queryset = self.get_queryset() - obj = get_object_or_404(queryset, id=self.kwargs['pk']) + obj = get_object_or_404(queryset, id=self.kwargs["pk"]) self.check_object_permissions(self.request, obj) return obj @@ -109,8 +118,8 @@ def get_determination_data(self, determination): determination_data[field_block.id] = determination.outcome if isinstance(field_block.block, RichTextBlock): determination_data[field_block.id] = field_block.value.source - determination_data['id'] = determination.id - determination_data['is_draft'] = determination.is_draft + determination_data["id"] = determination.id + determination_data["is_draft"] = determination.is_draft return determination_data def retrieve(self, request, *args, **kwargs): @@ -118,9 +127,7 @@ def retrieve(self, request, *args, **kwargs): Get details of a determination on a submission """ determination = self.get_object() - ser = self.get_serializer( - self.get_determination_data(determination) - ) + ser = self.get_serializer(self.get_determination_data(determination)) return Response(ser.data) def get_form_fields(self): @@ -132,17 +139,19 @@ def get_form_fields(self): outcome_choices = outcome_choices_for_phase( submission, self.request.user ) - if self.action == 'update': + if self.action == "update": # Outcome can not be edited after being set once, so we do not # need to render this field. # form_fields.pop(field_block.id) - form_fields[field_block.id].widget = forms.TextInput(attrs={'readonly': 'readonly'}) + form_fields[field_block.id].widget = forms.TextInput( + attrs={"readonly": "readonly"} + ) else: # Outcome field choices need to be set according to the phase. form_fields[field_block.id].choices = outcome_choices return form_fields - @action(detail=False, methods=['get']) + @action(detail=False, methods=["get"]) def fields(self, request, *args, **kwargs): """ List details of all the form fields that were created by admin for adding determinations. @@ -156,13 +165,15 @@ def fields(self, request, *args, **kwargs): def get_draft_determination(self): submission = self.get_submission_object() try: - determination = Determination.objects.get(submission=submission, is_draft=True) + determination = Determination.objects.get( + submission=submission, is_draft=True + ) except Determination.DoesNotExist: return else: return determination - @action(detail=False, methods=['get']) + @action(detail=False, methods=["get"]) def draft(self, request, *args, **kwargs): """ Returns the draft determination submitted on a submission by current user. @@ -170,9 +181,7 @@ def draft(self, request, *args, **kwargs): determination = self.get_draft_determination() if not determination: return Response({}) - ser = self.get_serializer( - self.get_determination_data(determination) - ) + ser = self.get_serializer(self.get_determination_data(determination)) return Response(ser.data) def create(self, request, *args, **kwargs): @@ -193,9 +202,9 @@ def create(self, request, *args, **kwargs): ser = self.get_serializer(data=request.data) ser.is_valid(raise_exception=True) if has_final_determination(submission): - return ValidationError({ - 'detail': 'A final determination has already been submitted.' - }) + return ValidationError( + {"detail": "A final determination has already been submitted."} + ) determination = self.get_draft_determination() if determination is None: determination = Determination.objects.create( @@ -205,9 +214,7 @@ def create(self, request, *args, **kwargs): determination.save() ser.update(determination, ser.validated_data) if determination.is_draft: - ser = self.get_serializer( - self.get_determination_data(determination) - ) + ser = self.get_serializer(self.get_determination_data(determination)) return Response(ser.data, status=status.HTTP_201_CREATED) with transaction.atomic(): messenger( @@ -217,7 +224,7 @@ def create(self, request, *args, **kwargs): submission=submission, related=determination, ) - proposal_form = ser.validated_data.get('proposal_form') + proposal_form = ser.validated_data.get("proposal_form") transition = transition_from_outcome(int(determination.outcome), submission) if determination.outcome == NEEDS_MORE_INFO: @@ -247,9 +254,7 @@ def create(self, request, *args, **kwargs): source=submission, related=determination, ) - ser = self.get_serializer( - self.get_determination_data(determination) - ) + ser = self.get_serializer(self.get_determination_data(determination)) return Response(ser.data, status=status.HTTP_201_CREATED) def update(self, request, *args, **kwargs): @@ -268,7 +273,5 @@ def update(self, request, *args, **kwargs): source=determination.submission, related=determination, ) - ser = self.get_serializer( - self.get_determination_data(determination) - ) + ser = self.get_serializer(self.get_determination_data(determination)) return Response(ser.data) diff --git a/hypha/apply/api/v1/filters.py b/hypha/apply/api/v1/filters.py index 6b2b0e545e..cec4b38333 100644 --- a/hypha/apply/api/v1/filters.py +++ b/hypha/apply/api/v1/filters.py @@ -18,46 +18,62 @@ class SubmissionsFilter(filters.FilterSet): - round = filters.ModelMultipleChoiceFilter(field_name='round', queryset=get_used_rounds()) + round = filters.ModelMultipleChoiceFilter( + field_name="round", queryset=get_used_rounds() + ) status = filters.MultipleChoiceFilter(choices=PHASES) - active = filters.BooleanFilter(method='filter_active', label=_('Active')) - submit_date = filters.DateFromToRangeFilter(field_name='submit_time', label=_('Submit date')) + active = filters.BooleanFilter(method="filter_active", label=_("Active")) + submit_date = filters.DateFromToRangeFilter( + field_name="submit_time", label=_("Submit date") + ) fund = filters.ModelMultipleChoiceFilter( - field_name='page', label=_('fund'), - queryset=Page.objects.type(FundType) | Page.objects.type(LabType) + field_name="page", + label=_("fund"), + queryset=Page.objects.type(FundType) | Page.objects.type(LabType), ) screening_statuses = filters.ModelMultipleChoiceFilter( - field_name='screening_statuses', + field_name="screening_statuses", queryset=get_screening_statuses(), - null_label=_('No Screening') + null_label=_("No Screening"), ) reviewers = filters.ModelMultipleChoiceFilter( - field_name='reviewers', + field_name="reviewers", queryset=get_all_reviewers(), ) lead = filters.ModelMultipleChoiceFilter( - field_name='lead', + field_name="lead", queryset=get_round_leads(), ) category_options = filters.MultipleChoiceFilter( - choices=[], label=_('Category'), - method='filter_category_options' + choices=[], label=_("Category"), method="filter_category_options" ) id = filters.ModelMultipleChoiceFilter( - field_name='id', - queryset=ApplicationSubmission.objects.exclude_draft().current().with_latest_update(), - method='filter_id' + field_name="id", + queryset=ApplicationSubmission.objects.exclude_draft() + .current() + .with_latest_update(), + method="filter_id", ) class Meta: model = ApplicationSubmission - fields = ('id', 'status', 'round', 'active', 'submit_date', 'fund', 'screening_statuses', 'reviewers', 'lead') + fields = ( + "id", + "status", + "round", + "active", + "submit_date", + "fund", + "screening_statuses", + "reviewers", + "lead", + ) def __init__(self, *args, exclude=None, limit_statuses=None, **kwargs): if exclude is None: exclude = [] super().__init__(*args, **kwargs) - self.filters['category_options'].extra['choices'] = [ + self.filters["category_options"].extra["choices"] = [ (option.id, option.value) for option in Option.objects.filter(category__filter_on_dashboard=True) ] @@ -80,12 +96,14 @@ def filter_category_options(self, queryset, name, value): And then use those category fields to filter submissions with their form_data. """ query = Q() - submission_data = queryset.values('form_fields', 'form_data').distinct() + submission_data = queryset.values("form_fields", "form_data").distinct() for submission in submission_data: - for field in submission['form_fields']: + for field in submission["form_fields"]: if isinstance(field.block, CategoryQuestionBlock): try: - category_options = category_ids = submission['form_data'][field.id] + category_options = category_ids = submission["form_data"][ + field.id + ] except KeyError: include_in_filter = False else: @@ -96,7 +114,7 @@ def filter_category_options(self, queryset, name, value): # If yes then those submissions should be filtered in the list if include_in_filter: kwargs = { - '{0}__{1}'.format('form_data', field.id): category_ids + "{0}__{1}".format("form_data", field.id): category_ids } query |= Q(**kwargs) return queryset.filter(query) @@ -116,15 +134,15 @@ def filter(self, qs, value): class CommentFilter(filters.FilterSet): - since = filters.DateTimeFilter(field_name="timestamp", lookup_expr='gte') - before = filters.DateTimeFilter(field_name="timestamp", lookup_expr='lte') + since = filters.DateTimeFilter(field_name="timestamp", lookup_expr="gte") + before = filters.DateTimeFilter(field_name="timestamp", lookup_expr="lte") newer = NewerThanFilter(queryset=Activity.comments.all()) class Meta: model = Activity - fields = ['visibility', 'since', 'before', 'newer'] + fields = ["visibility", "since", "before", "newer"] class AllCommentFilter(CommentFilter): class Meta(CommentFilter.Meta): - fields = CommentFilter.Meta.fields + ['source_object_id'] + fields = CommentFilter.Meta.fields + ["source_object_id"] diff --git a/hypha/apply/api/v1/mixin.py b/hypha/apply/api/v1/mixin.py index f132366d1f..f2c3b85ccb 100644 --- a/hypha/apply/api/v1/mixin.py +++ b/hypha/apply/api/v1/mixin.py @@ -6,20 +6,14 @@ class SubmissionNestedMixin: def get_submission_object(self): - return get_object_or_404( - ApplicationSubmission, id=self.kwargs['submission_pk'] - ) + return get_object_or_404(ApplicationSubmission, id=self.kwargs["submission_pk"]) class InvoiceNestedMixin: def get_invoice_object(self): - return get_object_or_404( - Invoice, id=self.kwargs['invoice_pk'] - ) + return get_object_or_404(Invoice, id=self.kwargs["invoice_pk"]) class ProjectNestedMixin: def get_project_object(self): - return get_object_or_404( - Project, id=self.kwargs['project_pk'] - ) + return get_object_or_404(Project, id=self.kwargs["project_pk"]) diff --git a/hypha/apply/api/v1/pagination.py b/hypha/apply/api/v1/pagination.py index 1382e50358..e626238ea0 100644 --- a/hypha/apply/api/v1/pagination.py +++ b/hypha/apply/api/v1/pagination.py @@ -2,5 +2,5 @@ class StandardResultsSetPagination(pagination.PageNumberPagination): - page_size_query_param = 'page_size' + page_size_query_param = "page_size" max_page_size = 1000 diff --git a/hypha/apply/api/v1/projects/serializers.py b/hypha/apply/api/v1/projects/serializers.py index a86b54e6ad..06edda05fc 100644 --- a/hypha/apply/api/v1/projects/serializers.py +++ b/hypha/apply/api/v1/projects/serializers.py @@ -6,15 +6,15 @@ class InvoiceDeliverableListSerializer(serializers.ModelSerializer): invoice_id = serializers.SerializerMethodField() - project_id = serializers.IntegerField(source='deliverable.project.id') + project_id = serializers.IntegerField(source="deliverable.project.id") class Meta: model = InvoiceDeliverable - fields = ('id', 'deliverable', 'quantity', 'invoice_id', 'project_id') + fields = ("id", "deliverable", "quantity", "invoice_id", "project_id") depth = 1 def get_invoice_id(self, obj): - return self.context['invoice'].id + return self.context["invoice"].id class DeliverableSerializer(serializers.Serializer): @@ -25,7 +25,5 @@ def validate_id(self, value): try: Deliverable.objects.get(id=value) except Deliverable.DoesNotExist as e: - raise exceptions.ValidationError({ - 'detail': _('Not found') - }) from e + raise exceptions.ValidationError({"detail": _("Not found")}) from e return value diff --git a/hypha/apply/api/v1/projects/views.py b/hypha/apply/api/v1/projects/views.py index c3e6e6cd98..f3991bb06d 100644 --- a/hypha/apply/api/v1/projects/views.py +++ b/hypha/apply/api/v1/projects/views.py @@ -25,11 +25,12 @@ class InvoiceDeliverableViewSet( ProjectNestedMixin, mixins.CreateModelMixin, mixins.DestroyModelMixin, - viewsets.GenericViewSet + viewsets.GenericViewSet, ): permission_classes = ( - permissions.IsAuthenticated, HasDeliverableEditPermission, - IsApplyStaffUser | IsFinance1User | IsFinance2User + permissions.IsAuthenticated, + HasDeliverableEditPermission, + IsApplyStaffUser | IsFinance1User | IsFinance2User, ) serializer_class = InvoiceDeliverableListSerializer pagination_class = None @@ -42,27 +43,29 @@ def create(self, request, *args, **kwargs): ser = DeliverableSerializer(data=request.data) ser.is_valid(raise_exception=True) project = self.get_project_object() - deliverable_id = ser.validated_data['id'] + deliverable_id = ser.validated_data["id"] if not project.deliverables.filter(id=deliverable_id).exists(): - raise ValidationError({'detail': _("Not Found")}) + raise ValidationError({"detail": _("Not Found")}) invoice = self.get_invoice_object() - deliverable = get_object_or_404( - Deliverable, id=deliverable_id - ) + deliverable = get_object_or_404(Deliverable, id=deliverable_id) if invoice.deliverables.filter(deliverable=deliverable).exists(): - raise ValidationError({'detail': _("Invoice Already has this deliverable")}) - quantity = ser.validated_data['quantity'] + raise ValidationError({"detail": _("Invoice Already has this deliverable")}) + quantity = ser.validated_data["quantity"] if deliverable.available_to_invoice < quantity: - raise ValidationError({'detail': _("Required quantity is more than available")}) + raise ValidationError( + {"detail": _("Required quantity is more than available")} + ) invoice_deliverable = InvoiceDeliverable.objects.create( - deliverable=deliverable, - quantity=ser.validated_data['quantity'] + deliverable=deliverable, quantity=ser.validated_data["quantity"] ) invoice.deliverables.add(invoice_deliverable) ser = self.get_serializer(invoice.deliverables.all(), many=True) return Response( - {'deliverables': ser.data, 'total': invoice.deliverables_total_amount['total']}, - status=status.HTTP_201_CREATED + { + "deliverables": ser.data, + "total": invoice.deliverables_total_amount["total"], + }, + status=status.HTTP_201_CREATED, ) def get_serializer_context(self): @@ -76,5 +79,8 @@ def destroy(self, request, *args, **kwargs): invoice.deliverables.remove(deliverable) ser = self.get_serializer(invoice.deliverables.all(), many=True) return Response( - {'deliverables': ser.data, 'total': invoice.deliverables_total_amount['total']}, + { + "deliverables": ser.data, + "total": invoice.deliverables_total_amount["total"], + }, ) diff --git a/hypha/apply/api/v1/reminder/serializers.py b/hypha/apply/api/v1/reminder/serializers.py index 8f99cbab7e..147fe1bc3d 100644 --- a/hypha/apply/api/v1/reminder/serializers.py +++ b/hypha/apply/api/v1/reminder/serializers.py @@ -4,12 +4,11 @@ class SubmissionReminderSerializer(serializers.ModelSerializer): - def validate(self, data): """ Check title is empty. """ - required_fields = ['title'] + required_fields = ["title"] for field in required_fields: if not data.get(field, None): raise serializers.ValidationError({field: "shouldn't be empty"}) @@ -17,5 +16,13 @@ def validate(self, data): class Meta: model = Reminder - fields = ('time', 'action_type', 'is_expired', 'id', 'action', 'title', 'description') - read_only_fields = ('action_type', 'is_expired') + fields = ( + "time", + "action_type", + "is_expired", + "id", + "action", + "title", + "description", + ) + read_only_fields = ("action_type", "is_expired") diff --git a/hypha/apply/api/v1/reminder/views.py b/hypha/apply/api/v1/reminder/views.py index 9fe899c2e5..f3e05a0428 100644 --- a/hypha/apply/api/v1/reminder/views.py +++ b/hypha/apply/api/v1/reminder/views.py @@ -13,17 +13,18 @@ class SubmissionReminderViewSet( SubmissionNestedMixin, mixins.ListModelMixin, mixins.CreateModelMixin, - viewsets.GenericViewSet + viewsets.GenericViewSet, ): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) serializer_class = SubmissionReminderSerializer pagination_class = None def get_queryset(self): submission = self.get_submission_object() - return Reminder.objects.filter(submission=submission).order_by('-time') + return Reminder.objects.filter(submission=submission).order_by("-time") def perform_create(self, serializer): serializer.save(user=self.request.user, submission=self.get_submission_object()) @@ -34,7 +35,7 @@ def destroy(self, request, *args, **kwargs): ser = self.get_serializer(self.get_queryset(), many=True) return Response(ser.data) - @action(detail=False, methods=['get']) + @action(detail=False, methods=["get"]) def fields(self, request, *args, **kwargs): """ List details of all the form fields that were created by admin for adding reminders. @@ -51,20 +52,22 @@ def fields(self, request, *args, **kwargs): "id": "description", "type": "textArea", "kwargs": {"label": "Description"}, - "widget": { - "attrs": {"cols": 40, "rows": 5}, - "type": "Textarea" - } + "widget": {"attrs": {"cols": 40, "rows": 5}, "type": "Textarea"}, }, { "id": "time", "kwargs": {"label": "Time", "required": True}, - "type": "DateTime" + "type": "DateTime", }, { "id": "action", - "kwargs": {"label": "Action", "required": True, "choices": Reminder.ACTIONS.items(), "initial": Reminder.REVIEW}, - "type": "Select" - } + "kwargs": { + "label": "Action", + "required": True, + "choices": Reminder.ACTIONS.items(), + "initial": Reminder.REVIEW, + }, + "type": "Select", + }, ] return Response(fields) diff --git a/hypha/apply/api/v1/review/fields.py b/hypha/apply/api/v1/review/fields.py index 600b86b243..0bc9ba7aa8 100644 --- a/hypha/apply/api/v1/review/fields.py +++ b/hypha/apply/api/v1/review/fields.py @@ -7,18 +7,17 @@ class ScoredAnswerListField(serializers.ListField): - childs = [ - serializers.CharField(), - serializers.ChoiceField(choices=RATE_CHOICES) - ] + childs = [serializers.CharField(), serializers.ChoiceField(choices=RATE_CHOICES)] def __init__(self, *args, **kwargs): - draft = kwargs.pop('draft', False) + draft = kwargs.pop("draft", False) super().__init__(*args, **kwargs) if draft: self.childs = [ - serializers.CharField(required=False, allow_null=True, allow_blank=True), - serializers.ChoiceField(choices=RATE_CHOICES) + serializers.CharField( + required=False, allow_null=True, allow_blank=True + ), + serializers.ChoiceField(choices=RATE_CHOICES), ] def run_child_validation(self, data): diff --git a/hypha/apply/api/v1/review/permissions.py b/hypha/apply/api/v1/review/permissions.py index 334154b266..d55e6a7f09 100644 --- a/hypha/apply/api/v1/review/permissions.py +++ b/hypha/apply/api/v1/review/permissions.py @@ -5,29 +5,34 @@ class HasReviewCreatePermission(permissions.BasePermission): """ Custom permission that user should have for creating review. """ + def has_permission(self, request, view): try: submission = view.get_submission_object() except KeyError: return True - return ( - submission.phase.permissions.can_review(request.user) and - submission.has_permission_to_review(request.user) - ) + return submission.phase.permissions.can_review( + request.user + ) and submission.has_permission_to_review(request.user) class HasReviewEditPermission(permissions.BasePermission): """ Custom permission that user should have for editing review. """ + def has_object_permission(self, request, view, obj): - return request.user.has_perm('review.change_review') or request.user == obj.author.reviewer + return ( + request.user.has_perm("review.change_review") + or request.user == obj.author.reviewer + ) class HasReviewDetailPermission(permissions.BasePermission): """ Custom permission that user should have for viewing review. """ + def has_object_permission(self, request, view, obj): user = request.user author = obj.author.reviewer @@ -42,7 +47,12 @@ def has_object_permission(self, request, view, obj): if user.is_reviewer and obj.reviewer_visibility: return True - if user.is_community_reviewer and submission.community_review and obj.reviewer_visibility and submission.user != user: + if ( + user.is_community_reviewer + and submission.community_review + and obj.reviewer_visibility + and submission.user != user + ): return True return False @@ -52,14 +62,18 @@ class HasReviewDeletePermission(permissions.BasePermission): """ Custom permission that user should have for deleting review. """ + def has_object_permission(self, request, view, obj): - return request.user.has_perm('review.delete_review') or request.user == obj.author + return ( + request.user.has_perm("review.delete_review") or request.user == obj.author + ) class HasReviewOpinionPermission(permissions.BasePermission): """ Custom permission that user should have for posting opinion on a review. """ + def has_object_permission(self, request, view, obj): review = obj user = request.user @@ -75,7 +89,12 @@ def has_object_permission(self, request, view, obj): if user.is_reviewer and review.reviewer_visibility: return True - if user.is_community_reviewer and submission.community_review and review.reviewer_visibility and submission.user != user: + if ( + user.is_community_reviewer + and submission.community_review + and review.reviewer_visibility + and submission.user != user + ): return True return False @@ -85,9 +104,15 @@ class HasReviewDraftPermission(permissions.BasePermission): """ Custom permission that user should have to access draft review. """ + def has_object_permission(self, request, view, obj): try: submission = view.get_submission_object() except KeyError: return True - return submission.can_review(request.user) and submission.assigned.draft_reviewed().filter(reviewer=request.user).exists() + return ( + submission.can_review(request.user) + and submission.assigned.draft_reviewed() + .filter(reviewer=request.user) + .exists() + ) diff --git a/hypha/apply/api/v1/review/serializers.py b/hypha/apply/api/v1/review/serializers.py index 80c2795e6a..d4353033e8 100644 --- a/hypha/apply/api/v1/review/serializers.py +++ b/hypha/apply/api/v1/review/serializers.py @@ -8,19 +8,19 @@ class ReviewOpinionReadSerializer(serializers.ModelSerializer): - author_id = serializers.ReadOnlyField(source='author.id') - opinion = serializers.ReadOnlyField(source='get_opinion_display') + author_id = serializers.ReadOnlyField(source="author.id") + opinion = serializers.ReadOnlyField(source="get_opinion_display") class Meta: model = ReviewOpinion - fields = ('author_id', 'opinion') + fields = ("author_id", "opinion") class ReviewOpinionWriteSerializer(serializers.ModelSerializer): class Meta: model = ReviewOpinion - fields = ('opinion', ) - extra_kwargs = {'opinion': {'write_only': True}} + fields = ("opinion",) + extra_kwargs = {"opinion": {"write_only": True}} class SubmissionReviewSerializer(serializers.ModelSerializer): @@ -28,21 +28,23 @@ class SubmissionReviewSerializer(serializers.ModelSerializer): class Meta: model = Review - fields = ['id', 'score', 'is_draft', 'opinions', ] - extra_kwargs = { - 'score': {'read_only': True}, - 'is_draft': {'required': False} - } + fields = [ + "id", + "score", + "is_draft", + "opinions", + ] + extra_kwargs = {"score": {"read_only": True}, "is_draft": {"required": False}} def get_recommendation(self, obj): return { - 'value': obj.recommendation, - 'display': obj.get_recommendation_display(), + "value": obj.recommendation, + "display": obj.get_recommendation_display(), } def validate(self, data): validated_data = super().validate(data) - validated_data['form_data'] = dict(validated_data.items()) + validated_data["form_data"] = dict(validated_data.items()) return validated_data def update(self, instance, validated_data): @@ -52,7 +54,7 @@ def update(self, instance, validated_data): instance.recommendation = int( recommendation if recommendation is not None else NO ) - instance.is_draft = self.validated_data.get('is_draft', False) + instance.is_draft = self.validated_data.get("is_draft", False) # Old review forms do not have the requred visability field. # This will set visibility to PRIVATE by default. @@ -71,7 +73,7 @@ def update(self, instance, validated_data): def calculate_score(self, instance, data): scores = [] for field in instance.score_fields: - score = data.get(field.id, ['', NA]) + score = data.get(field.id, ["", NA]) # Include NA answers as 0. score = score[1] if score is not None else NA if score == NA: @@ -80,9 +82,9 @@ def calculate_score(self, instance, data): # Check if there are score_fields_without_text and also # append scores from them. for field in instance.score_fields_without_text: - score = data.get(field.id, '') + score = data.get(field.id, "") # Include '' answers as 0. - if score is None or score == '': + if score is None or score == "": score = 0 scores.append(int(score)) @@ -103,7 +105,7 @@ def get_id(self, obj): def get_type(self, obj): if isinstance(obj[1], BlockFieldWrapper): - return 'LoadHTML' + return "LoadHTML" return obj[1].__class__.__name__ def get_kwargs(self, obj): diff --git a/hypha/apply/api/v1/review/utils.py b/hypha/apply/api/v1/review/utils.py index 12b4d4d53d..c172bf7812 100644 --- a/hypha/apply/api/v1/review/utils.py +++ b/hypha/apply/api/v1/review/utils.py @@ -9,21 +9,33 @@ def review_workflow_actions(request, submission): if submission.status == INITIAL_STATE: # Automatically transition the application to "Internal review". action = submission_stepped_phases[2][0].name - elif submission.status == 'proposal_discussion': + elif submission.status == "proposal_discussion": # Automatically transition the proposal to "Internal review". - action = 'proposal_internal_review' - elif submission.status == submission_stepped_phases[2][0].name and submission.reviews.count() > 1: + action = "proposal_internal_review" + elif ( + submission.status == submission_stepped_phases[2][0].name + and submission.reviews.count() > 1 + ): # Automatically transition the application to "Ready for discussion". action = submission_stepped_phases[3][0].name - elif submission.status == 'ext_external_review' and submission.reviews.by_reviewers().count() > 1: + elif ( + submission.status == "ext_external_review" + and submission.reviews.by_reviewers().count() > 1 + ): # Automatically transition the application to "Ready for discussion". - action = 'ext_post_external_review_discussion' - elif submission.status == 'com_external_review' and submission.reviews.by_reviewers().count() > 1: + action = "ext_post_external_review_discussion" + elif ( + submission.status == "com_external_review" + and submission.reviews.by_reviewers().count() > 1 + ): # Automatically transition the application to "Ready for discussion". - action = 'com_post_external_review_discussion' - elif submission.status == 'external_review' and submission.reviews.by_reviewers().count() > 1: + action = "com_post_external_review_discussion" + elif ( + submission.status == "external_review" + and submission.reviews.by_reviewers().count() > 1 + ): # Automatically transition the proposal to "Ready for discussion". - action = 'post_external_review_discussion' + action = "post_external_review_discussion" # If action is set run perform_transition(). if action: @@ -39,7 +51,7 @@ def review_workflow_actions(request, submission): def get_review_form_fields_for_stage(submission): - forms = submission.get_from_parent('review_forms').all() + forms = submission.get_from_parent("review_forms").all() index = submission.workflow.stages.index(submission.stage) try: return forms[index].form.form_fields diff --git a/hypha/apply/api/v1/review/views.py b/hypha/apply/api/v1/review/views.py index 5ad667c309..09033429c2 100644 --- a/hypha/apply/api/v1/review/views.py +++ b/hypha/apply/api/v1/review/views.py @@ -30,29 +30,58 @@ class SubmissionReviewViewSet( - BaseStreamForm, - WagtailSerializer, - SubmissionNestedMixin, - viewsets.GenericViewSet + BaseStreamForm, WagtailSerializer, SubmissionNestedMixin, viewsets.GenericViewSet ): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) permission_classes_by_action = { - 'create': [permissions.IsAuthenticated, HasReviewCreatePermission, IsApplyStaffUser, ], - 'retrieve': [permissions.IsAuthenticated, HasReviewDetailPermission, IsApplyStaffUser, ], - 'update': [permissions.IsAuthenticated, HasReviewEditPermission, IsApplyStaffUser, ], - 'delete': [permissions.IsAuthenticated, HasReviewDeletePermission, IsApplyStaffUser, ], - 'opinions': [permissions.IsAuthenticated, HasReviewOpinionPermission, IsApplyStaffUser, ], - 'fields': [permissions.IsAuthenticated, HasReviewCreatePermission, IsApplyStaffUser, ], - 'draft': [permissions.IsAuthenticated, HasReviewDraftPermission, IsApplyStaffUser, ], + "create": [ + permissions.IsAuthenticated, + HasReviewCreatePermission, + IsApplyStaffUser, + ], + "retrieve": [ + permissions.IsAuthenticated, + HasReviewDetailPermission, + IsApplyStaffUser, + ], + "update": [ + permissions.IsAuthenticated, + HasReviewEditPermission, + IsApplyStaffUser, + ], + "delete": [ + permissions.IsAuthenticated, + HasReviewDeletePermission, + IsApplyStaffUser, + ], + "opinions": [ + permissions.IsAuthenticated, + HasReviewOpinionPermission, + IsApplyStaffUser, + ], + "fields": [ + permissions.IsAuthenticated, + HasReviewCreatePermission, + IsApplyStaffUser, + ], + "draft": [ + permissions.IsAuthenticated, + HasReviewDraftPermission, + IsApplyStaffUser, + ], } serializer_class = SubmissionReviewSerializer def get_permissions(self): try: # return permission_classes depending on `action` - return [permission() for permission in self.permission_classes_by_action[self.action]] + return [ + permission() + for permission in self.permission_classes_by_action[self.action] + ] except KeyError: # action is not set return default permission_classes return [permission() for permission in self.permission_classes] @@ -63,12 +92,12 @@ def get_defined_fields(self): These form fields will be used to get respective serializer fields. """ - if self.action in ['retrieve', 'update', 'opinions']: + if self.action in ["retrieve", "update", "opinions"]: # For detail and edit api form fields used while submitting # review should be used. review = self.get_object() return review.form_fields - if self.action == 'draft': + if self.action == "draft": review = self.get_review_by_reviewer() return review.form_fields submission = self.get_submission_object() @@ -80,13 +109,13 @@ def get_serializer_class(self): if the request is to save as draft or the review submitted is saved as draft. """ - if self.action == 'retrieve': + if self.action == "retrieve": review = self.get_object() draft = review.is_draft - elif self.action == 'draft': + elif self.action == "draft": draft = True else: - draft = self.request.data.get('is_draft', False) + draft = self.request.data.get("is_draft", False) return super().get_serializer_class(draft) def get_queryset(self): @@ -98,7 +127,7 @@ def get_object(self): Get the review object by id. If not found raise 404. """ queryset = self.get_queryset() - obj = get_object_or_404(queryset, id=self.kwargs['pk']) + obj = get_object_or_404(queryset, id=self.kwargs["pk"]) self.check_object_permissions(self.request, obj) return obj @@ -134,7 +163,9 @@ def create(self, request, *args, **kwargs): submission=submission, author=self.get_reviewer() ) if not create and not instance.is_draft: - raise ValidationError({'detail': 'You have already posted a review for this submission'}) + raise ValidationError( + {"detail": "You have already posted a review for this submission"} + ) instance.form_fields = self.get_defined_fields() instance.save() ser.update(instance, ser.validated_data) @@ -148,9 +179,7 @@ def create(self, request, *args, **kwargs): ) # Automatic workflow actions. review_workflow_actions(self.request, submission) - ser = self.get_serializer( - self.get_review_data(instance) - ) + ser = self.get_serializer(self.get_review_data(instance)) return Response(ser.data, status=status.HTTP_201_CREATED) def get_review_data(self, review): @@ -158,10 +187,10 @@ def get_review_data(self, review): Get review data which will be used for review detail api. """ review_data = review.form_data - review_data['id'] = review.id - review_data['score'] = review.score - review_data['opinions'] = review.opinions - review_data['is_draft'] = review.is_draft + review_data["id"] = review.id + review_data["score"] = review.score + review_data["opinions"] = review.opinions + review_data["is_draft"] = review.is_draft for field_block in review.form_fields: if isinstance(field_block.block, RichTextBlock): review_data[field_block.id] = field_block.value.source @@ -172,9 +201,7 @@ def retrieve(self, request, *args, **kwargs): Get details of a review on a submission """ review = self.get_object() - ser = self.get_serializer( - self.get_review_data(review) - ) + ser = self.get_serializer(self.get_review_data(review)) return Response(ser.data) def update(self, request, *args, **kwargs): @@ -195,9 +222,7 @@ def update(self, request, *args, **kwargs): ) # Automatic workflow actions. review_workflow_actions(self.request, review.submission) - ser = self.get_serializer( - self.get_review_data(review) - ) + ser = self.get_serializer(self.get_review_data(review)) return Response(ser.data) def destroy(self, request, *args, **kwargs): @@ -220,7 +245,7 @@ def get_review_by_reviewer(self): ) return review - @action(detail=False, methods=['get']) + @action(detail=False, methods=["get"]) def draft(self, request, *args, **kwargs): """ Returns the draft review submitted on a submission by current user. @@ -231,12 +256,10 @@ def draft(self, request, *args, **kwargs): return Response({}) if not review.is_draft: return Response({}) - ser = self.get_serializer( - self.get_review_data(review) - ) + ser = self.get_serializer(self.get_review_data(review)) return Response(ser.data) - @action(detail=False, methods=['get']) + @action(detail=False, methods=["get"]) def fields(self, request, *args, **kwargs): """ List details of all the form fields that were created by admin for adding reviews. @@ -247,7 +270,7 @@ def fields(self, request, *args, **kwargs): fields = FieldSerializer(fields.items(), many=True) return Response(fields.data) - @action(detail=True, methods=['post']) + @action(detail=True, methods=["post"]) def opinions(self, request, *args, **kwargs): """ Used to add opinions on a review. @@ -259,22 +282,17 @@ def opinions(self, request, *args, **kwargs): review = self.get_object() ser = ReviewOpinionWriteSerializer(data=request.data) ser.is_valid(raise_exception=True) - opinion = ser.validated_data['opinion'] + opinion = ser.validated_data["opinion"] try: review_opinion = ReviewOpinion.objects.get( - review=review, - author=self.get_reviewer() + review=review, author=self.get_reviewer() ) except ReviewOpinion.DoesNotExist: ReviewOpinion.objects.create( - review=review, - author=self.get_reviewer(), - opinion=opinion + review=review, author=self.get_reviewer(), opinion=opinion ) else: review_opinion.opinion = opinion review_opinion.save() - ser = self.get_serializer( - self.get_review_data(review) - ) + ser = self.get_serializer(self.get_review_data(review)) return Response(ser.data, status=status.HTTP_201_CREATED) diff --git a/hypha/apply/api/v1/screening/filters.py b/hypha/apply/api/v1/screening/filters.py index 51da1140a9..610c714934 100644 --- a/hypha/apply/api/v1/screening/filters.py +++ b/hypha/apply/api/v1/screening/filters.py @@ -6,4 +6,4 @@ class ScreeningStatusFilter(filters.FilterSet): class Meta: model = ScreeningStatus - fields = ['yes', 'default'] + fields = ["yes", "default"] diff --git a/hypha/apply/api/v1/screening/serializers.py b/hypha/apply/api/v1/screening/serializers.py index 1ab08ad63a..eeefea1b5a 100644 --- a/hypha/apply/api/v1/screening/serializers.py +++ b/hypha/apply/api/v1/screening/serializers.py @@ -6,7 +6,7 @@ class ScreeningStatusListSerializer(serializers.ModelSerializer): class Meta: model = ScreeningStatus - fields = ('id', 'title', 'yes', 'default') + fields = ("id", "title", "yes", "default") class ScreeningStatusSerializer(serializers.Serializer): @@ -16,9 +16,7 @@ def validate_id(self, value): try: ScreeningStatus.objects.get(id=value) except ScreeningStatus.DoesNotExist as e: - raise exceptions.ValidationError({ - 'detail': 'Not found' - }) from e + raise exceptions.ValidationError({"detail": "Not found"}) from e return value diff --git a/hypha/apply/api/v1/screening/tests/test_views.py b/hypha/apply/api/v1/screening/tests/test_views.py index 719e21340e..b0d37f809b 100644 --- a/hypha/apply/api/v1/screening/tests/test_views.py +++ b/hypha/apply/api/v1/screening/tests/test_views.py @@ -9,33 +9,30 @@ from hypha.apply.users.tests.factories import ReviewerFactory, StaffFactory, UserFactory -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") @override_settings(SECURE_SSL_REDIRECT=False) class ScreeningStatusViewSetTests(APITestCase): def setUp(self): ScreeningStatus.objects.all().delete() - self.yes_screening_status = baker.make( - 'funds.ScreeningStatus', - yes=True - ) + self.yes_screening_status = baker.make("funds.ScreeningStatus", yes=True) def get_screening_status_url(self, pk=None): if pk: - return reverse_lazy('api:v1:screenings-detail', kwargs={'pk': pk}) - return reverse_lazy('api:v1:screenings-list') + return reverse_lazy("api:v1:screenings-detail", kwargs={"pk": pk}) + return reverse_lazy("api:v1:screenings-list") def test_staff_can_list_screening_statuses(self): user = StaffFactory() self.client.force_authenticate(user) - response = self.client.get( - self.get_screening_status_url() - ) + response = self.client.get(self.get_screening_status_url()) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.json()), ScreeningStatus.objects.count()) - self.assertEqual(response.json()[0]['id'], self.yes_screening_status.id) - self.assertEqual(response.json()[0]['title'], self.yes_screening_status.title) - self.assertEqual(response.json()[0]['yes'], self.yes_screening_status.yes) - self.assertEqual(response.json()[0]['default'], self.yes_screening_status.default) + self.assertEqual(response.json()[0]["id"], self.yes_screening_status.id) + self.assertEqual(response.json()[0]["title"], self.yes_screening_status.title) + self.assertEqual(response.json()[0]["yes"], self.yes_screening_status.yes) + self.assertEqual( + response.json()[0]["default"], self.yes_screening_status.default + ) def test_staff_can_view_screening_statuses_detail(self): user = StaffFactory() @@ -48,47 +45,36 @@ def test_staff_can_view_screening_statuses_detail(self): def test_user_cant_list_screening_statuses(self): user = UserFactory() self.client.force_authenticate(user) - response = self.client.get( - self.get_screening_status_url() - ) + response = self.client.get(self.get_screening_status_url()) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) def test_reviewer_cant_list_screening_statuses(self): user = ReviewerFactory() self.client.force_authenticate(user) - response = self.client.get( - self.get_screening_status_url() - ) + response = self.client.get(self.get_screening_status_url()) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) @override_settings(SECURE_SSL_REDIRECT=False) -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class SubmissionScreeningStatusViewSetTests(APITestCase): def setUp(self): ScreeningStatus.objects.all().delete() - self.yes_screening_status = baker.make( - 'funds.ScreeningStatus', - yes=True - ) + self.yes_screening_status = baker.make("funds.ScreeningStatus", yes=True) self.yes_default_screening_status = baker.make( - 'funds.ScreeningStatus', - yes=True, - default=True - ) - self.no_screening_status = baker.make( - 'funds.ScreeningStatus', - yes=False + "funds.ScreeningStatus", yes=True, default=True ) + self.no_screening_status = baker.make("funds.ScreeningStatus", yes=False) self.no_default_screening_status = baker.make( - 'funds.ScreeningStatus', - yes=False, - default=True + "funds.ScreeningStatus", yes=False, default=True ) self.submission = ApplicationSubmissionFactory() def get_submission_screening_status_url(self, submission_id=None): - return reverse_lazy('api:v1:submission-screening_statuses-list', kwargs={'submission_pk': submission_id}) + return reverse_lazy( + "api:v1:submission-screening_statuses-list", + kwargs={"submission_pk": submission_id}, + ) def test_cant_add_screening_status_without_setting_default(self): user = StaffFactory() @@ -96,12 +82,12 @@ def test_cant_add_screening_status_without_setting_default(self): self.submission.screening_statuses.clear() response = self.client.post( self.get_submission_screening_status_url(submission_id=self.submission.id), - data={'id': self.yes_screening_status.id} + data={"id": self.yes_screening_status.id}, ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual( - response.json()['detail'], - "Can't set screening decision without default being set" + response.json()["detail"], + "Can't set screening decision without default being set", ) def test_cant_add_two_types_of_screening_status(self): @@ -111,12 +97,12 @@ def test_cant_add_two_types_of_screening_status(self): self.submission.screening_statuses.add(self.yes_default_screening_status) response = self.client.post( self.get_submission_screening_status_url(submission_id=self.submission.id), - data={'id': self.no_screening_status.id} + data={"id": self.no_screening_status.id}, ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual( - response.json()['detail'], - "Can't set screening decision for both yes and no" + response.json()["detail"], + "Can't set screening decision for both yes and no", ) def test_add_screening_status(self): @@ -126,14 +112,17 @@ def test_add_screening_status(self): self.submission.screening_statuses.add(self.yes_default_screening_status) response = self.client.post( self.get_submission_screening_status_url(submission_id=self.submission.id), - data={'id': self.yes_screening_status.id} + data={"id": self.yes_screening_status.id}, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(len(response.json()), 2) - possible_ids = [self.yes_screening_status.id, self.yes_default_screening_status.id] - self.assertIn(response.json()[0]['id'], possible_ids) - self.assertIn(response.json()[1]['id'], possible_ids) + possible_ids = [ + self.yes_screening_status.id, + self.yes_default_screening_status.id, + ] + self.assertIn(response.json()[0]["id"], possible_ids) + self.assertIn(response.json()[1]["id"], possible_ids) def test_staff_can_list_submission_screening_statuses(self): user = StaffFactory() @@ -150,57 +139,79 @@ def test_set_default_screening_status(self): self.submission.screening_statuses.clear() self.client.force_authenticate(user) response = self.client.post( - reverse_lazy('api:v1:submission-screening_statuses-default', kwargs={'submission_pk': self.submission.id}), - data={'yes': True} + reverse_lazy( + "api:v1:submission-screening_statuses-default", + kwargs={"submission_pk": self.submission.id}, + ), + data={"yes": True}, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) default_set = self.submission.screening_statuses.get(default=True) - self.assertEqual(response.json()['id'], default_set.id) - self.assertEqual(response.json()['yes'], default_set.yes) + self.assertEqual(response.json()["id"], default_set.id) + self.assertEqual(response.json()["yes"], default_set.yes) def test_change_default_screening_status(self): user = StaffFactory() self.client.force_authenticate(user) self.submission.screening_statuses.clear() response = self.client.post( - reverse_lazy('api:v1:submission-screening_statuses-default', kwargs={'submission_pk': self.submission.id}), - data={'yes': True} + reverse_lazy( + "api:v1:submission-screening_statuses-default", + kwargs={"submission_pk": self.submission.id}, + ), + data={"yes": True}, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) default_set = self.submission.screening_statuses.get(default=True) - self.assertEqual(response.json()['id'], default_set.id) - self.assertEqual(response.json()['yes'], default_set.yes) + self.assertEqual(response.json()["id"], default_set.id) + self.assertEqual(response.json()["yes"], default_set.yes) response = self.client.post( - reverse_lazy('api:v1:submission-screening_statuses-default', kwargs={'submission_pk': self.submission.id}), - data={'yes': False} + reverse_lazy( + "api:v1:submission-screening_statuses-default", + kwargs={"submission_pk": self.submission.id}, + ), + data={"yes": False}, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) default_set = self.submission.screening_statuses.get(default=True) - self.assertEqual(response.json()['id'], default_set.id) - self.assertEqual(response.json()['yes'], default_set.yes) + self.assertEqual(response.json()["id"], default_set.id) + self.assertEqual(response.json()["yes"], default_set.yes) def test_cant_change_default_screening_status(self): user = StaffFactory() self.submission.screening_statuses.clear() self.client.force_authenticate(user) - self.submission.screening_statuses.add(self.yes_default_screening_status, self.yes_screening_status) + self.submission.screening_statuses.add( + self.yes_default_screening_status, self.yes_screening_status + ) response = self.client.post( - reverse_lazy('api:v1:submission-screening_statuses-default', kwargs={'submission_pk': self.submission.id}), - data={'yes': False} + reverse_lazy( + "api:v1:submission-screening_statuses-default", + kwargs={"submission_pk": self.submission.id}, + ), + data={"yes": False}, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) default_set = self.submission.screening_statuses.get(default=True) - self.assertEqual(response.json()['id'], default_set.id) - self.assertEqual(response.json()['yes'], default_set.yes) + self.assertEqual(response.json()["id"], default_set.id) + self.assertEqual(response.json()["yes"], default_set.yes) def test_remove_submission_screening_status(self): user = StaffFactory() self.submission.screening_statuses.clear() self.client.force_authenticate(user) - self.submission.screening_statuses.add(self.yes_default_screening_status, self.yes_screening_status) + self.submission.screening_statuses.add( + self.yes_default_screening_status, self.yes_screening_status + ) response = self.client.delete( - reverse_lazy('api:v1:submission-screening_statuses-detail', kwargs={'submission_pk': self.submission.id, 'pk': self.yes_screening_status.id}) + reverse_lazy( + "api:v1:submission-screening_statuses-detail", + kwargs={ + "submission_pk": self.submission.id, + "pk": self.yes_screening_status.id, + }, + ) ) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.json()), 1) @@ -211,12 +222,17 @@ def test_cant_remove_submission_default_screening_status(self): self.submission.screening_statuses.add(self.yes_default_screening_status) self.client.force_authenticate(user) response = self.client.delete( - reverse_lazy('api:v1:submission-screening_statuses-detail', kwargs={'submission_pk': self.submission.id, 'pk': self.yes_default_screening_status.id}) + reverse_lazy( + "api:v1:submission-screening_statuses-detail", + kwargs={ + "submission_pk": self.submission.id, + "pk": self.yes_default_screening_status.id, + }, + ) ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual( - response.json()['detail'], - "Can't delete default screening decision." + response.json()["detail"], "Can't delete default screening decision." ) def test_cant_remove_not_set_screening_status(self): @@ -224,7 +240,13 @@ def test_cant_remove_not_set_screening_status(self): self.submission.screening_statuses.clear() self.client.force_authenticate(user) response = self.client.delete( - reverse_lazy('api:v1:submission-screening_statuses-detail', kwargs={'submission_pk': self.submission.id, 'pk': self.yes_screening_status.id}) + reverse_lazy( + "api:v1:submission-screening_statuses-detail", + kwargs={ + "submission_pk": self.submission.id, + "pk": self.yes_screening_status.id, + }, + ) ) self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) diff --git a/hypha/apply/api/v1/screening/views.py b/hypha/apply/api/v1/screening/views.py index 79d1d7cf49..290dcd1888 100644 --- a/hypha/apply/api/v1/screening/views.py +++ b/hypha/apply/api/v1/screening/views.py @@ -20,7 +20,8 @@ class ScreeningStatusViewSet(viewsets.ReadOnlyModelViewSet): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) filter_backends = (filters.DjangoFilterBackend,) filterset_class = ScreeningStatusFilter @@ -33,10 +34,12 @@ class SubmissionScreeningStatusViewSet( SubmissionNestedMixin, mixins.ListModelMixin, mixins.CreateModelMixin, - viewsets.GenericViewSet + viewsets.GenericViewSet, ): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, HasScreenPermission + permissions.IsAuthenticated, + IsApplyStaffUser, + HasScreenPermission, ) serializer_class = ScreeningStatusListSerializer pagination_class = None @@ -50,29 +53,33 @@ def create(self, request, *args, **kwargs): ser.is_valid(raise_exception=True) submission = self.get_submission_object() screening_status = get_object_or_404( - ScreeningStatus, id=ser.validated_data['id'] + ScreeningStatus, id=ser.validated_data["id"] ) if not submission.screening_statuses.filter(default=True).exists(): - raise ValidationError({'detail': "Can't set screening decision without default being set"}) + raise ValidationError( + {"detail": "Can't set screening decision without default being set"} + ) if ( - submission.screening_statuses.exists() and - submission.screening_statuses.first().yes != screening_status.yes + submission.screening_statuses.exists() + and submission.screening_statuses.first().yes != screening_status.yes ): - raise ValidationError({'detail': "Can't set screening decision for both yes and no"}) - submission.screening_statuses.add( - screening_status - ) + raise ValidationError( + {"detail": "Can't set screening decision for both yes and no"} + ) + submission.screening_statuses.add(screening_status) ser = self.get_serializer(submission.screening_statuses.all(), many=True) return Response(ser.data, status=status.HTTP_201_CREATED) - @action(detail=False, methods=['post']) + @action(detail=False, methods=["post"]) def default(self, request, *args, **kwargs): ser = ScreeningStatusDefaultSerializer(data=request.data) ser.is_valid(raise_exception=True) - yes = ser.validated_data['yes'] + yes = ser.validated_data["yes"] submission = self.get_submission_object() if submission.screening_statuses.filter(default=False).exists(): - submission.screening_statuses.remove(*submission.screening_statuses.filter(default=False)) + submission.screening_statuses.remove( + *submission.screening_statuses.filter(default=False) + ) screening_status = ScreeningStatus.objects.get(default=True, yes=yes) if submission.has_default_screening_status_set: default_status = submission.screening_statuses.get() @@ -84,9 +91,9 @@ def default(self, request, *args, **kwargs): def destroy(self, request, *args, **kwargs): screening_status = self.get_object() if screening_status.default: - raise ValidationError({ - 'detail': "Can't delete default screening decision." - }) + raise ValidationError( + {"detail": "Can't delete default screening decision."} + ) submission = self.get_submission_object() submission.screening_statuses.remove(screening_status) ser = self.get_serializer(submission.screening_statuses.all(), many=True) diff --git a/hypha/apply/api/v1/serializers.py b/hypha/apply/api/v1/serializers.py index 5116360214..01288cc79f 100644 --- a/hypha/apply/api/v1/serializers.py +++ b/hypha/apply/api/v1/serializers.py @@ -24,13 +24,10 @@ class ActionSerializer(serializers.Field): def to_representation(self, instance): - actions = instance.get_actions_for_user(self.context['request'].user) + actions = instance.get_actions_for_user(self.context["request"].user) representation = [] for transition, action in actions: - action_dict = { - 'value': transition, - 'display': action - } + action_dict = {"value": transition, "display": action} # Sometimes the status does not exist in the # determination matrix. @@ -43,40 +40,48 @@ def to_representation(self, instance): except KeyError: redirect = None if redirect: - action_dict['type'] = 'redirect' - action_dict['target'] = redirect.url + action_dict["type"] = "redirect" + action_dict["target"] = redirect.url else: - action_dict['type'] = 'submit' + action_dict["type"] = "submit" representation.append(action_dict) return representation class OpinionSerializer(serializers.ModelSerializer): - author_id = serializers.ReadOnlyField(source='author.id') - opinion = serializers.ReadOnlyField(source='get_opinion_display') + author_id = serializers.ReadOnlyField(source="author.id") + opinion = serializers.ReadOnlyField(source="get_opinion_display") class Meta: model = ReviewOpinion - fields = ('author_id', 'opinion') + fields = ("author_id", "opinion") class ReviewSerializer(serializers.ModelSerializer): user_id = serializers.SerializerMethodField() - author_id = serializers.ReadOnlyField(source='author.id') - url = serializers.ReadOnlyField(source='get_absolute_url') + author_id = serializers.ReadOnlyField(source="author.id") + url = serializers.ReadOnlyField(source="get_absolute_url") opinions = OpinionSerializer(read_only=True, many=True) recommendation = serializers.SerializerMethodField() - score = serializers.ReadOnlyField(source='get_score_display') + score = serializers.ReadOnlyField(source="get_score_display") class Meta: model = Review - fields = ('id', 'score', 'user_id', 'author_id', 'url', 'opinions', 'recommendation') + fields = ( + "id", + "score", + "user_id", + "author_id", + "url", + "opinions", + "recommendation", + ) def get_recommendation(self, obj): return { - 'value': obj.recommendation, - 'display': obj.get_recommendation_display(), + "value": obj.recommendation, + "display": obj.get_recommendation_display(), } def get_user_id(self, obj): @@ -85,32 +90,33 @@ def get_user_id(self, obj): class ReviewSummarySerializer(serializers.Serializer): reviews = ReviewSerializer(many=True, read_only=True) - count = serializers.ReadOnlyField(source='reviews.count') - score = serializers.ReadOnlyField(source='reviews.score') + count = serializers.ReadOnlyField(source="reviews.count") + score = serializers.ReadOnlyField(source="reviews.score") recommendation = serializers.SerializerMethodField() assigned = serializers.SerializerMethodField() def get_recommendation(self, obj): recommendation = obj.reviews.recommendation() return { - 'value': recommendation, - 'display': dict(RECOMMENDATION_CHOICES).get(recommendation), + "value": recommendation, + "display": dict(RECOMMENDATION_CHOICES).get(recommendation), } def get_assigned(self, obj): - assigned_reviewers = obj.assigned.select_related('reviewer', 'role', 'type') + assigned_reviewers = obj.assigned.select_related("reviewer", "role", "type") response = [ { - 'id': assigned.id, - 'name': str(assigned.reviewer), - 'role': { - 'icon': assigned.role and assigned.role.icon_url('fill-12x12'), - 'name': assigned.role and assigned.role.name, - 'order': assigned.role and assigned.role.order, + "id": assigned.id, + "name": str(assigned.reviewer), + "role": { + "icon": assigned.role and assigned.role.icon_url("fill-12x12"), + "name": assigned.role and assigned.role.name, + "order": assigned.role and assigned.role.order, }, - 'is_staff': assigned.type.name == STAFF_GROUP_NAME, - 'is_partner': assigned.type.name == PARTNER_GROUP_NAME, - } for assigned in assigned_reviewers + "is_staff": assigned.type.name == STAFF_GROUP_NAME, + "is_partner": assigned.type.name == PARTNER_GROUP_NAME, + } + for assigned in assigned_reviewers ] return response @@ -121,30 +127,30 @@ def to_representation(self, value): class DeterminationSerializer(serializers.ModelSerializer): - outcome = serializers.ReadOnlyField(source='get_outcome_display') + outcome = serializers.ReadOnlyField(source="get_outcome_display") author = serializers.CharField(read_only=True) - url = serializers.ReadOnlyField(source='get_absolute_url') + url = serializers.ReadOnlyField(source="get_absolute_url") updated_at = serializers.DateTimeField(read_only=True) is_draft = serializers.BooleanField(read_only=True) class Meta: model = Determination - fields = ('id', 'outcome', 'author', 'url', 'updated_at', 'is_draft') + fields = ("id", "outcome", "author", "url", "updated_at", "is_draft") class DeterminationSummarySerializer(serializers.Serializer): determinations = DeterminationSerializer(many=True, read_only=True) - count = serializers.ReadOnlyField(source='determinations.count') + count = serializers.ReadOnlyField(source="determinations.count") class SubmissionListSerializer(serializers.ModelSerializer): - url = serializers.HyperlinkedIdentityField(view_name='api:v1:submissions-detail') + url = serializers.HyperlinkedIdentityField(view_name="api:v1:submissions-detail") round = serializers.SerializerMethodField() last_update = TimestampField() class Meta: model = ApplicationSubmission - fields = ('id', 'title', 'status', 'url', 'round', 'last_update', 'summary') + fields = ("id", "title", "status", "url", "round", "last_update", "summary") def get_round(self, obj): """ @@ -163,10 +169,7 @@ class Meta: def get_parent(self, obj): parent = obj.get_parent() if parent: - parent_data = { - 'id': parent.id, - 'name': parent.name - } + parent_data = {"id": parent.id, "name": parent.name} return parent_data @@ -175,17 +178,19 @@ class SubmissionSummarySerializer(serializers.Serializer): class SubmissionMetaTermsSerializer(serializers.Serializer): - meta_terms = serializers.PrimaryKeyRelatedField(many=True, queryset=MetaTerm.objects.all()) + meta_terms = serializers.PrimaryKeyRelatedField( + many=True, queryset=MetaTerm.objects.all() + ) class SubmissionDetailSerializer(serializers.ModelSerializer): questions = serializers.SerializerMethodField() meta_questions = serializers.SerializerMethodField() meta_terms = MetaTermsDetailSerializer(many=True) - stage = serializers.CharField(source='stage.name') - actions = ActionSerializer(source='*') - review = ReviewSummarySerializer(source='*') - determination = DeterminationSummarySerializer(source='*') + stage = serializers.CharField(source="stage.name") + actions = ActionSerializer(source="*") + review = ReviewSummarySerializer(source="*") + determination = DeterminationSummarySerializer(source="*") phase = serializers.CharField() screening = serializers.SerializerMethodField() action_buttons = serializers.SerializerMethodField() @@ -196,30 +201,50 @@ class SubmissionDetailSerializer(serializers.ModelSerializer): class Meta: model = ApplicationSubmission - fields = ('id', 'summary', 'title', 'stage', 'status', 'phase', 'meta_questions', 'meta_terms', 'questions', 'actions', 'review', 'screening', 'action_buttons', 'determination', 'is_determination_form_attached', 'is_user_staff', 'screening', 'flags', 'reminders') + fields = ( + "id", + "summary", + "title", + "stage", + "status", + "phase", + "meta_questions", + "meta_terms", + "questions", + "actions", + "review", + "screening", + "action_buttons", + "determination", + "is_determination_form_attached", + "is_user_staff", + "screening", + "flags", + "reminders", + ) def serialize_questions(self, obj, fields): for field_id in fields: yield obj.serialize(field_id) def get_is_user_staff(self, obj): - request = self.context['request'] + request = self.context["request"] return request.user.is_apply_staff def get_meta_questions(self, obj): meta_questions = { - 'title': 'Project Name', - 'full_name': 'Legal Name', - 'email': 'Email', - 'value': 'Requested Funding', - 'duration': 'Project Duration', - 'address': 'Address' + "title": "Project Name", + "full_name": "Legal Name", + "email": "Email", + "value": "Requested Funding", + "duration": "Project Duration", + "address": "Address", } data = self.serialize_questions(obj, obj.named_blocks.values()) data = [ { **response, - 'question': meta_questions.get(response['type'], response['question']) + "question": meta_questions.get(response["type"], response["question"]), } for response in data ] @@ -231,7 +256,7 @@ def get_screening(self, obj): all_screening = [] for screening in obj.screening_statuses.values(): - if screening['default']: + if screening["default"]: selected_default = screening else: selected_reasons.append(screening) @@ -242,20 +267,14 @@ def get_screening(self, obj): screening = { "selected_reasons": selected_reasons, "selected_default": selected_default, - "all_screening": all_screening + "all_screening": all_screening, } return screening def get_flags(self, obj): flags = [ - { - "type": 'user', - "selected": obj.flagged_by(self.context['request'].user) - }, - { - "type": 'staff', - "selected": obj.flagged_staff - } + {"type": "user", "selected": obj.flagged_by(self.context["request"].user)}, + {"type": "staff", "selected": obj.flagged_staff}, ] return flags @@ -266,37 +285,37 @@ def get_questions(self, obj): def get_reminders(self, obj): reminders = [] for reminder in obj.reminders.all(): - reminders.append({ - "id": reminder.id, - "submission_id": reminder.submission_id, - "title": reminder.title, - "action_type": reminder.action_type, - "is_expired": reminder.is_expired - }) + reminders.append( + { + "id": reminder.id, + "submission_id": reminder.submission_id, + "title": reminder.title, + "action_type": reminder.action_type, + "is_expired": reminder.is_expired, + } + ) return reminders def get_action_buttons(self, obj): - request = self.context['request'] + request = self.context["request"] add_review = ( - obj.phase.permissions.can_review(request.user) and - obj.can_review(request.user) and not - obj.assigned.draft_reviewed().filter(reviewer=request.user).exists() - ) - show_determination = ( - show_determination_button(request.user, obj) + obj.phase.permissions.can_review(request.user) + and obj.can_review(request.user) + and not obj.assigned.draft_reviewed().filter(reviewer=request.user).exists() ) + show_determination = show_determination_button(request.user, obj) return { - 'add_review': add_review, - 'show_determination_button': show_determination, + "add_review": add_review, + "show_determination_button": show_determination, } class SubmissionActionSerializer(serializers.ModelSerializer): - actions = ActionSerializer(source='*', read_only=True) + actions = ActionSerializer(source="*", read_only=True) class Meta: model = ApplicationSubmission - fields = ('id', 'actions') + fields = ("id", "actions") class RoundLabDetailSerializer(serializers.ModelSerializer): @@ -304,14 +323,11 @@ class RoundLabDetailSerializer(serializers.ModelSerializer): class Meta: model = RoundsAndLabs - fields = ('id', 'title', 'workflow') + fields = ("id", "title", "workflow") def get_workflow(self, obj): return [ - { - 'value': phase.name, - 'display': phase.display_name - } + {"value": phase.name, "display": phase.display_name} for phase in obj.workflow.values() ] @@ -319,7 +335,7 @@ def get_workflow(self, obj): class RoundLabSerializer(serializers.ModelSerializer): class Meta: model = RoundsAndLabs - fields = ('id', 'title') + fields = ("id", "title") class OpenRoundLabSerializer(serializers.ModelSerializer): @@ -332,38 +348,48 @@ class OpenRoundLabSerializer(serializers.ModelSerializer): class Meta: model = RoundsAndLabs - fields = ('id', 'title', 'url_path', 'search_description', 'start_date', 'end_date', - 'description', 'image', 'weight', 'landing_url') + fields = ( + "id", + "title", + "url_path", + "search_description", + "start_date", + "end_date", + "description", + "image", + "weight", + "landing_url", + ) def get_description(self, obj): - if hasattr(obj, 'roundbase'): + if hasattr(obj, "roundbase"): return obj.roundbase.fund.applicationbase.description - elif hasattr(obj, 'labbase'): + elif hasattr(obj, "labbase"): return obj.labbase.description return None def get_image(self, obj): - if hasattr(obj, 'roundbase'): + if hasattr(obj, "roundbase"): fund_image = obj.roundbase.fund.applicationbase.image if fund_image: return fund_image.file.url - elif hasattr(obj, 'labbase'): + elif hasattr(obj, "labbase"): lab_image = obj.labbase.image if lab_image: return lab_image.url return None def get_weight(self, obj): - if hasattr(obj, 'roundbase'): + if hasattr(obj, "roundbase"): return obj.roundbase.fund.applicationbase.weight - elif hasattr(obj, 'labbase'): + elif hasattr(obj, "labbase"): return obj.labbase.weight return None def get_landing_url(self, obj): - if hasattr(obj, 'roundbase'): + if hasattr(obj, "roundbase"): return obj.roundbase.fund.applicationbase.get_full_url() - elif hasattr(obj, 'labbase'): + elif hasattr(obj, "labbase"): return obj.labbase.get_full_url() return None @@ -371,40 +397,61 @@ def get_landing_url(self, obj): class CommentSerializer(serializers.ModelSerializer): user = serializers.StringRelatedField() message = serializers.SerializerMethodField() - edit_url = serializers.HyperlinkedIdentityField(view_name='api:v1:comments-edit') + edit_url = serializers.HyperlinkedIdentityField(view_name="api:v1:comments-edit") editable = serializers.SerializerMethodField() timestamp = TimestampField(read_only=True) edited = TimestampField(read_only=True) class Meta: model = Activity - fields = ('id', 'timestamp', 'user', 'message', 'visibility', 'edited', 'edit_url', 'editable') + fields = ( + "id", + "timestamp", + "user", + "message", + "visibility", + "edited", + "edit_url", + "editable", + ) def get_message(self, obj): return bleach_value(markdown_to_html(obj.message)) def get_editable(self, obj): - return self.context['request'].user == obj.user + return self.context["request"].user == obj.user class CommentCreateSerializer(serializers.ModelSerializer): user = serializers.StringRelatedField() - edit_url = serializers.HyperlinkedIdentityField(view_name='api:v1:comments-edit') + edit_url = serializers.HyperlinkedIdentityField(view_name="api:v1:comments-edit") editable = serializers.SerializerMethodField() timestamp = TimestampField(read_only=True) edited = TimestampField(read_only=True) class Meta: model = Activity - fields = ('id', 'timestamp', 'user', 'message', 'visibility', 'edited', 'edit_url', 'editable') + fields = ( + "id", + "timestamp", + "user", + "message", + "visibility", + "edited", + "edit_url", + "editable", + ) def get_editable(self, obj): - return self.context['request'].user == obj.user + return self.context["request"].user == obj.user class CommentEditSerializer(CommentCreateSerializer): class Meta(CommentCreateSerializer.Meta): - read_only_fields = ('timestamp', 'edited',) + read_only_fields = ( + "timestamp", + "edited", + ) class UserSerializer(serializers.Serializer): diff --git a/hypha/apply/api/v1/stream_serializers.py b/hypha/apply/api/v1/stream_serializers.py index 71f66b14ba..bbc529aac7 100644 --- a/hypha/apply/api/v1/stream_serializers.py +++ b/hypha/apply/api/v1/stream_serializers.py @@ -9,11 +9,10 @@ from .review.fields import ScoredAnswerListField -IGNORE_ARGS = ['self', 'cls'] +IGNORE_ARGS = ["self", "cls"] class WagtailSerializer: - def get_serializer_fields(self, draft=False): """ Get the respective serializer fields for all the form fields. @@ -22,9 +21,7 @@ def get_serializer_fields(self, draft=False): form_fields = self.get_form_fields() for field_id, field in form_fields.items(): serializer_fields[field_id] = self._get_field( - field, - self.get_serializer_field_class(field), - draft + field, self.get_serializer_field_class(field), draft ) return serializer_fields @@ -38,22 +35,22 @@ def _get_field(self, form_field, serializer_field_class, draft=False): for kwarg, value in kwargs.items(): # set corresponding DRF attributes which don't have alternative # in Django form fields - if kwarg == 'required': - field_kwargs['allow_blank'] = not value - field_kwargs['allow_null'] = not value + if kwarg == "required": + field_kwargs["allow_blank"] = not value + field_kwargs["allow_null"] = not value if draft: # Set required false for fields if it's a draft. - field_kwargs['required'] = False - field_kwargs['allow_null'] = True - field_kwargs['allow_blank'] = True + field_kwargs["required"] = False + field_kwargs["allow_null"] = True + field_kwargs["allow_blank"] = True try: field = serializer_field_class(**field_kwargs) except TypeError: # ScoredAnswerField doesn't have allow_blank attribute - field_kwargs.pop('allow_blank') - if serializer_field_class.__name__ == 'ScoredAnswerListField': - field_kwargs['draft'] = True + field_kwargs.pop("allow_blank") + if serializer_field_class.__name__ == "ScoredAnswerListField": + field_kwargs["draft"] = True return serializer_field_class(**field_kwargs) return serializer_field_class(**field_kwargs) @@ -64,7 +61,11 @@ def find_function_args(self, func): Get the list of parameter names which function accepts. """ try: - spec = inspect.getfullargspec(func) if hasattr(inspect, 'getfullargspec') else inspect.getargspec(func) + spec = ( + inspect.getfullargspec(func) + if hasattr(inspect, "getfullargspec") + else inspect.getargspec(func) + ) return [i for i in spec[0] if i not in IGNORE_ARGS] except TypeError: return [] @@ -75,7 +76,7 @@ def find_class_args(self, klass): """ args = set() for i in klass.mro(): - if i is object or not hasattr(i, '__init__'): + if i is object or not hasattr(i, "__init__"): continue args |= set(self.find_function_args(i.__init__)) @@ -83,7 +84,8 @@ def find_class_args(self, klass): def find_matching_class_kwargs(self, reference_object, klass): return { - i: getattr(reference_object, i) for i in self.find_class_args(klass) + i: getattr(reference_object, i) + for i in self.find_class_args(klass) if hasattr(reference_object, i) } @@ -97,25 +99,25 @@ def _get_field_kwargs(self, form_field, serializer_field_class): """ attrs = self.find_matching_class_kwargs(form_field, serializer_field_class) - if 'choices' in attrs: - choices = OrderedDict(attrs['choices']).keys() - attrs['choices'] = OrderedDict(zip(choices, choices, strict=True)) + if "choices" in attrs: + choices = OrderedDict(attrs["choices"]).keys() + attrs["choices"] = OrderedDict(zip(choices, choices, strict=True)) - if getattr(form_field, 'initial', None): - attrs['default'] = form_field.initial + if getattr(form_field, "initial", None): + attrs["default"] = form_field.initial # avoid "May not set both `required` and `default`" - if attrs.get('required') and 'default' in attrs: - del attrs['required'] + if attrs.get("required") and "default" in attrs: + del attrs["required"] if isinstance(form_field, BlockFieldWrapper): - attrs['read_only'] = True + attrs["read_only"] = True return attrs # avoid "May not set both `read_only` and `required`" - if form_field.widget.attrs.get('readonly', False) == 'readonly': - attrs['read_only'] = True - del attrs['required'] + if form_field.widget.attrs.get("readonly", False) == "readonly": + attrs["read_only"] = True + del attrs["required"] return attrs def get_serializer_field_class(self, field): @@ -140,6 +142,16 @@ def get_serializer_class(self, draft=False): # Model serializers needs to have each field declared in the field options # of Meta. This code adds the dynamically generated serializer fields # to the serializer class meta fields. - model_fields = [field for field in self.serializer_class.Meta.fields if hasattr(self.serializer_class.Meta.model, field)] - self.serializer_class.Meta.fields = model_fields + [*self.get_serializer_fields(draft).keys()] - return type('WagtailStreamSerializer', (self.serializer_class,), self.get_serializer_fields(draft)) + model_fields = [ + field + for field in self.serializer_class.Meta.fields + if hasattr(self.serializer_class.Meta.model, field) + ] + self.serializer_class.Meta.fields = model_fields + [ + *self.get_serializer_fields(draft).keys() + ] + return type( + "WagtailStreamSerializer", + (self.serializer_class,), + self.get_serializer_fields(draft), + ) diff --git a/hypha/apply/api/v1/tests/test_serializers.py b/hypha/apply/api/v1/tests/test_serializers.py index 6e2930ba82..2068685be2 100644 --- a/hypha/apply/api/v1/tests/test_serializers.py +++ b/hypha/apply/api/v1/tests/test_serializers.py @@ -9,46 +9,50 @@ from ..serializers import ReviewSummarySerializer -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class TestReviewSummarySerializer(TestCase): def test_handles_no_reviews(self): submission = ApplicationSubmissionFactory() data = ReviewSummarySerializer(submission).data - self.assertEqual(data['count'], 0) - self.assertEqual(data['score'], None) - self.assertEqual(data['recommendation'], {'value': -1, 'display': None}) - self.assertEqual(data['assigned'], []) - self.assertEqual(data['reviews'], []) + self.assertEqual(data["count"], 0) + self.assertEqual(data["score"], None) + self.assertEqual(data["recommendation"], {"value": -1, "display": None}) + self.assertEqual(data["assigned"], []) + self.assertEqual(data["reviews"], []) def test_handles_negative_reviews(self): submission = ApplicationSubmissionFactory() ReviewFactory(submission=submission) data = ReviewSummarySerializer(submission).data - self.assertEqual(data['count'], 1) - self.assertEqual(data['score'], 0) - self.assertEqual(data['recommendation'], {'value': 0, 'display': 'No'}) - self.assertEqual(len(data['assigned']), 1) - self.assertEqual(len(data['reviews']), 1) + self.assertEqual(data["count"], 1) + self.assertEqual(data["score"], 0) + self.assertEqual(data["recommendation"], {"value": 0, "display": "No"}) + self.assertEqual(len(data["assigned"]), 1) + self.assertEqual(len(data["reviews"]), 1) class TestDeliverableSerializer(TestCase): def test_id_is_required(self): - serializer = DeliverableSerializer(data={'quantity': 1}) + serializer = DeliverableSerializer(data={"quantity": 1}) self.assertFalse(serializer.is_valid()) - error_message = {'id': [ErrorDetail(string='This field is required.', code='required')]} + error_message = { + "id": [ErrorDetail(string="This field is required.", code="required")] + } self.assertEqual(serializer.errors, error_message) def test_validate_id(self): - serializer = DeliverableSerializer(data={'id': 1, 'quantity': 1}) + serializer = DeliverableSerializer(data={"id": 1, "quantity": 1}) self.assertFalse(serializer.is_valid()) - error_message = {'id': {'detail': ErrorDetail(string='Not found', code='invalid')}} + error_message = { + "id": {"detail": ErrorDetail(string="Not found", code="invalid")} + } self.assertEqual(serializer.errors, error_message) deliverable = DeliverableFactory() - serializer = DeliverableSerializer(data={'id': deliverable.id, 'quantity': 1}) + serializer = DeliverableSerializer(data={"id": deliverable.id, "quantity": 1}) self.assertTrue(serializer.is_valid()) def test_quantity_not_required(self): deliverable = DeliverableFactory() - serializer = DeliverableSerializer(data={'id': deliverable.id}) + serializer = DeliverableSerializer(data={"id": deliverable.id}) self.assertTrue(serializer.is_valid()) diff --git a/hypha/apply/api/v1/tests/test_views.py b/hypha/apply/api/v1/tests/test_views.py index 4f2b78d506..f8fe382d71 100644 --- a/hypha/apply/api/v1/tests/test_views.py +++ b/hypha/apply/api/v1/tests/test_views.py @@ -25,13 +25,13 @@ ) -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class TestCommentEdit(TestCase): - def post_to_edit(self, comment_pk, message='my message'): + def post_to_edit(self, comment_pk, message="my message"): return self.client.post( - reverse_lazy('api:v1:comments-edit', kwargs={'pk': comment_pk}), + reverse_lazy("api:v1:comments-edit", kwargs={"pk": comment_pk}), secure=True, - data={'message': message}, + data={"message": message}, ) def test_cant_edit_if_not_author(self): @@ -44,7 +44,7 @@ def test_edit_updates_correctly(self): comment = CommentFactory(user=user) self.client.force_login(user) - new_message = 'hi there' + new_message = "hi there" response = self.post_to_edit(comment.pk, new_message) @@ -55,9 +55,9 @@ def test_edit_updates_correctly(self): time = comment.timestamp.timestamp() * 1000 - self.assertEqual(time, response.json()['timestamp']) + self.assertEqual(time, response.json()["timestamp"]) self.assertFalse(comment.current) - self.assertEqual(response.json()['message'], new_message) + self.assertEqual(response.json()["message"], new_message) def test_incorrect_id_denied(self): response = self.post_to_edit(10000) @@ -69,12 +69,13 @@ def test_does_nothing_if_same_message_and_visibility(self): self.client.force_login(user) self.client.post( - reverse_lazy('api:v1:comments-edit', kwargs={'pk': comment.pk}), + reverse_lazy("api:v1:comments-edit", kwargs={"pk": comment.pk}), secure=True, data={ - 'message': comment.message, - 'visibility': comment.visibility, - }) + "message": comment.message, + "visibility": comment.visibility, + }, + ) self.assertEqual(Activity.objects.count(), 1) @@ -84,24 +85,24 @@ def test_staff_can_change_visibility(self): self.client.force_login(user) response = self.client.post( - reverse_lazy('api:v1:comments-edit', kwargs={'pk': comment.pk}), + reverse_lazy("api:v1:comments-edit", kwargs={"pk": comment.pk}), secure=True, data={ - 'message': 'the new message', - 'visibility': ALL, + "message": "the new message", + "visibility": ALL, }, ) self.assertEqual(response.status_code, 200, response.json()) - self.assertEqual(response.json()['visibility'], ALL) + self.assertEqual(response.json()["visibility"], ALL) def test_out_of_order_does_nothing(self): user = ApplicantFactory() # any role assigned user comment = CommentFactory(user=user) self.client.force_login(user) - new_message = 'hi there' - newer_message = 'hello there' + new_message = "hi there" + newer_message = "hello there" response_one = self.post_to_edit(comment.pk, new_message) response_two = self.post_to_edit(comment.pk, newer_message) @@ -111,19 +112,28 @@ def test_out_of_order_does_nothing(self): self.assertEqual(Activity.objects.count(), 2) -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class TestInvoiceDeliverableViewset(TestCase): def post_to_add(self, project_id, invoice_id, deliverable_id, quantity=1): return self.client.post( - reverse_lazy('api:v1:set-deliverables', kwargs={'project_pk': project_id, 'invoice_pk': invoice_id}), + reverse_lazy( + "api:v1:set-deliverables", + kwargs={"project_pk": project_id, "invoice_pk": invoice_id}, + ), secure=True, - data={'id': deliverable_id, 'quantity': quantity}, + data={"id": deliverable_id, "quantity": quantity}, ) def delete_to_remove(self, project_id, invoice_id, deliverable_id): return self.client.delete( - reverse_lazy('api:v1:remove-deliverables', kwargs={ - 'project_pk': project_id, 'invoice_pk': invoice_id, 'pk': deliverable_id}), + reverse_lazy( + "api:v1:remove-deliverables", + kwargs={ + "project_pk": project_id, + "invoice_pk": invoice_id, + "pk": deliverable_id, + }, + ), secure=True, ) @@ -265,7 +275,9 @@ def test_deliverables_cant_removed_after_finance2_approval(self): staff = StaffFactory() for user in [staff, finance1, finance2]: self.client.force_login(user) - response = self.delete_to_remove(project.id, invoice.id, invoice_deliverable.id) + response = self.delete_to_remove( + project.id, invoice.id, invoice_deliverable.id + ) self.assertEqual(response.status_code, 403) def test_deliverable_dont_exists_in_project_deliverables(self): @@ -277,7 +289,7 @@ def test_deliverable_dont_exists_in_project_deliverables(self): response = self.post_to_add(project.id, invoice.id, deliverable.id) self.assertEqual(response.status_code, 400) - error_message = {'detail': ErrorDetail(string='Not Found', code='invalid')} + error_message = {"detail": ErrorDetail(string="Not Found", code="invalid")} self.assertEqual(response.data, error_message) def test_deliverable_already_exists_in_invoice(self): @@ -291,7 +303,11 @@ def test_deliverable_already_exists_in_invoice(self): response = self.post_to_add(project.id, invoice.id, deliverable.id) self.assertEqual(response.status_code, 400) - error_message = {'detail': ErrorDetail(string='Invoice Already has this deliverable', code='invalid')} + error_message = { + "detail": ErrorDetail( + string="Invoice Already has this deliverable", code="invalid" + ) + } self.assertEqual(response.data, error_message) def test_deliverable_available_gte_quantity(self): @@ -303,5 +319,9 @@ def test_deliverable_available_gte_quantity(self): response = self.post_to_add(project.id, invoice.id, deliverable.id, quantity=3) self.assertEqual(response.status_code, 400) - error_message = {'detail': ErrorDetail(string='Required quantity is more than available', code='invalid')} + error_message = { + "detail": ErrorDetail( + string="Required quantity is more than available", code="invalid" + ) + } self.assertEqual(response.data, error_message) diff --git a/hypha/apply/api/v1/urls.py b/hypha/apply/api/v1/urls.py index 81d72dbb2e..c9b82e4cdc 100644 --- a/hypha/apply/api/v1/urls.py +++ b/hypha/apply/api/v1/urls.py @@ -21,29 +21,51 @@ SubmissionViewSet, ) -app_name = 'v1' +app_name = "v1" router = routers.SimpleRouter() -router.register(r'submissions', SubmissionViewSet, basename='submissions') -router.register(r'comments', CommentViewSet, basename='comments') -router.register(r'rounds', RoundViewSet, basename='rounds') -router.register(r'screening_statuses', ScreeningStatusViewSet, basename='screenings') -router.register(r'meta_terms', MetaTermsViewSet, basename='meta-terms') - -submission_router = routers.NestedSimpleRouter(router, r'submissions', lookup='submission') -submission_router.register(r'actions', SubmissionActionViewSet, basename='submission-actions') -submission_router.register(r'comments', SubmissionCommentViewSet, basename='submission-comments') -submission_router.register(r'reviews', SubmissionReviewViewSet, basename='reviews') -submission_router.register(r'determinations', SubmissionDeterminationViewSet, basename='determinations') -submission_router.register(r'screening_statuses', SubmissionScreeningStatusViewSet, basename='submission-screening_statuses') -submission_router.register(r'reminders', SubmissionReminderViewSet, basename='submission-reminder') +router.register(r"submissions", SubmissionViewSet, basename="submissions") +router.register(r"comments", CommentViewSet, basename="comments") +router.register(r"rounds", RoundViewSet, basename="rounds") +router.register(r"screening_statuses", ScreeningStatusViewSet, basename="screenings") +router.register(r"meta_terms", MetaTermsViewSet, basename="meta-terms") + +submission_router = routers.NestedSimpleRouter( + router, r"submissions", lookup="submission" +) +submission_router.register( + r"actions", SubmissionActionViewSet, basename="submission-actions" +) +submission_router.register( + r"comments", SubmissionCommentViewSet, basename="submission-comments" +) +submission_router.register(r"reviews", SubmissionReviewViewSet, basename="reviews") +submission_router.register( + r"determinations", SubmissionDeterminationViewSet, basename="determinations" +) +submission_router.register( + r"screening_statuses", + SubmissionScreeningStatusViewSet, + basename="submission-screening_statuses", +) +submission_router.register( + r"reminders", SubmissionReminderViewSet, basename="submission-reminder" +) urlpatterns = [ - path('user/', CurrentUser.as_view(), name='user'), - path('submissions_filter/', SubmissionFilters.as_view(), name='submissions-filter'), - path('projects//invoices//deliverables/', InvoiceDeliverableViewSet.as_view({'post': 'create'}), name='set-deliverables'), - path('projects//invoices//deliverables//', InvoiceDeliverableViewSet.as_view({'delete': 'destroy'}), name='remove-deliverables'), + path("user/", CurrentUser.as_view(), name="user"), + path("submissions_filter/", SubmissionFilters.as_view(), name="submissions-filter"), + path( + "projects//invoices//deliverables/", + InvoiceDeliverableViewSet.as_view({"post": "create"}), + name="set-deliverables", + ), + path( + "projects//invoices//deliverables//", + InvoiceDeliverableViewSet.as_view({"delete": "destroy"}), + name="remove-deliverables", + ), ] urlpatterns = router.urls + submission_router.urls + urlpatterns diff --git a/hypha/apply/api/v1/utils.py b/hypha/apply/api/v1/utils.py index 203a6fb7a5..f6af1638d1 100644 --- a/hypha/apply/api/v1/utils.py +++ b/hypha/apply/api/v1/utils.py @@ -15,84 +15,88 @@ def get_field_kwargs(form_field): if isinstance(form_field, BlockFieldWrapper): - return {'text': form_field.block.value.source} + return {"text": form_field.block.value.source} kwargs = OrderedDict() kwargs = { - 'initial': form_field.initial, - 'required': form_field.required, - 'label': form_field.label, - 'label_suffix': form_field.label_suffix, - 'help_text': form_field.help_text, - 'help_link': form_field.help_link + "initial": form_field.initial, + "required": form_field.required, + "label": form_field.label, + "label_suffix": form_field.label_suffix, + "help_text": form_field.help_text, + "help_link": form_field.help_link, } if isinstance(form_field, forms.CharField): - if hasattr(form_field, 'word_limit'): - kwargs['word_limit'] = form_field.word_limit - kwargs['max_length'] = form_field.max_length - kwargs['min_length'] = form_field.min_length - kwargs['empty_value'] = form_field.empty_value + if hasattr(form_field, "word_limit"): + kwargs["word_limit"] = form_field.word_limit + kwargs["max_length"] = form_field.max_length + kwargs["min_length"] = form_field.min_length + kwargs["empty_value"] = form_field.empty_value if isinstance(form_field, forms.ChoiceField): - kwargs['choices'] = form_field.choices + kwargs["choices"] = form_field.choices if isinstance(form_field, forms.TypedChoiceField): - kwargs['empty_value'] = form_field.empty_value + kwargs["empty_value"] = form_field.empty_value if isinstance(form_field, forms.IntegerField): - kwargs['max_value'] = form_field.max_value - kwargs['min_value'] = form_field.min_value + kwargs["max_value"] = form_field.max_value + kwargs["min_value"] = form_field.min_value if isinstance(form_field, ScoredAnswerField): fields = [ { - 'type': form_field.fields[0].__class__.__name__, - 'max_length': form_field.fields[0].max_length, - 'min_length': form_field.fields[0].min_length, - 'empty_value': form_field.fields[0].empty_value + "type": form_field.fields[0].__class__.__name__, + "max_length": form_field.fields[0].max_length, + "min_length": form_field.fields[0].min_length, + "empty_value": form_field.fields[0].empty_value, }, { - 'type': form_field.fields[1].__class__.__name__, - 'choices': form_field.fields[1].choices, + "type": form_field.fields[1].__class__.__name__, + "choices": form_field.fields[1].choices, }, ] - kwargs['fields'] = fields + kwargs["fields"] = fields return kwargs def get_field_widget(form_field): if isinstance(form_field, BlockFieldWrapper): - return {'type': 'LoadHTML', 'attrs': {}} + return {"type": "LoadHTML", "attrs": {}} widget = { - 'type': form_field.widget.__class__.__name__, - 'attrs': form_field.widget.attrs + "type": form_field.widget.__class__.__name__, + "attrs": form_field.widget.attrs, } if isinstance(form_field.widget, TinyMCE): mce_attrs = form_field.widget.mce_attrs - plugins = mce_attrs.get('plugins') + plugins = mce_attrs.get("plugins") if not isinstance(plugins, list): - mce_attrs['plugins'] = [plugins] - if 'toolbar1' in mce_attrs: - mce_attrs['toolbar'] = mce_attrs.pop('toolbar1') - widget['mce_attrs'] = mce_attrs + mce_attrs["plugins"] = [plugins] + if "toolbar1" in mce_attrs: + mce_attrs["toolbar"] = mce_attrs.pop("toolbar1") + widget["mce_attrs"] = mce_attrs if isinstance(form_field.widget, ScoredAnswerWidget): field_widgets = form_field.widget.widgets widgets = [ { - 'type': field_widgets[0].__class__.__name__, - 'attrs': field_widgets[0].attrs, - 'mce_attrs': field_widgets[0].mce_attrs + "type": field_widgets[0].__class__.__name__, + "attrs": field_widgets[0].attrs, + "mce_attrs": field_widgets[0].mce_attrs, }, { - 'type': field_widgets[1].__class__.__name__, - 'attrs': field_widgets[1].attrs, - } + "type": field_widgets[1].__class__.__name__, + "attrs": field_widgets[1].attrs, + }, ] - widget['widgets'] = widgets + widget["widgets"] = widgets return widget def get_round_leads(): return User.objects.filter(submission_lead__isnull=False).distinct() + def get_screening_statuses(): return ScreeningStatus.objects.filter( - id__in=ApplicationSubmission.objects.all().values('screening_statuses__id').distinct('screening_statuses__id')) + id__in=ApplicationSubmission.objects.all() + .values("screening_statuses__id") + .distinct("screening_statuses__id") + ) def get_used_rounds(): @@ -105,6 +109,4 @@ def get_used_funds(): def get_category_options(): - return Option.objects.filter( - category__filter_on_dashboard=True - ) + return Option.objects.filter(category__filter_on_dashboard=True) diff --git a/hypha/apply/api/v1/views.py b/hypha/apply/api/v1/views.py index c3789cbf0c..e5f7280120 100644 --- a/hypha/apply/api/v1/views.py +++ b/hypha/apply/api/v1/views.py @@ -49,41 +49,46 @@ class SubmissionViewSet(viewsets.ReadOnlyModelViewSet, viewsets.GenericViewSet): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) filter_backends = (filters.DjangoFilterBackend,) filter_class = SubmissionsFilter pagination_class = StandardResultsSetPagination def get_serializer_class(self): - if self.action == 'list': + if self.action == "list": return SubmissionListSerializer return SubmissionDetailSerializer def get_queryset(self): - if self.action == 'list': - return ApplicationSubmission.objects.exclude_draft().current().with_latest_update() + if self.action == "list": + return ( + ApplicationSubmission.objects.exclude_draft() + .current() + .with_latest_update() + ) return ApplicationSubmission.objects.exclude_draft().prefetch_related( - Prefetch('reviews', Review.objects.submitted()), + Prefetch("reviews", Review.objects.submitted()), ) - @action(detail=True, methods=['put']) + @action(detail=True, methods=["put"]) def set_summary(self, request, pk=None): submission = self.get_object() serializer = SubmissionSummarySerializer(data=request.data) serializer.is_valid(raise_exception=True) - summary = serializer.validated_data['summary'] + summary = serializer.validated_data["summary"] submission.summary = summary - submission.save(update_fields=['summary']) + submission.save(update_fields=["summary"]) serializer = self.get_serializer(submission) return Response(serializer.data) - @action(detail=True, methods=['post']) + @action(detail=True, methods=["post"]) def meta_terms(self, request, pk=None): submission = self.get_object() serializer = SubmissionMetaTermsSerializer(data=request.data) serializer.is_valid(raise_exception=True) - meta_terms_ids = serializer.validated_data['meta_terms'] + meta_terms_ids = serializer.validated_data["meta_terms"] submission.meta_terms.set(meta_terms_ids) serializer = self.get_serializer(submission) return Response(serializer.data) @@ -91,63 +96,100 @@ def meta_terms(self, request, pk=None): class SubmissionFilters(APIView): permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) def filter_unique_options(self, options): - unique_items = [dict(item) for item in {tuple(option.items()) for option in options}] + unique_items = [ + dict(item) for item in {tuple(option.items()) for option in options} + ] return list(filter(lambda x: len(x.get("label")), unique_items)) def format(self, filterKey, label, options): if label == "Screenings": options.insert(0, {"key": None, "label": "No Screening"}) - return { - "filterKey": filterKey, - "label": label, - "options": options - } + return {"filterKey": filterKey, "label": label, "options": options} def get(self, request, format=None): filter_options = [ - self.format("fund", "Funds", [ - {"key": fund.get("id"), "label": fund.get("title")} - for fund in get_used_funds().values() - ]), - self.format("round", "Rounds", [ - {"key": round.get("id"), "label": round.get("title")} - for round in get_used_rounds().values() - ]), - self.format("status", "Statuses", [ - {'key': list(STATUSES.get(label)), 'label': label} - for label in dict(STATUSES) - ]), - self.format("screening_statuses", "Screenings", self.filter_unique_options([ - {"key": screening.get("id"), "label": screening.get("title")} - for screening in get_screening_statuses().values() - ])), - self.format("lead", "Leads", [ - {"key": lead.get('id'), "label": lead.get('full_name') or lead.get('email')} - for lead in get_round_leads().values() - ]), - self.format("reviewers", "Reviewers", self.filter_unique_options([ - {"key": reviewer.get('id'), "label": reviewer.get('full_name') or reviewer.get('email')} - for reviewer in get_all_reviewers().values() - ])), - self.format("category_options", "Category", self.filter_unique_options([ - {"key": option.get('id'), "label": option.get('value')} - for option in get_category_options().values() - ])), + self.format( + "fund", + "Funds", + [ + {"key": fund.get("id"), "label": fund.get("title")} + for fund in get_used_funds().values() + ], + ), + self.format( + "round", + "Rounds", + [ + {"key": round.get("id"), "label": round.get("title")} + for round in get_used_rounds().values() + ], + ), + self.format( + "status", + "Statuses", + [ + {"key": list(STATUSES.get(label)), "label": label} + for label in dict(STATUSES) + ], + ), + self.format( + "screening_statuses", + "Screenings", + self.filter_unique_options( + [ + {"key": screening.get("id"), "label": screening.get("title")} + for screening in get_screening_statuses().values() + ] + ), + ), + self.format( + "lead", + "Leads", + [ + { + "key": lead.get("id"), + "label": lead.get("full_name") or lead.get("email"), + } + for lead in get_round_leads().values() + ], + ), + self.format( + "reviewers", + "Reviewers", + self.filter_unique_options( + [ + { + "key": reviewer.get("id"), + "label": reviewer.get("full_name") or reviewer.get("email"), + } + for reviewer in get_all_reviewers().values() + ] + ), + ), + self.format( + "category_options", + "Category", + self.filter_unique_options( + [ + {"key": option.get("id"), "label": option.get("value")} + for option in get_category_options().values() + ] + ), + ), ] return Response(filter_options) -class SubmissionActionViewSet( - SubmissionNestedMixin, - viewsets.GenericViewSet -): +class SubmissionActionViewSet(SubmissionNestedMixin, viewsets.GenericViewSet): serializer_class = SubmissionActionSerializer permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) def get_object(self): @@ -174,54 +216,62 @@ def create(self, request, *args, **kwargs): {"action": "internal_review"} ``` """ - action = request.data.get('action') + action = request.data.get("action") if not action: - raise ValidationError('Action must be provided.') + raise ValidationError("Action must be provided.") obj = self.get_object() - redirect = DeterminationCreateOrUpdateView.should_redirect( - request, obj, action) + redirect = DeterminationCreateOrUpdateView.should_redirect(request, obj, action) if redirect: - raise NotFound({ - 'detail': 'The action should be performed at the determination view', - 'target': redirect.url, - }) + raise NotFound( + { + "detail": "The action should be performed at the determination view", + "target": redirect.url, + } + ) try: obj.perform_transition(action, self.request.user, request=self.request) except DjangoPermissionDenied as e: raise PermissionDenied(str(e)) from e # refresh_from_db() raises errors for particular actions. obj = self.get_object() - serializer = SubmissionDetailSerializer(obj, context={ - 'request': request, - }) - return Response({ - 'id': serializer.data['id'], - 'status': serializer.data['status'], - 'actions': serializer.data['actions'], - 'phase': serializer.data['phase'], - }) + serializer = SubmissionDetailSerializer( + obj, + context={ + "request": request, + }, + ) + return Response( + { + "id": serializer.data["id"], + "status": serializer.data["status"], + "actions": serializer.data["actions"], + "phase": serializer.data["phase"], + } + ) class RoundViewSet( - mixins.RetrieveModelMixin, - mixins.ListModelMixin, - viewsets.GenericViewSet + mixins.RetrieveModelMixin, mixins.ListModelMixin, viewsets.GenericViewSet ): queryset = RoundsAndLabs.objects.all() serializer_class = RoundLabSerializer permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) permission_classes_by_action = { - 'open': [HasAPIKey | permissions.IsAuthenticated, HasAPIKey | IsApplyStaffUser, ], + "open": [ + HasAPIKey | permissions.IsAuthenticated, + HasAPIKey | IsApplyStaffUser, + ], } pagination_class = StandardResultsSetPagination def get_serializer_class(self): - if self.action == 'list': + if self.action == "list": return RoundLabSerializer - elif self.action == 'open': + elif self.action == "open": return OpenRoundLabSerializer return RoundLabDetailSerializer @@ -232,12 +282,15 @@ def get_object(self): def get_permissions(self): try: # return permission_classes depending on `action` - return [permission() for permission in self.permission_classes_by_action[self.action]] + return [ + permission() + for permission in self.permission_classes_by_action[self.action] + ] except KeyError: # action is not set return default permission_classes return [permission() for permission in self.permission_classes] - @action(methods=['get'], detail=False) + @action(methods=["get"], detail=False) def open(self, request): queryset = RoundsAndLabs.objects.open() page = self.paginate_queryset(queryset) @@ -252,24 +305,29 @@ class SubmissionCommentViewSet( SubmissionNestedMixin, mixins.ListModelMixin, mixins.CreateModelMixin, - viewsets.GenericViewSet + viewsets.GenericViewSet, ): """ List all the comments on a submission. """ - queryset = Activity.comments.all().select_related('user') + + queryset = Activity.comments.all().select_related("user") serializer_class = CommentCreateSerializer permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) filter_backends = (filters.DjangoFilterBackend,) filter_class = CommentFilter pagination_class = StandardResultsSetPagination def get_queryset(self): - return super().get_queryset().filter( - submission=self.get_submission_object() - ).visible_to(self.request.user) + return ( + super() + .get_queryset() + .filter(submission=self.get_submission_object()) + .visible_to(self.request.user) + ) def perform_create(self, serializer): """ @@ -279,7 +337,7 @@ def perform_create(self, serializer): timestamp=timezone.now(), type=COMMENT, user=self.request.user, - source=self.get_submission_object() + source=self.get_submission_object(), ) messenger( MESSAGES.COMMENT, @@ -291,27 +349,26 @@ def perform_create(self, serializer): class CommentViewSet( - mixins.ListModelMixin, - viewsets.GenericViewSet, + mixins.ListModelMixin, + viewsets.GenericViewSet, ): """ Edit a comment. """ - queryset = Activity.comments.all().select_related('user') + + queryset = Activity.comments.all().select_related("user") serializer_class = CommentEditSerializer - permission_classes = ( - permissions.IsAuthenticated, IsAuthor - ) + permission_classes = (permissions.IsAuthenticated, IsAuthor) def get_serializer_class(self): - if self.action == 'list': + if self.action == "list": return CommentSerializer return CommentEditSerializer def get_queryset(self): return super().get_queryset().visible_to(self.request.user) - @action(detail=True, methods=['post']) + @action(detail=True, methods=["post"]) def edit(self, request, *args, **kwargs): return self.edit_comment(request, *args, **kwargs) @@ -327,7 +384,9 @@ def edit_comment(self, request, *args, **kwargs): serializer = self.get_serializer(comment_to_edit, data=request.data) serializer.is_valid(raise_exception=True) - if (serializer.validated_data['message'] != comment_to_update.message) or (serializer.validated_data['visibility'] != comment_to_update.visibility): + if (serializer.validated_data["message"] != comment_to_update.message) or ( + serializer.validated_data["visibility"] != comment_to_update.visibility + ): self.perform_create(serializer) comment_to_update.current = False comment_to_update.save() @@ -351,8 +410,10 @@ class MetaTermsViewSet(mixins.ListModelMixin, viewsets.GenericViewSet): """ List all the Meta Terms """ + queryset = MetaTerm.get_root_nodes() serializer_class = MetaTermsSerializer permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + permissions.IsAuthenticated, + IsApplyStaffUser, ) diff --git a/hypha/apply/categories/admin.py b/hypha/apply/categories/admin.py index 11a95bd9ca..42f674f5f7 100644 --- a/hypha/apply/categories/admin.py +++ b/hypha/apply/categories/admin.py @@ -7,27 +7,27 @@ class CategoryAdmin(ModelAdmin): - menu_label = 'Category Questions' - menu_icon = 'list-ul' + menu_label = "Category Questions" + menu_icon = "list-ul" model = Category class MetaTermAdmin(ModelAdmin): model = MetaTerm - menu_icon = 'tag' + menu_icon = "tag" list_per_page = 50 - list_display = ('get_as_listing_header', 'get_parent') - search_fields = ('name',) + list_display = ("get_as_listing_header", "get_parent") + search_fields = ("name",) inspect_view_enabled = True - inspect_view_fields = ('name', 'get_parent', 'id') + inspect_view_fields = ("name", "get_parent", "id") button_helper_class = MetaTermButtonHelper def add_child_view(self, request, instance_pk): - kwargs = {'model_admin': self, 'parent_pk': instance_pk} + kwargs = {"model_admin": self, "parent_pk": instance_pk} view_class = AddChildMetaTermViewClass return view_class.as_view(**kwargs)(request) @@ -35,8 +35,8 @@ def get_admin_urls_for_registration(self): """Add the new url for add child page to the registered URLs.""" urls = super().get_admin_urls_for_registration() add_child_url = re_path( - self.url_helper.get_action_url_pattern('add_child'), + self.url_helper.get_action_url_pattern("add_child"), self.add_child_view, - name=self.url_helper.get_action_url_name('add_child') + name=self.url_helper.get_action_url_name("add_child"), ) - return urls + (add_child_url, ) + return urls + (add_child_url,) diff --git a/hypha/apply/categories/admin_helpers.py b/hypha/apply/categories/admin_helpers.py index 7ea66869ad..addea237ab 100644 --- a/hypha/apply/categories/admin_helpers.py +++ b/hypha/apply/categories/admin_helpers.py @@ -19,21 +19,24 @@ def prepare_classnames(self, start=None, add=None, exclude=None): def add_child_button(self, pk, child_verbose_name, **kwargs): """Build a add child button, to easily add a child under meta term.""" instance = self.model.objects.get(pk=pk) - if instance.is_archived or instance.get_parent() and instance.get_parent().is_archived: + if ( + instance.is_archived + or instance.get_parent() + and instance.get_parent().is_archived + ): return classnames = self.prepare_classnames( - start=self.edit_button_classnames + ['icon', 'icon-plus'], - add=kwargs.get('classnames_add'), - exclude=kwargs.get('classnames_exclude') + start=self.edit_button_classnames + ["icon", "icon-plus"], + add=kwargs.get("classnames_add"), + exclude=kwargs.get("classnames_exclude"), ) return { - 'classname': classnames, - 'label': 'Add %s %s' % ( - child_verbose_name, self.verbose_name), - 'title': 'Add %s %s under this one' % ( - child_verbose_name, self.verbose_name), - 'url': self.url_helper.get_action_url('add_child', quote(pk)), + "classname": classnames, + "label": "Add %s %s" % (child_verbose_name, self.verbose_name), + "title": "Add %s %s under this one" + % (child_verbose_name, self.verbose_name), + "url": self.url_helper.get_action_url("add_child", quote(pk)), } def get_buttons_for_obj(self, obj, exclude=None, *args, **kwargs): diff --git a/hypha/apply/categories/admin_views.py b/hypha/apply/categories/admin_views.py index 96c6f96955..2a4e9d3926 100644 --- a/hypha/apply/categories/admin_views.py +++ b/hypha/apply/categories/admin_views.py @@ -19,12 +19,12 @@ def __init__(self, model_admin, parent_pk): def get_page_title(self): """Generate a title that explains you are adding a child.""" title = super().get_page_title() - return title + ' %s %s for %s' % ( + return title + " %s %s for %s" % ( self.model.node_child_verbose_name, self.opts.verbose_name, - self.parent_instance + self.parent_instance, ) def get_initial(self): """Set the selected parent field to the parent_pk.""" - return {'parent': self.parent_pk} + return {"parent": self.parent_pk} diff --git a/hypha/apply/categories/apps.py b/hypha/apply/categories/apps.py index 1d9503e06d..4b4114a236 100644 --- a/hypha/apply/categories/apps.py +++ b/hypha/apply/categories/apps.py @@ -2,4 +2,4 @@ class CategoriesConfig(AppConfig): - name = 'hypha.apply.categories' + name = "hypha.apply.categories" diff --git a/hypha/apply/categories/blocks.py b/hypha/apply/categories/blocks.py index 91da656622..e40ea4d944 100644 --- a/hypha/apply/categories/blocks.py +++ b/hypha/apply/categories/blocks.py @@ -20,21 +20,21 @@ def get_categories_as_choices(): class CategoryQuestionBlock(OptionalFormFieldBlock): class Meta: - template = 'stream_forms/render_list_field.html' + template = "stream_forms/render_list_field.html" category = ModelChooserBlock(required=True, choices=get_categories_as_choices) - multi = BooleanBlock(label=_('Multi select'), required=False) + multi = BooleanBlock(label=_("Multi select"), required=False) # Overwrite field label and help text so we can defer to the category # as required field_label = CharBlock( - label=_('Label'), + label=_("Label"), required=False, - help_text=_('Leave blank to use the default Category label'), + help_text=_("Leave blank to use the default Category label"), ) help_text = TextBlock( - label=_('Help text'), + label=_("Help text"), required=False, - help_text=_('Leave blank to use the default Category help text'), + help_text=_("Leave blank to use the default Category help text"), ) @cached_property @@ -45,10 +45,10 @@ def get_instance(self, id): return self.model_class.objects.get(id=id) def get_field_class(self, struct_value): - return forms.MultipleChoiceField if struct_value['multi'] else forms.ChoiceField + return forms.MultipleChoiceField if struct_value["multi"] else forms.ChoiceField def use_defaults_from_category(self, kwargs, category): - category_fields = {'label': 'name', 'help_text': 'help_text'} + category_fields = {"label": "name", "help_text": "help_text"} for field in category_fields.keys(): if not kwargs.get(field): @@ -58,15 +58,15 @@ def use_defaults_from_category(self, kwargs, category): def get_field_kwargs(self, struct_value): kwargs = super().get_field_kwargs(struct_value) - category = self.get_instance(id=struct_value['category']) + category = self.get_instance(id=struct_value["category"]) kwargs = self.use_defaults_from_category(kwargs, category) - choices = category.options.values_list('id', 'value') - kwargs.update({'choices': choices}) + choices = category.options.values_list("id", "value") + kwargs.update({"choices": choices}) return kwargs def get_widget(self, struct_value): - if struct_value['multi']: - category = self.get_instance(id=struct_value['category']) + if struct_value["multi"]: + category = self.get_instance(id=struct_value["category"]) category_size = category.options.count() # Pick widget according to number of options to maintain good usability. if category_size < 32: @@ -81,17 +81,17 @@ def prepare_data(self, value, data, serialize): return data if isinstance(data, str): data = [data] - category = self.get_instance(id=value['category']) - data = category.options.filter(id__in=data).values_list('value', flat=True) + category = self.get_instance(id=value["category"]) + data = category.options.filter(id__in=data).values_list("value", flat=True) return data def render(self, value, context): # Overwriting field_label and help_text with default for empty values - category_fields = {'field_label': 'name', 'help_text': 'help_text'} + category_fields = {"field_label": "name", "help_text": "help_text"} for field in category_fields.keys(): if not value.get(field): - category = value['category'] + category = value["category"] if isinstance(category, int): category = self.get_instance(id=category) value[field] = getattr(category, category_fields[field]) @@ -101,4 +101,4 @@ def get_searchable_content(self, value, data): return None def no_response(self): - return '-' + return "-" diff --git a/hypha/apply/categories/categories_seed.py b/hypha/apply/categories/categories_seed.py index 05ce50a177..ee7fb2994a 100644 --- a/hypha/apply/categories/categories_seed.py +++ b/hypha/apply/categories/categories_seed.py @@ -3,1621 +3,429 @@ { "category": "Addressed problems", "name": "Restrictive Internet filtering by technical methods (IP blocking, DNS filtering, TCP RST, DPI, etc.)", - "tid": "318" + "tid": "318", }, { "category": "Addressed problems", "name": "Blocking, filtering, or modification of political, social, and/or religious content (including apps)", - "tid": "319" + "tid": "319", }, { "category": "Addressed problems", "name": "Technical attacks against government critics, journalists, and/or human rights organizations (Cyberattacks)", - "tid": "351" + "tid": "351", }, { "category": "Addressed problems", "name": "Localized or nationwide communications shut down or throttling (Blackouts)", - "tid": "320" + "tid": "320", }, { "category": "Addressed problems", "name": "Physical intimidation, arrest, violence (including device seizure or destruction), and death for political or social reasons", - "tid": "354" + "tid": "354", }, { "category": "Addressed problems", "name": "Pro-government manipulation of online discussions (propaganda, imitation content, and/or sockpuppets)", - "tid": "353" + "tid": "353", }, { "category": "Addressed problems", "name": "Repressive surveillance or monitoring of communication", - "tid": "321" + "tid": "321", }, { "category": "Addressed problems", "name": "Policies, laws, or directives that increase surveillance, censorship, and punishment", - "tid": "352" + "tid": "352", }, { "category": "Addressed problems", "name": "Government practices that hold intermediaries (social networks or ISPs) liable for user content", - "tid": "355" + "tid": "355", }, { "category": "Addressed problems", "name": "Prohibitive cost to access the Internet", - "tid": "357" + "tid": "357", }, + {"category": "Addressed problems", "name": "Other", "tid": "327"}, + {"category": "Focus", "name": "Access to the Internet", "tid": "2"}, { - "category": "Addressed problems", - "name": "Other", - "tid": "327" - }, - { - "category": "Focus", - "name": "Access to the Internet", - "tid": "2" - }, - { - "category": "Focus", - "name": "Awareness of privacy and security threats", - "tid": "363" - }, - { - "category": "Focus", - "name": "Privacy enhancement", - "tid": "3" - }, - { - "category": "Focus", - "name": "Security from danger or threat online", - "tid": "1" - }, - { - "category": "Objective(s)", - "name": "Deploying technology", - "tid": "362" - }, - { - "category": "Objective(s)", - "name": "Software or hardware development", - "tid": "360" - }, - { - "category": "Objective(s)", - "name": "Testing", - "tid": "333" - }, - { - "category": "Objective(s)", - "name": "Research", - "tid": "361" - }, - { - "category": "Objective(s)", - "name": "Technology development", - "tid": "330" - }, - { - "category": "Objective(s)", - "name": "Training", - "tid": "331" - }, - { - "category": "Beneficiaries", - "name": "General public", - "tid": "335" - }, - { - "category": "Beneficiaries", - "name": "Women", - "tid": "342" - }, - { - "category": "Beneficiaries", - "name": "Youth", - "tid": "343" - }, - { - "category": "Beneficiaries", - "name": "Sexual minorities", - "tid": "345" - }, - { - "category": "Beneficiaries", - "name": "Ethnic minorities", - "tid": "344" - }, - { - "category": "Beneficiaries", - "name": "Activists", - "tid": "336" - }, - { - "category": "Beneficiaries", - "name": "Journalists", - "tid": "337" - }, - { - "category": "Beneficiaries", - "name": "Advocacy groups/NGOs", - "tid": "338" - }, - { - "category": "Beneficiaries", - "name": "Academia", - "tid": "339" - }, - { - "category": "Beneficiaries", - "name": "Technologists", - "tid": "340" - }, - { - "category": "Beneficiaries", - "name": "Entrepreneurs", - "tid": "359" - }, - { - "category": "Beneficiaries", - "name": "Government", - "tid": "341" - }, - { - "category": "Beneficiaries", - "name": "Other", - "tid": "350" - }, - { - "category": "Region(s)", - "name": "Global", - "tid": "271" - }, - { - "category": "Region(s)", - "name": "North Africa and Middle east", - "tid": "358" - }, - { - "category": "Region(s)", - "name": "East Africa", - "tid": "369" - }, - { - "category": "Region(s)", - "name": "West Africa", - "tid": "370" - }, - { - "category": "Region(s)", - "name": "South Africa", - "tid": "272" - }, - { - "category": "Region(s)", - "name": "North Asia and Russia", - "tid": "371" - }, - { - "category": "Region(s)", - "name": "Central Asia", - "tid": "274" - }, - { - "category": "Region(s)", - "name": "East Asia", - "tid": "372" - }, - { - "category": "Region(s)", - "name": "South Asia", - "tid": "373" - }, - { - "category": "Region(s)", - "name": "South-East Asia", - "tid": "365" - }, - { - "category": "Region(s)", - "name": "Eastern Europe", - "tid": "291" - }, - { - "category": "Region(s)", - "name": "Central America", - "tid": "273" - }, - { - "category": "Region(s)", - "name": "Caribbean", - "tid": "374" - }, - { - "category": "Region(s)", - "name": "Andean", - "tid": "375" - }, - { - "category": "Region(s)", - "name": "Southern cone", - "tid": "376" - }, - { - "category": "Project status", - "name": "Just an Idea (Pre-alpha)", - "tid": "329" - }, - { - "category": "Project status", - "name": "It Exists! (Alpha/Beta)", - "tid": "328" - }, - { - "category": "Project status", - "name": "It's basically done. (Release)", - "tid": "366" - }, - { - "category": "Project status", - "name": "People Use It. (Production)", - "tid": "367" - }, - { - "tid": "6", - "name": "Afghanistan", - "category": "Countries" - }, - { - "tid": "7", - "name": "Aland Islands", - "category": "Countries" - }, - { - "tid": "8", - "name": "Albania", - "category": "Countries" - }, - { - "tid": "9", - "name": "Algeria", - "category": "Countries" - }, - { - "tid": "10", - "name": "American Samoa", - "category": "Countries" - }, - { - "tid": "11", - "name": "Andorra", - "category": "Countries" - }, - { - "tid": "12", - "name": "Angola", - "category": "Countries" - }, - { - "tid": "13", - "name": "Anguilla", - "category": "Countries" - }, - { - "tid": "14", - "name": "Antarctica", - "category": "Countries" - }, - { - "tid": "15", - "name": "Antigua and Barbuda", - "category": "Countries" - }, - { - "tid": "16", - "name": "Argentina", - "category": "Countries" - }, - { - "tid": "17", - "name": "Armenia", - "category": "Countries" - }, - { - "tid": "18", - "name": "Aruba", - "category": "Countries" - }, - { - "tid": "19", - "name": "Australia", - "category": "Countries" - }, - { - "tid": "20", - "name": "Austria", - "category": "Countries" - }, - { - "tid": "21", - "name": "Azerbaijan", - "category": "Countries" - }, - { - "tid": "22", - "name": "Bahamas", - "category": "Countries" - }, - { - "tid": "23", - "name": "Bahrain", - "category": "Countries" - }, - { - "tid": "24", - "name": "Bangladesh", - "category": "Countries" - }, - { - "tid": "25", - "name": "Barbados", - "category": "Countries" - }, - { - "tid": "26", - "name": "Belarus", - "category": "Countries" - }, - { - "tid": "27", - "name": "Belgium", - "category": "Countries" - }, - { - "tid": "28", - "name": "Belize", - "category": "Countries" - }, - { - "tid": "29", - "name": "Benin", - "category": "Countries" - }, - { - "tid": "30", - "name": "Bermuda", - "category": "Countries" - }, - { - "tid": "31", - "name": "Bhutan", - "category": "Countries" - }, - { - "tid": "32", - "name": "Bolivia", - "category": "Countries" - }, - { - "tid": "33", - "name": "Bosnia and Herzegovina", - "category": "Countries" - }, - { - "tid": "34", - "name": "Botswana", - "category": "Countries" - }, - { - "tid": "35", - "name": "Bouvet Island", - "category": "Countries" - }, - { - "tid": "36", - "name": "Brazil", - "category": "Countries" - }, - { - "tid": "37", - "name": "British Indian Ocean Territory", - "category": "Countries" - }, - { - "tid": "38", - "name": "British Virgin Islands", - "category": "Countries" - }, - { - "tid": "39", - "name": "Brunei", - "category": "Countries" - }, - { - "tid": "40", - "name": "Bulgaria", - "category": "Countries" - }, - { - "tid": "41", - "name": "Burkina Faso", - "category": "Countries" - }, - { - "tid": "42", - "name": "Burundi", - "category": "Countries" - }, - { - "tid": "43", - "name": "Cambodia", - "category": "Countries" - }, - { - "tid": "44", - "name": "Cameroon", - "category": "Countries" - }, - { - "tid": "45", - "name": "Canada", - "category": "Countries" - }, - { - "tid": "46", - "name": "Cape Verde", - "category": "Countries" - }, - { - "tid": "47", - "name": "Cayman Islands", - "category": "Countries" - }, - { - "tid": "48", - "name": "Central African Republic", - "category": "Countries" - }, - { - "tid": "49", - "name": "Chad", - "category": "Countries" - }, - { - "tid": "50", - "name": "Chile", - "category": "Countries" - }, - { - "tid": "51", - "name": "China", - "category": "Countries" - }, - { - "tid": "52", - "name": "Christmas Island", - "category": "Countries" - }, - { - "tid": "53", - "name": "Cocos (Keeling) Islands", - "category": "Countries" - }, - { - "tid": "54", - "name": "Colombia", - "category": "Countries" - }, - { - "tid": "55", - "name": "Comoros", - "category": "Countries" - }, - { - "tid": "56", - "name": "Congo (Brazzaville)", - "category": "Countries" - }, - { - "tid": "57", - "name": "Congo (Kinshasa)", - "category": "Countries" - }, - { - "tid": "58", - "name": "Cook Islands", - "category": "Countries" - }, - { - "tid": "59", - "name": "Costa Rica", - "category": "Countries" - }, - { - "tid": "60", - "name": "Croatia", - "category": "Countries" - }, - { - "tid": "61", - "name": "Cuba", - "category": "Countries" - }, - { - "tid": "62", - "name": "Curaçao", - "category": "Countries" - }, - { - "tid": "63", - "name": "Cyprus", - "category": "Countries" - }, - { - "tid": "64", - "name": "Czech Republic", - "category": "Countries" - }, - { - "tid": "65", - "name": "Denmark", - "category": "Countries" - }, - { - "tid": "66", - "name": "Djibouti", - "category": "Countries" - }, - { - "tid": "67", - "name": "Dominica", - "category": "Countries" - }, - { - "tid": "68", - "name": "Dominican Republic", - "category": "Countries" - }, - { - "tid": "69", - "name": "Ecuador", - "category": "Countries" - }, - { - "tid": "70", - "name": "Egypt", - "category": "Countries" - }, - { - "tid": "71", - "name": "El Salvador", - "category": "Countries" - }, - { - "tid": "72", - "name": "Equatorial Guinea", - "category": "Countries" - }, - { - "tid": "73", - "name": "Eritrea", - "category": "Countries" - }, - { - "tid": "74", - "name": "Estonia", - "category": "Countries" - }, - { - "tid": "75", - "name": "Ethiopia", - "category": "Countries" - }, - { - "tid": "76", - "name": "Falkland Islands", - "category": "Countries" - }, - { - "tid": "77", - "name": "Faroe Islands", - "category": "Countries" - }, - { - "tid": "78", - "name": "Fiji", - "category": "Countries" - }, - { - "tid": "79", - "name": "Finland", - "category": "Countries" - }, - { - "tid": "80", - "name": "France", - "category": "Countries" - }, - { - "tid": "81", - "name": "French Guiana", - "category": "Countries" - }, - { - "tid": "82", - "name": "French Polynesia", - "category": "Countries" - }, - { - "tid": "83", - "name": "French Southern Territories", - "category": "Countries" - }, - { - "tid": "84", - "name": "Gabon", - "category": "Countries" - }, - { - "tid": "85", - "name": "Gambia", - "category": "Countries" - }, - { - "tid": "86", - "name": "Georgia", - "category": "Countries" - }, - { - "tid": "87", - "name": "Germany", - "category": "Countries" - }, - { - "tid": "88", - "name": "Ghana", - "category": "Countries" - }, - { - "tid": "89", - "name": "Gibraltar", - "category": "Countries" - }, - { - "tid": "90", - "name": "Greece", - "category": "Countries" - }, - { - "tid": "91", - "name": "Greenland", - "category": "Countries" - }, - { - "tid": "92", - "name": "Grenada", - "category": "Countries" - }, - { - "tid": "93", - "name": "Guadeloupe", - "category": "Countries" - }, - { - "tid": "94", - "name": "Guam", - "category": "Countries" - }, - { - "tid": "95", - "name": "Guatemala", - "category": "Countries" - }, - { - "tid": "96", - "name": "Guernsey", - "category": "Countries" - }, - { - "tid": "97", - "name": "Guinea", - "category": "Countries" - }, - { - "tid": "98", - "name": "Guinea-Bissau", - "category": "Countries" - }, - { - "tid": "99", - "name": "Guyana", - "category": "Countries" - }, - { - "tid": "100", - "name": "Haiti", - "category": "Countries" - }, - { - "tid": "101", - "name": "Heard Island and McDonald Islands", - "category": "Countries" - }, - { - "tid": "102", - "name": "Honduras", - "category": "Countries" - }, - { - "tid": "103", - "name": "Hungary", - "category": "Countries" - }, - { - "tid": "104", - "name": "Iceland", - "category": "Countries" - }, - { - "tid": "105", - "name": "India", - "category": "Countries" - }, - { - "tid": "106", - "name": "Indonesia", - "category": "Countries" - }, - { - "tid": "107", - "name": "Iran", - "category": "Countries" - }, - { - "tid": "108", - "name": "Iraq", - "category": "Countries" - }, - { - "tid": "109", - "name": "Ireland", - "category": "Countries" - }, - { - "tid": "110", - "name": "Isle of Man", - "category": "Countries" - }, - { - "tid": "111", - "name": "Israel", - "category": "Countries" - }, - { - "tid": "112", - "name": "Italy", - "category": "Countries" - }, - { - "tid": "113", - "name": "Ivory Coast", - "category": "Countries" - }, - { - "tid": "114", - "name": "Jamaica", - "category": "Countries" - }, - { - "tid": "115", - "name": "Japan", - "category": "Countries" - }, - { - "tid": "116", - "name": "Jersey", - "category": "Countries" - }, - { - "tid": "117", - "name": "Jordan", - "category": "Countries" - }, - { - "tid": "118", - "name": "Kazakhstan", - "category": "Countries" - }, - { - "tid": "119", - "name": "Kenya", - "category": "Countries" - }, - { - "tid": "120", - "name": "Kiribati", - "category": "Countries" - }, - { - "tid": "488", - "name": "Kosovo", - "category": "Countries" - }, - { - "tid": "121", - "name": "Kuwait", - "category": "Countries" - }, - { - "tid": "122", - "name": "Kyrgyzstan", - "category": "Countries" - }, - { - "tid": "123", - "name": "Laos", - "category": "Countries" - }, - { - "tid": "124", - "name": "Latvia", - "category": "Countries" - }, - { - "tid": "125", - "name": "Lebanon", - "category": "Countries" - }, - { - "tid": "126", - "name": "Lesotho", - "category": "Countries" - }, - { - "tid": "127", - "name": "Liberia", - "category": "Countries" - }, - { - "tid": "128", - "name": "Libya", - "category": "Countries" - }, - { - "tid": "129", - "name": "Liechtenstein", - "category": "Countries" - }, - { - "tid": "130", - "name": "Lithuania", - "category": "Countries" - }, - { - "tid": "131", - "name": "Luxembourg", - "category": "Countries" - }, - { - "tid": "132", - "name": "Macedonia", - "category": "Countries" - }, - { - "tid": "133", - "name": "Madagascar", - "category": "Countries" - }, - { - "tid": "134", - "name": "Malawi", - "category": "Countries" - }, - { - "tid": "135", - "name": "Malaysia", - "category": "Countries" - }, - { - "tid": "136", - "name": "Maldives", - "category": "Countries" - }, - { - "tid": "137", - "name": "Mali", - "category": "Countries" - }, - { - "tid": "138", - "name": "Malta", - "category": "Countries" - }, - { - "tid": "139", - "name": "Marshall Islands", - "category": "Countries" - }, - { - "tid": "140", - "name": "Martinique", - "category": "Countries" - }, - { - "tid": "141", - "name": "Mauritania", - "category": "Countries" - }, - { - "tid": "142", - "name": "Mauritius", - "category": "Countries" - }, - { - "tid": "143", - "name": "Mayotte", - "category": "Countries" - }, - { - "tid": "144", - "name": "Mexico", - "category": "Countries" - }, - { - "tid": "145", - "name": "Micronesia", - "category": "Countries" - }, - { - "tid": "146", - "name": "Moldova", - "category": "Countries" - }, - { - "tid": "147", - "name": "Monaco", - "category": "Countries" - }, - { - "tid": "148", - "name": "Mongolia", - "category": "Countries" - }, - { - "tid": "149", - "name": "Montenegro", - "category": "Countries" - }, - { - "tid": "150", - "name": "Montserrat", - "category": "Countries" - }, - { - "tid": "151", - "name": "Morocco", - "category": "Countries" - }, - { - "tid": "152", - "name": "Mozambique", - "category": "Countries" - }, - { - "tid": "153", - "name": "Myanmar", - "category": "Countries" - }, - { - "tid": "154", - "name": "Namibia", - "category": "Countries" - }, - { - "tid": "155", - "name": "Nauru", - "category": "Countries" - }, - { - "tid": "156", - "name": "Nepal", - "category": "Countries" - }, - { - "tid": "157", - "name": "Netherlands", - "category": "Countries" - }, - { - "tid": "158", - "name": "Netherlands Antilles", - "category": "Countries" - }, - { - "tid": "159", - "name": "New Caledonia", - "category": "Countries" - }, - { - "tid": "160", - "name": "New Zealand", - "category": "Countries" - }, - { - "tid": "161", - "name": "Nicaragua", - "category": "Countries" - }, - { - "tid": "162", - "name": "Niger", - "category": "Countries" - }, - { - "tid": "163", - "name": "Nigeria", - "category": "Countries" - }, - { - "tid": "164", - "name": "Niue", - "category": "Countries" - }, - { - "tid": "165", - "name": "Norfolk Island", - "category": "Countries" - }, - { - "tid": "166", - "name": "North Korea", - "category": "Countries" - }, - { - "tid": "167", - "name": "Northern Mariana Islands", - "category": "Countries" - }, - { - "tid": "168", - "name": "Norway", - "category": "Countries" - }, - { - "tid": "169", - "name": "Oman", - "category": "Countries" - }, - { - "tid": "170", - "name": "Pakistan", - "category": "Countries" - }, - { - "tid": "171", - "name": "Palau", - "category": "Countries" - }, - { - "tid": "172", - "name": "Palestinian Territory", - "category": "Countries" - }, - { - "tid": "173", - "name": "Panama", - "category": "Countries" - }, - { - "tid": "174", - "name": "Papua New Guinea", - "category": "Countries" - }, - { - "tid": "175", - "name": "Paraguay", - "category": "Countries" - }, - { - "tid": "176", - "name": "Peru", - "category": "Countries" - }, - { - "tid": "177", - "name": "Philippines", - "category": "Countries" - }, - { - "tid": "178", - "name": "Pitcairn", - "category": "Countries" - }, - { - "tid": "179", - "name": "Poland", - "category": "Countries" - }, - { - "tid": "180", - "name": "Portugal", - "category": "Countries" - }, - { - "tid": "181", - "name": "Puerto Rico", - "category": "Countries" - }, - { - "tid": "182", - "name": "Qatar", - "category": "Countries" - }, - { - "tid": "183", - "name": "Reunion", - "category": "Countries" - }, - { - "tid": "184", - "name": "Romania", - "category": "Countries" - }, - { - "tid": "185", - "name": "Russia", - "category": "Countries" - }, - { - "tid": "186", - "name": "Rwanda", - "category": "Countries" - }, - { - "tid": "187", - "name": "Saint Barthélemy", - "category": "Countries" - }, - { - "tid": "188", - "name": "Saint Helena", - "category": "Countries" - }, - { - "tid": "189", - "name": "Saint Kitts and Nevis", - "category": "Countries" - }, - { - "tid": "190", - "name": "Saint Lucia", - "category": "Countries" - }, - { - "tid": "191", - "name": "Saint Martin (French part)", - "category": "Countries" - }, - { - "tid": "192", - "name": "Saint Pierre and Miquelon", - "category": "Countries" - }, - { - "tid": "193", - "name": "Saint Vincent and the Grenadines", - "category": "Countries" - }, - { - "tid": "194", - "name": "Samoa", - "category": "Countries" - }, - { - "tid": "195", - "name": "San Marino", - "category": "Countries" - }, - { - "tid": "196", - "name": "Sao Tome and Principe", - "category": "Countries" - }, - { - "tid": "197", - "name": "Saudi Arabia", - "category": "Countries" - }, - { - "tid": "198", - "name": "Senegal", - "category": "Countries" - }, - { - "tid": "199", - "name": "Serbia", - "category": "Countries" - }, - { - "tid": "200", - "name": "Seychelles", - "category": "Countries" - }, - { - "tid": "201", - "name": "Sierra Leone", - "category": "Countries" - }, - { - "tid": "202", - "name": "Singapore", - "category": "Countries" - }, - { - "tid": "203", - "name": "Slovakia", - "category": "Countries" - }, - { - "tid": "204", - "name": "Slovenia", - "category": "Countries" + "category": "Focus", + "name": "Awareness of privacy and security threats", + "tid": "363", }, + {"category": "Focus", "name": "Privacy enhancement", "tid": "3"}, + {"category": "Focus", "name": "Security from danger or threat online", "tid": "1"}, + {"category": "Objective(s)", "name": "Deploying technology", "tid": "362"}, { - "tid": "205", - "name": "Solomon Islands", - "category": "Countries" - }, + "category": "Objective(s)", + "name": "Software or hardware development", + "tid": "360", + }, + {"category": "Objective(s)", "name": "Testing", "tid": "333"}, + {"category": "Objective(s)", "name": "Research", "tid": "361"}, + {"category": "Objective(s)", "name": "Technology development", "tid": "330"}, + {"category": "Objective(s)", "name": "Training", "tid": "331"}, + {"category": "Beneficiaries", "name": "General public", "tid": "335"}, + {"category": "Beneficiaries", "name": "Women", "tid": "342"}, + {"category": "Beneficiaries", "name": "Youth", "tid": "343"}, + {"category": "Beneficiaries", "name": "Sexual minorities", "tid": "345"}, + {"category": "Beneficiaries", "name": "Ethnic minorities", "tid": "344"}, + {"category": "Beneficiaries", "name": "Activists", "tid": "336"}, + {"category": "Beneficiaries", "name": "Journalists", "tid": "337"}, + {"category": "Beneficiaries", "name": "Advocacy groups/NGOs", "tid": "338"}, + {"category": "Beneficiaries", "name": "Academia", "tid": "339"}, + {"category": "Beneficiaries", "name": "Technologists", "tid": "340"}, + {"category": "Beneficiaries", "name": "Entrepreneurs", "tid": "359"}, + {"category": "Beneficiaries", "name": "Government", "tid": "341"}, + {"category": "Beneficiaries", "name": "Other", "tid": "350"}, + {"category": "Region(s)", "name": "Global", "tid": "271"}, + {"category": "Region(s)", "name": "North Africa and Middle east", "tid": "358"}, + {"category": "Region(s)", "name": "East Africa", "tid": "369"}, + {"category": "Region(s)", "name": "West Africa", "tid": "370"}, + {"category": "Region(s)", "name": "South Africa", "tid": "272"}, + {"category": "Region(s)", "name": "North Asia and Russia", "tid": "371"}, + {"category": "Region(s)", "name": "Central Asia", "tid": "274"}, + {"category": "Region(s)", "name": "East Asia", "tid": "372"}, + {"category": "Region(s)", "name": "South Asia", "tid": "373"}, + {"category": "Region(s)", "name": "South-East Asia", "tid": "365"}, + {"category": "Region(s)", "name": "Eastern Europe", "tid": "291"}, + {"category": "Region(s)", "name": "Central America", "tid": "273"}, + {"category": "Region(s)", "name": "Caribbean", "tid": "374"}, + {"category": "Region(s)", "name": "Andean", "tid": "375"}, + {"category": "Region(s)", "name": "Southern cone", "tid": "376"}, + {"category": "Project status", "name": "Just an Idea (Pre-alpha)", "tid": "329"}, + {"category": "Project status", "name": "It Exists! (Alpha/Beta)", "tid": "328"}, { - "tid": "206", - "name": "Somalia", - "category": "Countries" - }, + "category": "Project status", + "name": "It's basically done. (Release)", + "tid": "366", + }, + {"category": "Project status", "name": "People Use It. (Production)", "tid": "367"}, + {"tid": "6", "name": "Afghanistan", "category": "Countries"}, + {"tid": "7", "name": "Aland Islands", "category": "Countries"}, + {"tid": "8", "name": "Albania", "category": "Countries"}, + {"tid": "9", "name": "Algeria", "category": "Countries"}, + {"tid": "10", "name": "American Samoa", "category": "Countries"}, + {"tid": "11", "name": "Andorra", "category": "Countries"}, + {"tid": "12", "name": "Angola", "category": "Countries"}, + {"tid": "13", "name": "Anguilla", "category": "Countries"}, + {"tid": "14", "name": "Antarctica", "category": "Countries"}, + {"tid": "15", "name": "Antigua and Barbuda", "category": "Countries"}, + {"tid": "16", "name": "Argentina", "category": "Countries"}, + {"tid": "17", "name": "Armenia", "category": "Countries"}, + {"tid": "18", "name": "Aruba", "category": "Countries"}, + {"tid": "19", "name": "Australia", "category": "Countries"}, + {"tid": "20", "name": "Austria", "category": "Countries"}, + {"tid": "21", "name": "Azerbaijan", "category": "Countries"}, + {"tid": "22", "name": "Bahamas", "category": "Countries"}, + {"tid": "23", "name": "Bahrain", "category": "Countries"}, + {"tid": "24", "name": "Bangladesh", "category": "Countries"}, + {"tid": "25", "name": "Barbados", "category": "Countries"}, + {"tid": "26", "name": "Belarus", "category": "Countries"}, + {"tid": "27", "name": "Belgium", "category": "Countries"}, + {"tid": "28", "name": "Belize", "category": "Countries"}, + {"tid": "29", "name": "Benin", "category": "Countries"}, + {"tid": "30", "name": "Bermuda", "category": "Countries"}, + {"tid": "31", "name": "Bhutan", "category": "Countries"}, + {"tid": "32", "name": "Bolivia", "category": "Countries"}, + {"tid": "33", "name": "Bosnia and Herzegovina", "category": "Countries"}, + {"tid": "34", "name": "Botswana", "category": "Countries"}, + {"tid": "35", "name": "Bouvet Island", "category": "Countries"}, + {"tid": "36", "name": "Brazil", "category": "Countries"}, + {"tid": "37", "name": "British Indian Ocean Territory", "category": "Countries"}, + {"tid": "38", "name": "British Virgin Islands", "category": "Countries"}, + {"tid": "39", "name": "Brunei", "category": "Countries"}, + {"tid": "40", "name": "Bulgaria", "category": "Countries"}, + {"tid": "41", "name": "Burkina Faso", "category": "Countries"}, + {"tid": "42", "name": "Burundi", "category": "Countries"}, + {"tid": "43", "name": "Cambodia", "category": "Countries"}, + {"tid": "44", "name": "Cameroon", "category": "Countries"}, + {"tid": "45", "name": "Canada", "category": "Countries"}, + {"tid": "46", "name": "Cape Verde", "category": "Countries"}, + {"tid": "47", "name": "Cayman Islands", "category": "Countries"}, + {"tid": "48", "name": "Central African Republic", "category": "Countries"}, + {"tid": "49", "name": "Chad", "category": "Countries"}, + {"tid": "50", "name": "Chile", "category": "Countries"}, + {"tid": "51", "name": "China", "category": "Countries"}, + {"tid": "52", "name": "Christmas Island", "category": "Countries"}, + {"tid": "53", "name": "Cocos (Keeling) Islands", "category": "Countries"}, + {"tid": "54", "name": "Colombia", "category": "Countries"}, + {"tid": "55", "name": "Comoros", "category": "Countries"}, + {"tid": "56", "name": "Congo (Brazzaville)", "category": "Countries"}, + {"tid": "57", "name": "Congo (Kinshasa)", "category": "Countries"}, + {"tid": "58", "name": "Cook Islands", "category": "Countries"}, + {"tid": "59", "name": "Costa Rica", "category": "Countries"}, + {"tid": "60", "name": "Croatia", "category": "Countries"}, + {"tid": "61", "name": "Cuba", "category": "Countries"}, + {"tid": "62", "name": "Curaçao", "category": "Countries"}, + {"tid": "63", "name": "Cyprus", "category": "Countries"}, + {"tid": "64", "name": "Czech Republic", "category": "Countries"}, + {"tid": "65", "name": "Denmark", "category": "Countries"}, + {"tid": "66", "name": "Djibouti", "category": "Countries"}, + {"tid": "67", "name": "Dominica", "category": "Countries"}, + {"tid": "68", "name": "Dominican Republic", "category": "Countries"}, + {"tid": "69", "name": "Ecuador", "category": "Countries"}, + {"tid": "70", "name": "Egypt", "category": "Countries"}, + {"tid": "71", "name": "El Salvador", "category": "Countries"}, + {"tid": "72", "name": "Equatorial Guinea", "category": "Countries"}, + {"tid": "73", "name": "Eritrea", "category": "Countries"}, + {"tid": "74", "name": "Estonia", "category": "Countries"}, + {"tid": "75", "name": "Ethiopia", "category": "Countries"}, + {"tid": "76", "name": "Falkland Islands", "category": "Countries"}, + {"tid": "77", "name": "Faroe Islands", "category": "Countries"}, + {"tid": "78", "name": "Fiji", "category": "Countries"}, + {"tid": "79", "name": "Finland", "category": "Countries"}, + {"tid": "80", "name": "France", "category": "Countries"}, + {"tid": "81", "name": "French Guiana", "category": "Countries"}, + {"tid": "82", "name": "French Polynesia", "category": "Countries"}, + {"tid": "83", "name": "French Southern Territories", "category": "Countries"}, + {"tid": "84", "name": "Gabon", "category": "Countries"}, + {"tid": "85", "name": "Gambia", "category": "Countries"}, + {"tid": "86", "name": "Georgia", "category": "Countries"}, + {"tid": "87", "name": "Germany", "category": "Countries"}, + {"tid": "88", "name": "Ghana", "category": "Countries"}, + {"tid": "89", "name": "Gibraltar", "category": "Countries"}, + {"tid": "90", "name": "Greece", "category": "Countries"}, + {"tid": "91", "name": "Greenland", "category": "Countries"}, + {"tid": "92", "name": "Grenada", "category": "Countries"}, + {"tid": "93", "name": "Guadeloupe", "category": "Countries"}, + {"tid": "94", "name": "Guam", "category": "Countries"}, + {"tid": "95", "name": "Guatemala", "category": "Countries"}, + {"tid": "96", "name": "Guernsey", "category": "Countries"}, + {"tid": "97", "name": "Guinea", "category": "Countries"}, + {"tid": "98", "name": "Guinea-Bissau", "category": "Countries"}, + {"tid": "99", "name": "Guyana", "category": "Countries"}, + {"tid": "100", "name": "Haiti", "category": "Countries"}, { - "tid": "207", - "name": "South Africa", - "category": "Countries" - }, + "tid": "101", + "name": "Heard Island and McDonald Islands", + "category": "Countries", + }, + {"tid": "102", "name": "Honduras", "category": "Countries"}, + {"tid": "103", "name": "Hungary", "category": "Countries"}, + {"tid": "104", "name": "Iceland", "category": "Countries"}, + {"tid": "105", "name": "India", "category": "Countries"}, + {"tid": "106", "name": "Indonesia", "category": "Countries"}, + {"tid": "107", "name": "Iran", "category": "Countries"}, + {"tid": "108", "name": "Iraq", "category": "Countries"}, + {"tid": "109", "name": "Ireland", "category": "Countries"}, + {"tid": "110", "name": "Isle of Man", "category": "Countries"}, + {"tid": "111", "name": "Israel", "category": "Countries"}, + {"tid": "112", "name": "Italy", "category": "Countries"}, + {"tid": "113", "name": "Ivory Coast", "category": "Countries"}, + {"tid": "114", "name": "Jamaica", "category": "Countries"}, + {"tid": "115", "name": "Japan", "category": "Countries"}, + {"tid": "116", "name": "Jersey", "category": "Countries"}, + {"tid": "117", "name": "Jordan", "category": "Countries"}, + {"tid": "118", "name": "Kazakhstan", "category": "Countries"}, + {"tid": "119", "name": "Kenya", "category": "Countries"}, + {"tid": "120", "name": "Kiribati", "category": "Countries"}, + {"tid": "488", "name": "Kosovo", "category": "Countries"}, + {"tid": "121", "name": "Kuwait", "category": "Countries"}, + {"tid": "122", "name": "Kyrgyzstan", "category": "Countries"}, + {"tid": "123", "name": "Laos", "category": "Countries"}, + {"tid": "124", "name": "Latvia", "category": "Countries"}, + {"tid": "125", "name": "Lebanon", "category": "Countries"}, + {"tid": "126", "name": "Lesotho", "category": "Countries"}, + {"tid": "127", "name": "Liberia", "category": "Countries"}, + {"tid": "128", "name": "Libya", "category": "Countries"}, + {"tid": "129", "name": "Liechtenstein", "category": "Countries"}, + {"tid": "130", "name": "Lithuania", "category": "Countries"}, + {"tid": "131", "name": "Luxembourg", "category": "Countries"}, + {"tid": "132", "name": "Macedonia", "category": "Countries"}, + {"tid": "133", "name": "Madagascar", "category": "Countries"}, + {"tid": "134", "name": "Malawi", "category": "Countries"}, + {"tid": "135", "name": "Malaysia", "category": "Countries"}, + {"tid": "136", "name": "Maldives", "category": "Countries"}, + {"tid": "137", "name": "Mali", "category": "Countries"}, + {"tid": "138", "name": "Malta", "category": "Countries"}, + {"tid": "139", "name": "Marshall Islands", "category": "Countries"}, + {"tid": "140", "name": "Martinique", "category": "Countries"}, + {"tid": "141", "name": "Mauritania", "category": "Countries"}, + {"tid": "142", "name": "Mauritius", "category": "Countries"}, + {"tid": "143", "name": "Mayotte", "category": "Countries"}, + {"tid": "144", "name": "Mexico", "category": "Countries"}, + {"tid": "145", "name": "Micronesia", "category": "Countries"}, + {"tid": "146", "name": "Moldova", "category": "Countries"}, + {"tid": "147", "name": "Monaco", "category": "Countries"}, + {"tid": "148", "name": "Mongolia", "category": "Countries"}, + {"tid": "149", "name": "Montenegro", "category": "Countries"}, + {"tid": "150", "name": "Montserrat", "category": "Countries"}, + {"tid": "151", "name": "Morocco", "category": "Countries"}, + {"tid": "152", "name": "Mozambique", "category": "Countries"}, + {"tid": "153", "name": "Myanmar", "category": "Countries"}, + {"tid": "154", "name": "Namibia", "category": "Countries"}, + {"tid": "155", "name": "Nauru", "category": "Countries"}, + {"tid": "156", "name": "Nepal", "category": "Countries"}, + {"tid": "157", "name": "Netherlands", "category": "Countries"}, + {"tid": "158", "name": "Netherlands Antilles", "category": "Countries"}, + {"tid": "159", "name": "New Caledonia", "category": "Countries"}, + {"tid": "160", "name": "New Zealand", "category": "Countries"}, + {"tid": "161", "name": "Nicaragua", "category": "Countries"}, + {"tid": "162", "name": "Niger", "category": "Countries"}, + {"tid": "163", "name": "Nigeria", "category": "Countries"}, + {"tid": "164", "name": "Niue", "category": "Countries"}, + {"tid": "165", "name": "Norfolk Island", "category": "Countries"}, + {"tid": "166", "name": "North Korea", "category": "Countries"}, + {"tid": "167", "name": "Northern Mariana Islands", "category": "Countries"}, + {"tid": "168", "name": "Norway", "category": "Countries"}, + {"tid": "169", "name": "Oman", "category": "Countries"}, + {"tid": "170", "name": "Pakistan", "category": "Countries"}, + {"tid": "171", "name": "Palau", "category": "Countries"}, + {"tid": "172", "name": "Palestinian Territory", "category": "Countries"}, + {"tid": "173", "name": "Panama", "category": "Countries"}, + {"tid": "174", "name": "Papua New Guinea", "category": "Countries"}, + {"tid": "175", "name": "Paraguay", "category": "Countries"}, + {"tid": "176", "name": "Peru", "category": "Countries"}, + {"tid": "177", "name": "Philippines", "category": "Countries"}, + {"tid": "178", "name": "Pitcairn", "category": "Countries"}, + {"tid": "179", "name": "Poland", "category": "Countries"}, + {"tid": "180", "name": "Portugal", "category": "Countries"}, + {"tid": "181", "name": "Puerto Rico", "category": "Countries"}, + {"tid": "182", "name": "Qatar", "category": "Countries"}, + {"tid": "183", "name": "Reunion", "category": "Countries"}, + {"tid": "184", "name": "Romania", "category": "Countries"}, + {"tid": "185", "name": "Russia", "category": "Countries"}, + {"tid": "186", "name": "Rwanda", "category": "Countries"}, + {"tid": "187", "name": "Saint Barthélemy", "category": "Countries"}, + {"tid": "188", "name": "Saint Helena", "category": "Countries"}, + {"tid": "189", "name": "Saint Kitts and Nevis", "category": "Countries"}, + {"tid": "190", "name": "Saint Lucia", "category": "Countries"}, + {"tid": "191", "name": "Saint Martin (French part)", "category": "Countries"}, + {"tid": "192", "name": "Saint Pierre and Miquelon", "category": "Countries"}, + {"tid": "193", "name": "Saint Vincent and the Grenadines", "category": "Countries"}, + {"tid": "194", "name": "Samoa", "category": "Countries"}, + {"tid": "195", "name": "San Marino", "category": "Countries"}, + {"tid": "196", "name": "Sao Tome and Principe", "category": "Countries"}, + {"tid": "197", "name": "Saudi Arabia", "category": "Countries"}, + {"tid": "198", "name": "Senegal", "category": "Countries"}, + {"tid": "199", "name": "Serbia", "category": "Countries"}, + {"tid": "200", "name": "Seychelles", "category": "Countries"}, + {"tid": "201", "name": "Sierra Leone", "category": "Countries"}, + {"tid": "202", "name": "Singapore", "category": "Countries"}, + {"tid": "203", "name": "Slovakia", "category": "Countries"}, + {"tid": "204", "name": "Slovenia", "category": "Countries"}, + {"tid": "205", "name": "Solomon Islands", "category": "Countries"}, + {"tid": "206", "name": "Somalia", "category": "Countries"}, + {"tid": "207", "name": "South Africa", "category": "Countries"}, { "tid": "208", "name": "South Georgia and the South Sandwich Islands", - "category": "Countries" - }, - { - "tid": "209", - "name": "South Korea", - "category": "Countries" - }, - { - "tid": "476", - "name": "South Sudan", - "category": "Countries" - }, - { - "tid": "210", - "name": "Spain", - "category": "Countries" - }, - { - "tid": "211", - "name": "Sri Lanka", - "category": "Countries" - }, - { - "tid": "212", - "name": "Sudan", - "category": "Countries" - }, - { - "tid": "213", - "name": "Suriname", - "category": "Countries" - }, - { - "tid": "214", - "name": "Svalbard and Jan Mayen", - "category": "Countries" - }, - { - "tid": "215", - "name": "Swaziland", - "category": "Countries" - }, - { - "tid": "216", - "name": "Sweden", - "category": "Countries" - }, - { - "tid": "217", - "name": "Switzerland", - "category": "Countries" - }, - { - "tid": "218", - "name": "Syria", - "category": "Countries" - }, - { - "tid": "219", - "name": "Taiwan", - "category": "Countries" - }, - { - "tid": "220", - "name": "Tajikistan", - "category": "Countries" - }, - { - "tid": "221", - "name": "Tanzania", - "category": "Countries" - }, - { - "tid": "222", - "name": "Thailand", - "category": "Countries" - }, - { - "tid": "223", - "name": "Timor-Leste", - "category": "Countries" - }, - { - "tid": "224", - "name": "Togo", - "category": "Countries" - }, - { - "tid": "225", - "name": "Tokelau", - "category": "Countries" - }, - { - "tid": "226", - "name": "Tonga", - "category": "Countries" - }, - { - "tid": "227", - "name": "Trinidad and Tobago", - "category": "Countries" - }, - { - "tid": "228", - "name": "Tunisia", - "category": "Countries" - }, - { - "tid": "229", - "name": "Turkey", - "category": "Countries" - }, - { - "tid": "230", - "name": "Turkmenistan", - "category": "Countries" - }, - { - "tid": "231", - "name": "Turks and Caicos Islands", - "category": "Countries" - }, - { - "tid": "232", - "name": "Tuvalu", - "category": "Countries" - }, - { - "tid": "233", - "name": "U.S. Virgin Islands", - "category": "Countries" - }, - { - "tid": "234", - "name": "Uganda", - "category": "Countries" - }, - { - "tid": "235", - "name": "Ukraine", - "category": "Countries" - }, - { - "tid": "236", - "name": "United Arab Emirates", - "category": "Countries" - }, - { - "tid": "237", - "name": "United Kingdom", - "category": "Countries" - }, - { - "tid": "238", - "name": "United States", - "category": "Countries" - }, + "category": "Countries", + }, + {"tid": "209", "name": "South Korea", "category": "Countries"}, + {"tid": "476", "name": "South Sudan", "category": "Countries"}, + {"tid": "210", "name": "Spain", "category": "Countries"}, + {"tid": "211", "name": "Sri Lanka", "category": "Countries"}, + {"tid": "212", "name": "Sudan", "category": "Countries"}, + {"tid": "213", "name": "Suriname", "category": "Countries"}, + {"tid": "214", "name": "Svalbard and Jan Mayen", "category": "Countries"}, + {"tid": "215", "name": "Swaziland", "category": "Countries"}, + {"tid": "216", "name": "Sweden", "category": "Countries"}, + {"tid": "217", "name": "Switzerland", "category": "Countries"}, + {"tid": "218", "name": "Syria", "category": "Countries"}, + {"tid": "219", "name": "Taiwan", "category": "Countries"}, + {"tid": "220", "name": "Tajikistan", "category": "Countries"}, + {"tid": "221", "name": "Tanzania", "category": "Countries"}, + {"tid": "222", "name": "Thailand", "category": "Countries"}, + {"tid": "223", "name": "Timor-Leste", "category": "Countries"}, + {"tid": "224", "name": "Togo", "category": "Countries"}, + {"tid": "225", "name": "Tokelau", "category": "Countries"}, + {"tid": "226", "name": "Tonga", "category": "Countries"}, + {"tid": "227", "name": "Trinidad and Tobago", "category": "Countries"}, + {"tid": "228", "name": "Tunisia", "category": "Countries"}, + {"tid": "229", "name": "Turkey", "category": "Countries"}, + {"tid": "230", "name": "Turkmenistan", "category": "Countries"}, + {"tid": "231", "name": "Turks and Caicos Islands", "category": "Countries"}, + {"tid": "232", "name": "Tuvalu", "category": "Countries"}, + {"tid": "233", "name": "U.S. Virgin Islands", "category": "Countries"}, + {"tid": "234", "name": "Uganda", "category": "Countries"}, + {"tid": "235", "name": "Ukraine", "category": "Countries"}, + {"tid": "236", "name": "United Arab Emirates", "category": "Countries"}, + {"tid": "237", "name": "United Kingdom", "category": "Countries"}, + {"tid": "238", "name": "United States", "category": "Countries"}, { "tid": "239", "name": "United States Minor Outlying Islands", - "category": "Countries" - }, - { - "tid": "240", - "name": "Uruguay", - "category": "Countries" - }, - { - "tid": "241", - "name": "Uzbekistan", - "category": "Countries" - }, - { - "tid": "242", - "name": "Vanuatu", - "category": "Countries" - }, - { - "tid": "243", - "name": "Vatican", - "category": "Countries" - }, - { - "tid": "244", - "name": "Venezuela", - "category": "Countries" - }, - { - "tid": "245", - "name": "Vietnam", - "category": "Countries" - }, - { - "tid": "246", - "name": "Wallis and Futuna", - "category": "Countries" - }, - { - "tid": "247", - "name": "Western Sahara", - "category": "Countries" - }, - { - "tid": "248", - "name": "Yemen", - "category": "Countries" - }, - { - "tid": "249", - "name": "Zambia", - "category": "Countries" - }, - { - "tid": "250", - "name": "Zimbabwe", - "category": "Countries" - }, - { - "tid": "302", - "category": "Technology attributes", - "name": "Anonymity" - }, + "category": "Countries", + }, + {"tid": "240", "name": "Uruguay", "category": "Countries"}, + {"tid": "241", "name": "Uzbekistan", "category": "Countries"}, + {"tid": "242", "name": "Vanuatu", "category": "Countries"}, + {"tid": "243", "name": "Vatican", "category": "Countries"}, + {"tid": "244", "name": "Venezuela", "category": "Countries"}, + {"tid": "245", "name": "Vietnam", "category": "Countries"}, + {"tid": "246", "name": "Wallis and Futuna", "category": "Countries"}, + {"tid": "247", "name": "Western Sahara", "category": "Countries"}, + {"tid": "248", "name": "Yemen", "category": "Countries"}, + {"tid": "249", "name": "Zambia", "category": "Countries"}, + {"tid": "250", "name": "Zimbabwe", "category": "Countries"}, + {"tid": "302", "category": "Technology attributes", "name": "Anonymity"}, { "tid": "303", "category": "Technology attributes", - "name": "Application deployment" - }, - { - "tid": "298", - "category": "Technology attributes", - "name": "Browser extension" - }, - { - "tid": "299", - "category": "Technology attributes", - "name": "Browser plugin" - }, - { - "tid": "308", - "category": "Technology attributes", - "name": "Cryptography" + "name": "Application deployment", }, + {"tid": "298", "category": "Technology attributes", "name": "Browser extension"}, + {"tid": "299", "category": "Technology attributes", "name": "Browser plugin"}, + {"tid": "308", "category": "Technology attributes", "name": "Cryptography"}, { "tid": "310", "category": "Technology attributes", - "name": "Dependency integration" - }, - { - "tid": "312", - "category": "Technology attributes", - "name": "Desktop App" - }, - { - "tid": "311", - "category": "Technology attributes", - "name": "Desktop client" + "name": "Dependency integration", }, + {"tid": "312", "category": "Technology attributes", "name": "Desktop App"}, + {"tid": "311", "category": "Technology attributes", "name": "Desktop client"}, { "tid": "316", "category": "Technology attributes", - "name": "Hardware/Embedded device(s)" + "name": "Hardware/Embedded device(s)", }, { "tid": "347", "category": "Technology attributes", - "name": "Infrastructure as a service (IaaS)" + "name": "Infrastructure as a service (IaaS)", }, { "tid": "306", "category": "Technology attributes", - "name": "Mobile application (clientside)" - }, - { - "tid": "314", - "category": "Technology attributes", - "name": "Networking" - }, - { - "tid": "356", - "category": "Technology attributes", - "name": "Not applicable" - }, - { - "tid": "317", - "category": "Technology attributes", - "name": "Other" + "name": "Mobile application (clientside)", }, + {"tid": "314", "category": "Technology attributes", "name": "Networking"}, + {"tid": "356", "category": "Technology attributes", "name": "Not applicable"}, + {"tid": "317", "category": "Technology attributes", "name": "Other"}, { "tid": "346", "category": "Technology attributes", - "name": "Platform as a service (PaaS)" - }, - { - "tid": "349", - "category": "Technology attributes", - "name": "Reverse Engineering" - }, - { - "tid": "313", - "category": "Technology attributes", - "name": "Sensitive data" - }, - { - "tid": "305", - "category": "Technology attributes", - "name": "Server daemon" + "name": "Platform as a service (PaaS)", }, + {"tid": "349", "category": "Technology attributes", "name": "Reverse Engineering"}, + {"tid": "313", "category": "Technology attributes", "name": "Sensitive data"}, + {"tid": "305", "category": "Technology attributes", "name": "Server daemon"}, { "tid": "315", "category": "Technology attributes", - "name": "Software as a Service (SaaS)" - }, - { - "tid": "300", - "category": "Technology attributes", - "name": "Unmanaged language" + "name": "Software as a Service (SaaS)", }, + {"tid": "300", "category": "Technology attributes", "name": "Unmanaged language"}, { "tid": "301", "category": "Technology attributes", - "name": "User interface/experience" + "name": "User interface/experience", }, { "tid": "307", "category": "Technology attributes", - "name": "Web API/Mobile application (serverside)" - }, - { - "tid": "304", - "category": "Technology attributes", - "name": "Web application" + "name": "Web API/Mobile application (serverside)", }, + {"tid": "304", "category": "Technology attributes", "name": "Web application"}, { "tid": "309", "category": "Technology attributes", - "name": "Wireless Communication" - } + "name": "Wireless Communication", + }, ] diff --git a/hypha/apply/categories/management/commands/seed_categories.py b/hypha/apply/categories/management/commands/seed_categories.py index e5b0526db7..61e616427e 100644 --- a/hypha/apply/categories/management/commands/seed_categories.py +++ b/hypha/apply/categories/management/commands/seed_categories.py @@ -11,9 +11,15 @@ class Command(BaseCommand): @transaction.atomic def handle(self, *args, **options): for item in CATEGORIES: - category, created = Category.objects.get_or_create(name=item['category']) + category, created = Category.objects.get_or_create(name=item["category"]) if created: - self.stdout.write(self.style.SUCCESS(f"Category {item['category']} created")) - term, created = Option.objects.get_or_create(value=item['name'], category=category) + self.stdout.write( + self.style.SUCCESS(f"Category {item['category']} created") + ) + term, created = Option.objects.get_or_create( + value=item["name"], category=category + ) if created: - self.stdout.write(f"Term {item['name']} added to category {item['category']}") + self.stdout.write( + f"Term {item['name']} added to category {item['category']}" + ) diff --git a/hypha/apply/categories/migrations/0001_initial.py b/hypha/apply/categories/migrations/0001_initial.py index fa8ce2994a..da244f34fc 100644 --- a/hypha/apply/categories/migrations/0001_initial.py +++ b/hypha/apply/categories/migrations/0001_initial.py @@ -8,35 +8,59 @@ class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Category', + name="Category", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('help_text', models.CharField(blank=True, max_length=255)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), + ("help_text", models.CharField(blank=True, max_length=255)), ], options={ - 'verbose_name_plural': 'Categories', + "verbose_name_plural": "Categories", }, ), migrations.CreateModel( - name='Option', + name="Option", 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.CharField(max_length=255)), - ('category', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='options', to='categories.Category')), + ( + "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.CharField(max_length=255)), + ( + "category", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="options", + to="categories.Category", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/categories/migrations/0002_metacategory.py b/hypha/apply/categories/migrations/0002_metacategory.py index 0f47ec3348..3496b8d006 100644 --- a/hypha/apply/categories/migrations/0002_metacategory.py +++ b/hypha/apply/categories/migrations/0002_metacategory.py @@ -5,25 +5,42 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0001_initial'), + ("categories", "0001_initial"), ] operations = [ migrations.CreateModel( - name='MetaCategory', + name="MetaCategory", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('path', models.CharField(max_length=255, unique=True)), - ('depth', models.PositiveIntegerField()), - ('numchild', models.PositiveIntegerField(default=0)), - ('name', models.CharField(help_text='Keep the name short, ideally one word.', max_length=50, unique=True)), - ('node_order_index', models.IntegerField(blank=True, default=0, editable=False)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("path", models.CharField(max_length=255, unique=True)), + ("depth", models.PositiveIntegerField()), + ("numchild", models.PositiveIntegerField(default=0)), + ( + "name", + models.CharField( + help_text="Keep the name short, ideally one word.", + max_length=50, + unique=True, + ), + ), + ( + "node_order_index", + models.IntegerField(blank=True, default=0, editable=False), + ), ], options={ - 'verbose_name': 'Meta Category', - 'verbose_name_plural': 'Meta Categories', + "verbose_name": "Meta Category", + "verbose_name_plural": "Meta Categories", }, bases=(wagtail.search.index.Indexed, models.Model), ), diff --git a/hypha/apply/categories/migrations/0003_rename_meta_categories_to_meta_terms.py b/hypha/apply/categories/migrations/0003_rename_meta_categories_to_meta_terms.py index 76e8fa9ad6..d0184f9ef5 100644 --- a/hypha/apply/categories/migrations/0003_rename_meta_categories_to_meta_terms.py +++ b/hypha/apply/categories/migrations/0003_rename_meta_categories_to_meta_terms.py @@ -6,29 +6,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0002_metacategory'), + ("categories", "0002_metacategory"), ] operations = [ migrations.CreateModel( - name='MetaTerm', + name="MetaTerm", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('path', models.CharField(max_length=255, unique=True)), - ('depth', models.PositiveIntegerField()), - ('numchild', models.PositiveIntegerField(default=0)), - ('name', models.CharField(help_text='Keep the name short, ideally one word.', max_length=50, unique=True)), - ('is_archived', models.BooleanField(default=False, verbose_name='Archived')), - ('help_text', wagtail.fields.RichTextField(blank=True)), - ('filter_on_dashboard', models.BooleanField(default=True, help_text='Make available to filter on dashboard')), - ('available_to_applicants', models.BooleanField(default=False, help_text='Make available to applicants')), - ('node_order_index', models.IntegerField(blank=True, default=0, editable=False)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("path", models.CharField(max_length=255, unique=True)), + ("depth", models.PositiveIntegerField()), + ("numchild", models.PositiveIntegerField(default=0)), + ( + "name", + models.CharField( + help_text="Keep the name short, ideally one word.", + max_length=50, + unique=True, + ), + ), + ( + "is_archived", + models.BooleanField(default=False, verbose_name="Archived"), + ), + ("help_text", wagtail.fields.RichTextField(blank=True)), + ( + "filter_on_dashboard", + models.BooleanField( + default=True, help_text="Make available to filter on dashboard" + ), + ), + ( + "available_to_applicants", + models.BooleanField( + default=False, help_text="Make available to applicants" + ), + ), + ( + "node_order_index", + models.IntegerField(blank=True, default=0, editable=False), + ), ], options={ - 'verbose_name': 'Meta Term', - 'verbose_name_plural': 'Meta Terms', + "verbose_name": "Meta Term", + "verbose_name_plural": "Meta Terms", }, bases=(wagtail.search.index.Indexed, models.Model), ), diff --git a/hypha/apply/categories/migrations/0004_rename_meta_categories_to_meta_terms.py b/hypha/apply/categories/migrations/0004_rename_meta_categories_to_meta_terms.py index 75b2953ddc..7915bdfdb1 100644 --- a/hypha/apply/categories/migrations/0004_rename_meta_categories_to_meta_terms.py +++ b/hypha/apply/categories/migrations/0004_rename_meta_categories_to_meta_terms.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0003_rename_meta_categories_to_meta_terms'), - ('funds', '0070_rename_meta_categories_to_meta_terms'), + ("categories", "0003_rename_meta_categories_to_meta_terms"), + ("funds", "0070_rename_meta_categories_to_meta_terms"), ] operations = [ migrations.DeleteModel( - name='MetaCategory', + name="MetaCategory", ), ] diff --git a/hypha/apply/categories/migrations/0005_alter_is_archived_field_on_terms.py b/hypha/apply/categories/migrations/0005_alter_is_archived_field_on_terms.py index 5d34f431c5..06403469d1 100644 --- a/hypha/apply/categories/migrations/0005_alter_is_archived_field_on_terms.py +++ b/hypha/apply/categories/migrations/0005_alter_is_archived_field_on_terms.py @@ -4,15 +4,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0004_rename_meta_categories_to_meta_terms'), + ("categories", "0004_rename_meta_categories_to_meta_terms"), ] operations = [ migrations.AlterField( - model_name='metaterm', - name='is_archived', - field=models.BooleanField(default=False, help_text='Archived terms can be viewed but not set on content.', verbose_name='Archived'), + model_name="metaterm", + name="is_archived", + field=models.BooleanField( + default=False, + help_text="Archived terms can be viewed but not set on content.", + verbose_name="Archived", + ), ), ] diff --git a/hypha/apply/categories/migrations/0006_use_category_options_as_submission_filter.py b/hypha/apply/categories/migrations/0006_use_category_options_as_submission_filter.py index 624fbd8dd1..68f85e009f 100644 --- a/hypha/apply/categories/migrations/0006_use_category_options_as_submission_filter.py +++ b/hypha/apply/categories/migrations/0006_use_category_options_as_submission_filter.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0005_alter_is_archived_field_on_terms'), + ("categories", "0005_alter_is_archived_field_on_terms"), ] operations = [ migrations.AddField( - model_name='category', - name='filter_on_dashboard', - field=models.BooleanField(default=False, help_text='Make available to filter on dashboard'), + model_name="category", + name="filter_on_dashboard", + field=models.BooleanField( + default=False, help_text="Make available to filter on dashboard" + ), ), ] diff --git a/hypha/apply/categories/models.py b/hypha/apply/categories/models.py index e8ef4d7c10..dca6f99428 100644 --- a/hypha/apply/categories/models.py +++ b/hypha/apply/categories/models.py @@ -15,7 +15,7 @@ class Option(Orderable): value = models.CharField(max_length=255) - category = ParentalKey('Category', related_name='options') + category = ParentalKey("Category", related_name="options") def __str__(self): return self.value @@ -27,92 +27,100 @@ class Category(ClusterableModel): When used in a form: name -> field label and help_text -> help_text """ + name = models.CharField(max_length=255) filter_on_dashboard = models.BooleanField( - default=False, help_text=_('Make available to filter on dashboard') + default=False, help_text=_("Make available to filter on dashboard") ) help_text = models.CharField(max_length=255, blank=True) panels = [ - FieldPanel('name'), - FieldPanel('filter_on_dashboard'), - FieldPanel('help_text'), - InlinePanel('options', label=_('Options')), + FieldPanel("name"), + FieldPanel("filter_on_dashboard"), + FieldPanel("help_text"), + InlinePanel("options", label=_("Options")), ] def __str__(self): return self.name class Meta: - verbose_name_plural = 'Categories' + verbose_name_plural = "Categories" class MetaTerm(index.Indexed, MP_Node): - """ Hierarchal "Meta" terms """ + """Hierarchal "Meta" terms""" + name = models.CharField( - max_length=50, unique=True, help_text=_('Keep the name short, ideally one word.') + max_length=50, + unique=True, + help_text=_("Keep the name short, ideally one word."), ) is_archived = models.BooleanField( - default=False, verbose_name=_('Archived'), - help_text=_('Archived terms can be viewed but not set on content.') + default=False, + verbose_name=_("Archived"), + help_text=_("Archived terms can be viewed but not set on content."), ) filter_on_dashboard = models.BooleanField( - default=True, help_text=_('Make available to filter on dashboard') + default=True, help_text=_("Make available to filter on dashboard") ) available_to_applicants = models.BooleanField( - default=False, help_text=_('Make available to applicants') + default=False, help_text=_("Make available to applicants") + ) + help_text = RichTextField( + features=["h2", "h3", "bold", "italic", "link", "hr", "ol", "ul"], blank=True ) - help_text = RichTextField(features=[ - 'h2', 'h3', 'bold', 'italic', 'link', 'hr', 'ol', 'ul'], blank=True) # node tree specific fields and attributes node_order_index = models.IntegerField(blank=True, default=0, editable=False) - node_child_verbose_name = 'child' + node_child_verbose_name = "child" # important: node_order_by should NOT be changed after first Node created - node_order_by = ['node_order_index', 'name'] + node_order_by = ["node_order_index", "name"] panels = [ - FieldPanel('name'), - FieldPanel('parent'), + FieldPanel("name"), + FieldPanel("parent"), MultiFieldPanel( [ - FieldPanel('is_archived'), - FieldPanel('filter_on_dashboard'), - FieldPanel('available_to_applicants'), - FieldPanel('help_text'), + FieldPanel("is_archived"), + FieldPanel("filter_on_dashboard"), + FieldPanel("available_to_applicants"), + FieldPanel("help_text"), ], - heading=_('Options'), + heading=_("Options"), ), ] def get_as_listing_header(self): depth = self.get_depth() rendered = render_to_string( - 'categories/admin/includes/meta_term_list_header.html', + "categories/admin/includes/meta_term_list_header.html", { - 'depth': depth, - 'depth_minus_1': depth - 1, - 'is_root': self.is_root(), - 'name': self.name, - 'is_archived': self.is_archived, - } + "depth": depth, + "depth_minus_1": depth - 1, + "is_root": self.is_root(), + "name": self.name, + "is_archived": self.is_archived, + }, ) return rendered - get_as_listing_header.short_description = 'Name' - get_as_listing_header.admin_order_field = 'name' + + get_as_listing_header.short_description = "Name" + get_as_listing_header.admin_order_field = "name" def get_parent(self, *args, **kwargs): return super().get_parent(*args, **kwargs) - get_parent.short_description = 'Parent' + + get_parent.short_description = "Parent" search_fields = [ - index.SearchField('name', partial_match=True), + index.SearchField("name", partial_match=True), ] def delete(self): if self.is_root(): - raise PermissionDenied('Cannot delete root term.') + raise PermissionDenied("Cannot delete root term.") else: super().delete() @@ -128,13 +136,13 @@ def __str__(self): return self.name class Meta: - verbose_name = 'Meta Term' - verbose_name_plural = 'Meta Terms' + verbose_name = "Meta Term" + verbose_name_plural = "Meta Terms" class MetaTermChoiceField(forms.ModelChoiceField): def label_from_instance(self, obj): - depth_line = '-' * (obj.get_depth() - 1) + depth_line = "-" * (obj.get_depth() - 1) return "{} {}".format(depth_line, super().label_from_instance(obj)) @@ -147,29 +155,31 @@ class MetaTermForm(WagtailAdminModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - instance = kwargs['instance'] + instance = kwargs["instance"] if instance.is_root() or MetaTerm.objects.count() == 0: - self.fields['parent'].disabled = True - self.fields['parent'].required = False - self.fields['parent'].empty_label = 'N/A - Root Term' - self.fields['parent'].widget = forms.HiddenInput() + self.fields["parent"].disabled = True + self.fields["parent"].required = False + self.fields["parent"].empty_label = "N/A - Root Term" + self.fields["parent"].widget = forms.HiddenInput() - self.fields['name'].label += ' (Root - First term can be named root)' + self.fields["name"].label += " (Root - First term can be named root)" elif instance.id: - self.fields['parent'].initial = instance.get_parent() + self.fields["parent"].initial = instance.get_parent() def clean_parent(self): - parent = self.cleaned_data['parent'] + parent = self.cleaned_data["parent"] if parent and parent.is_archived: - raise forms.ValidationError('The parent is archived therefore can not add child under it.') + raise forms.ValidationError( + "The parent is archived therefore can not add child under it." + ) return parent def save(self, commit=True, *args, **kwargs): instance = super().save(*args, **kwargs, commit=False) - parent = self.cleaned_data['parent'] + parent = self.cleaned_data["parent"] if not commit: return instance @@ -182,7 +192,7 @@ def save(self, commit=True, *args, **kwargs): else: instance.save() if instance.get_parent() != parent: - instance.move(parent, pos='sorted-child') + instance.move(parent, pos="sorted-child") return instance diff --git a/hypha/apply/categories/templates/categories/admin/includes/meta_term_list_header.html b/hypha/apply/categories/templates/categories/admin/includes/meta_term_list_header.html index 4350cfd26e..e4d90faf94 100644 --- a/hypha/apply/categories/templates/categories/admin/includes/meta_term_list_header.html +++ b/hypha/apply/categories/templates/categories/admin/includes/meta_term_list_header.html @@ -6,9 +6,9 @@ {% if is_archived %} - {{ name }} ({% trans "archived" %}) + {{ name }} ({% trans "archived" %}) {% else %} - {{ name }} + {{ name }} {% endif %} {% endif %} diff --git a/hypha/apply/categories/tests/factories.py b/hypha/apply/categories/tests/factories.py index d63bc904a8..2b380422cc 100644 --- a/hypha/apply/categories/tests/factories.py +++ b/hypha/apply/categories/tests/factories.py @@ -7,13 +7,13 @@ class CategoryFactory(factory.django.DjangoModelFactory): class Meta: model = Category - name = factory.Faker('word') - help_text = factory.Faker('sentence') + name = factory.Faker("word") + help_text = factory.Faker("sentence") class OptionFactory(factory.django.DjangoModelFactory): class Meta: model = Option - value = factory.Faker('word') + value = factory.Faker("word") category = factory.SubFactory(CategoryFactory) diff --git a/hypha/apply/categories/tests/test_blocks.py b/hypha/apply/categories/tests/test_blocks.py index f4f90c83fb..c940d7642f 100644 --- a/hypha/apply/categories/tests/test_blocks.py +++ b/hypha/apply/categories/tests/test_blocks.py @@ -14,10 +14,10 @@ def setUp(self): def get_field(self, **kwargs): data = { - 'field_label': '', - 'help_text': '', - 'category': self.category.id, - 'multi': False, + "field_label": "", + "help_text": "", + "category": self.category.id, + "multi": False, } data.update(kwargs) @@ -26,15 +26,15 @@ def get_field(self, **kwargs): return self.block.get_field(block) def test_field_and_help_default(self): - field = self.get_field(field_label='', help_text='') + field = self.get_field(field_label="", help_text="") self.assertEqual(self.category.name, field.label) self.assertEqual(self.category.help_text, field.help_text) def test_supplied_field_and_help(self): - values = {'field_label': 'LABEL', 'help_text': 'HELP'} + values = {"field_label": "LABEL", "help_text": "HELP"} field = self.get_field(**values) - self.assertEqual(values['field_label'], field.label) - self.assertEqual(values['help_text'], field.help_text) + self.assertEqual(values["field_label"], field.label) + self.assertEqual(values["help_text"], field.help_text) def test_multi_select_enabled(self): field = self.get_field(multi=True) @@ -50,9 +50,9 @@ def test_options_included_in_choices(self): field = self.get_field() self.assertEqual( field.choices, - [(option.id, option.value) for option in self.category.options.all()] + [(option.id, option.value) for option in self.category.options.all()], ) def test_can_render_if_no_response(self): - display = self.block.render({'category': self.category}, {'data': None}) + display = self.block.render({"category": self.category}, {"data": None}) self.assertIn(self.block.no_response()[0], display) diff --git a/hypha/apply/dashboard/apps.py b/hypha/apply/dashboard/apps.py index c694d18cb5..f4704c7449 100644 --- a/hypha/apply/dashboard/apps.py +++ b/hypha/apply/dashboard/apps.py @@ -2,4 +2,4 @@ class DashboardConfig(AppConfig): - name = 'hypha.apply.dashboard' + name = "hypha.apply.dashboard" diff --git a/hypha/apply/dashboard/static/js/django_select2-checkboxes.js b/hypha/apply/dashboard/static/js/django_select2-checkboxes.js index e64657c6d7..40abe6a090 100644 --- a/hypha/apply/dashboard/static/js/django_select2-checkboxes.js +++ b/hypha/apply/dashboard/static/js/django_select2-checkboxes.js @@ -1,31 +1,39 @@ -(function($) { - $.fn.select2.amd.require( - [ - 'select2/multi-checkboxes/selection', - 'select2/multi-checkboxes/results' - ], - function(SelectionAdapter, ResultsAdapter) { +(function ($) { + $.fn.select2.amd.require( + [ + "select2/multi-checkboxes/selection", + "select2/multi-checkboxes/results", + ], + function (SelectionAdapter, ResultsAdapter) { + $(function () { + $(".django-select2-checkboxes").each(function (i, element) { + var $element = $(element); + $element.select2({ + placeholder: $element.data("placeholder"), + closeOnSelect: false, + templateSelection: function (data) { + let filterType = $element.data("placeholder"); - $(function () { - $('.django-select2-checkboxes').each(function (i, element) { - var $element = $(element); - $element.select2({ - placeholder: $element.data('placeholder'), - closeOnSelect: false, - templateSelection: function(data) { - let filterType = $element.data('placeholder'); - - if (!data.selected.length) { - return filterType - } else if (data.selected.length == data.all.length) { - return 'All ' + filterType + ' selected'; - } - return data.selected.length + ' of ' + data.all.length + ' ' + filterType; - }, - selectionAdapter: SelectionAdapter, - returnesultsAdapter: ResultsAdapter + if (!data.selected.length) { + return filterType; + } else if ( + data.selected.length == data.all.length + ) { + return "All " + filterType + " selected"; + } + return ( + data.selected.length + + " of " + + data.all.length + + " " + + filterType + ); + }, + selectionAdapter: SelectionAdapter, + returnesultsAdapter: ResultsAdapter, + }); + }); }); - }); - }); - }); -}(this.jQuery)); + } + ); +})(this.jQuery); diff --git a/hypha/apply/dashboard/static/js/select2.multi-checkboxes.js b/hypha/apply/dashboard/static/js/select2.multi-checkboxes.js index 815268be46..9faf906943 100644 --- a/hypha/apply/dashboard/static/js/select2.multi-checkboxes.js +++ b/hypha/apply/dashboard/static/js/select2.multi-checkboxes.js @@ -9,118 +9,121 @@ */ /* global define jQuery */ -(function(factory) { - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } else { - // Browser globals - factory(jQuery); - } -}(function(jQuery) { - if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { - define = jQuery.fn.select2.amd.define; - } - var define; - - /* global define */ - define('select2/multi-checkboxes/dropdown', [ - 'select2/utils', - 'select2/dropdown', - 'select2/dropdown/search', - 'select2/dropdown/attachBody' - ], - function(Utils, Dropdown, DropdownSearch, AttachBody) { - return Utils.Decorate( - Utils.Decorate( - Dropdown, - DropdownSearch - ), - AttachBody - ); - }); - - - /* global define */ - define('select2/multi-checkboxes/results', [ - 'jquery', - 'select2/utils', - 'select2/results' - ], - function($, Utils, _Results) { - function Results() { - Results.__super__.constructor.apply(this, arguments); +(function (factory) { + if (typeof define === "function" && define.amd) { + define(["jquery"], factory); + } else { + // Browser globals + factory(jQuery); } - Utils.Extend(Results, _Results); - - Results.prototype.highlightFirstItem = function() { - this.ensureHighlightVisible(); - }; - - Results.prototype.bind = function(container) { - container.on('open', function() { - var $options = this.$results.find('.select2-results__option[aria-selected]'); - var $selected = $options.filter('[aria-selected=true]'); - var $optionToScrollTo = ($selected.length > 0 ? $selected : $selected).first(); - $optionToScrollTo.trigger('mouseenter'); - }); - Results.__super__.bind.apply(this, arguments); - }; - - Results.prototype.template = function(result, container) { - var template = this.options.get('templateResult'); - var escapeMarkup = this.options.get('escapeMarkup'); - - var content = template(result, container); - $(container).addClass('multi-checkboxes_wrap'); - - if (content == null) { - container.style.display = 'none'; - } else if (typeof content === 'string') { - container.innerHTML = escapeMarkup(content); - } else { - $(container).append(content); - } - }; - - return Results; - }); +})(function (jQuery) { + if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { + define = jQuery.fn.select2.amd.define; + } + var define; + + /* global define */ + define("select2/multi-checkboxes/dropdown", [ + "select2/utils", + "select2/dropdown", + "select2/dropdown/search", + "select2/dropdown/attachBody", + ], function (Utils, Dropdown, DropdownSearch, AttachBody) { + return Utils.Decorate( + Utils.Decorate(Dropdown, DropdownSearch), + AttachBody + ); + }); + + /* global define */ + define("select2/multi-checkboxes/results", [ + "jquery", + "select2/utils", + "select2/results", + ], function ($, Utils, _Results) { + function Results() { + Results.__super__.constructor.apply(this, arguments); + } + Utils.Extend(Results, _Results); + + Results.prototype.highlightFirstItem = function () { + this.ensureHighlightVisible(); + }; + Results.prototype.bind = function (container) { + container.on("open", function () { + var $options = this.$results.find( + ".select2-results__option[aria-selected]" + ); + var $selected = $options.filter("[aria-selected=true]"); + var $optionToScrollTo = ( + $selected.length > 0 ? $selected : $selected + ).first(); + $optionToScrollTo.trigger("mouseenter"); + }); + Results.__super__.bind.apply(this, arguments); + }; - /* global define */ - define('select2/multi-checkboxes/selection', [ - 'select2/utils', - 'select2/selection/multiple', - 'select2/selection/placeholder', - 'select2/selection/single', - 'select2/selection/eventRelay' - ], - function(Utils, MultipleSelection, Placeholder, SingleSelection, EventRelay) { - var adapter = Utils.Decorate(MultipleSelection, Placeholder); - adapter = Utils.Decorate(adapter, EventRelay); + Results.prototype.template = function (result, container) { + var template = this.options.get("templateResult"); + var escapeMarkup = this.options.get("escapeMarkup"); - adapter.prototype.render = function() { - return SingleSelection.prototype.render.call(this); - }; + var content = template(result, container); + $(container).addClass("multi-checkboxes_wrap"); - adapter.prototype.update = function(data) { - var $rendered = this.$selection.find('.select2-selection__rendered'); - var formatted = ''; + if (content == null) { + container.style.display = "none"; + } else if (typeof content === "string") { + container.innerHTML = escapeMarkup(content); + } else { + $(container).append(content); + } + }; - if (data.length === 0) { - formatted = this.options.get('placeholder') || ''; - } else { - var itemsData = { - selected: data || [], - all: this.$element.find('option') || [] + return Results; + }); + + /* global define */ + define("select2/multi-checkboxes/selection", [ + "select2/utils", + "select2/selection/multiple", + "select2/selection/placeholder", + "select2/selection/single", + "select2/selection/eventRelay", + ], function ( + Utils, + MultipleSelection, + Placeholder, + SingleSelection, + EventRelay + ) { + var adapter = Utils.Decorate(MultipleSelection, Placeholder); + adapter = Utils.Decorate(adapter, EventRelay); + + adapter.prototype.render = function () { + return SingleSelection.prototype.render.call(this); }; - formatted = this.display(itemsData, $rendered); - } - $rendered.empty().append(formatted); - $rendered.prop('title', formatted); - }; + adapter.prototype.update = function (data) { + var $rendered = this.$selection.find( + ".select2-selection__rendered" + ); + var formatted = ""; + + if (data.length === 0) { + formatted = this.options.get("placeholder") || ""; + } else { + var itemsData = { + selected: data || [], + all: this.$element.find("option") || [], + }; + formatted = this.display(itemsData, $rendered); + } + + $rendered.empty().append(formatted); + $rendered.prop("title", formatted); + }; - return adapter; - }); -}) -); + return adapter; + }); +}); diff --git a/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html b/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html index 3b58a3b02f..b83e83de14 100644 --- a/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html @@ -16,69 +16,69 @@

{% trans "Submit a new application" %}

{% endadminbar %} -
-

- {% trans "Your active submissions" %} -

-
- {% for submission in my_active_submissions %} -
-
-
-
-

- - {{ submission.title }} - -

-

- {% trans "Submitted" %}: {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }} -

-
- {% if request.user|has_edit_perm:submission %} -
- - {% if submission.status == 'draft_proposal' %} - {% trans "Start your" %} {{ submission.stage }} {% trans "application" %} - {% else %} - - {% heroicon_mini "pencil-square" size=18 class="inline mr-1 align-text-bottom" aria_hidden=true %} - {% trans "Edit" %} - +
+

+ {% trans "Your active submissions" %} +

+
+ {% for submission in my_active_submissions %} +
+ + {% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %} +
- {% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %} -
+ {% empty %} + {% trans "No active submissions" %} + {% endfor %}
- {% empty %} - {% trans "No active submissions" %} - {% endfor %}
-
-{% if active_projects.count %} -
-

{% trans "Your active projects" %}

- {% render_table active_projects.table %} -
-{% endif %} + {% if active_projects.count %} +
+

{% trans "Your active projects" %}

+ {% render_table active_projects.table %} +
+ {% endif %} -{% if historical_submissions.count %} -
-

{% trans "Submission history" %}

- {% render_table historical_submissions.table %} -
-{% endif %} + {% if historical_submissions.count %} +
+

{% trans "Submission history" %}

+ {% render_table historical_submissions.table %} +
+ {% endif %} -{% if historical_projects.count %} -
-

{% trans "Project history" %}

- {% render_table historical_projects.table %} -
-{% endif %} + {% if historical_projects.count %} +
+

{% trans "Project history" %}

+ {% render_table historical_projects.table %} +
+ {% endif %} {% endblock %} diff --git a/hypha/apply/dashboard/templates/dashboard/community_dashboard.html b/hypha/apply/dashboard/templates/dashboard/community_dashboard.html index 9d6f915a16..641de6d260 100644 --- a/hypha/apply/dashboard/templates/dashboard/community_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/community_dashboard.html @@ -59,18 +59,18 @@

{% if request.user|has_edit_perm:submission %} - + {% endif %}
diff --git a/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html b/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html index 2439a27e51..a382b38822 100644 --- a/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html @@ -14,22 +14,22 @@ {% endadminbar %} -
- {% if paf_waiting_for_approval.count %} - {% include "dashboard/includes/paf_waiting_for_approval.html" with paf_waiting_for_approval=paf_waiting_for_approval %} - {% endif %} +
+ {% if paf_waiting_for_approval.count %} + {% include "dashboard/includes/paf_waiting_for_approval.html" with paf_waiting_for_approval=paf_waiting_for_approval %} + {% endif %} - {% if paf_waiting_for_assignment.count %} -
-

{% trans "PAF waiting for assignee" %}

- {% render_table paf_waiting_for_assignment.table %} -
- {% endif %} + {% if paf_waiting_for_assignment.count %} +
+

{% trans "PAF waiting for assignee" %}

+ {% render_table paf_waiting_for_assignment.table %} +
+ {% endif %} - {% if projects_in_contracting.count %} - {% include "dashboard/includes/projects_in_contracting.html" with projects_in_contracting=projects_in_contracting %} - {% endif %} -
+ {% if projects_in_contracting.count %} + {% include "dashboard/includes/projects_in_contracting.html" with projects_in_contracting=projects_in_contracting %} + {% endif %} +
{% endblock %} {% block extra_js %} diff --git a/hypha/apply/dashboard/templates/dashboard/dashboard.html b/hypha/apply/dashboard/templates/dashboard/dashboard.html index 9502418782..bdd7c86a0e 100644 --- a/hypha/apply/dashboard/templates/dashboard/dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/dashboard.html @@ -22,104 +22,104 @@ {% endif %} {% endadminbar %} -
-
-
- -

{{ awaiting_reviews.count }}

-

{% trans "Submissions waiting for your review" %}

- {% if awaiting_reviews.count %} -
{% trans "View" %}
- {% endif %} -
- -

{{ projects.count }}

-

{% trans "Live projects under your management" %}

- {% if projects.count %} -
{% trans "View" %}
- {% endif %} -
- {% if not paf_waiting_for_approval.count is None%} - -

{{ paf_waiting_for_approval.count }}

-

{% trans "Projects awaiting approval" %}

- {% if paf_waiting_for_approval.count %} -
{% trans "View" %}
- {% endif %} -
- {% endif %} - -

{{ active_invoices.count }}

-

{% trans "Requests for invoices requiring your attention" %}

- {% if active_invoices.count %} -
{% trans "View" %}
+
-
- {% include "dashboard/includes/submissions-waiting-for-review.html" with in_review_count=awaiting_reviews.count my_review=awaiting_reviews.table display_more=awaiting_reviews.display_more active_statuses_filter=awaiting_reviews.active_statuses_filter %} -
+
+ {% include "dashboard/includes/submissions-waiting-for-review.html" with in_review_count=awaiting_reviews.count my_review=awaiting_reviews.table display_more=awaiting_reviews.display_more active_statuses_filter=awaiting_reviews.active_statuses_filter %} +
- {% if my_flagged.table.data %} -
- {% include "dashboard/includes/flagged.html" with my_flagged=my_flagged.table display_more=my_flagged.display_more %} -
- {% endif %} + {% if my_flagged.table.data %} +
+ {% include "dashboard/includes/flagged.html" with my_flagged=my_flagged.table display_more=my_flagged.display_more %} +
+ {% endif %} + + {% if rounds.closed or rounds.open %} + {% include "funds/includes/round-block.html" with closed_rounds=rounds.closed open_rounds=rounds.open title="Your rounds and labs" page_type='dashboard' %} + {% endif %} - {% if rounds.closed or rounds.open %} - {% include "funds/includes/round-block.html" with closed_rounds=rounds.closed open_rounds=rounds.open title="Your rounds and labs" page_type='dashboard' %} - {% endif %} + {% if paf_waiting_for_approval.count %} + {% include "dashboard/includes/paf_waiting_for_approval.html" with paf_waiting_for_approval=paf_waiting_for_approval %} + {% endif %} - {% if paf_waiting_for_approval.count %} - {% include "dashboard/includes/paf_waiting_for_approval.html" with paf_waiting_for_approval=paf_waiting_for_approval %} - {% endif %} + {% if paf_waiting_for_assignment.count %} +
+

{% trans "PAF waiting for assignee" %}

+ {% render_table paf_waiting_for_assignment.table %} +
+ {% endif %} - {% if paf_waiting_for_assignment.count %} -
-

{% trans "PAF waiting for assignee" %}

- {% render_table paf_waiting_for_assignment.table %} -
- {% endif %} + {% if projects.table.data %} +
+ {% trans "Your projects" as project_heading %} + {% include "funds/includes/table_filter_and_search.html" with filter=projects.filterset filter_action=projects.url search_term=search_term search_action=projects.url search_placeholder="projects" use_search=True use_batch_actions=False heading="Your projects" %} + {% render_table projects.table %} - {% if projects.table.data %} -
- {% trans "Your projects" as project_heading %} - {% include "funds/includes/table_filter_and_search.html" with filter=projects.filterset filter_action=projects.url search_term=search_term search_action=projects.url search_placeholder="projects" use_search=True use_batch_actions=False heading="Your projects" %} - {% render_table projects.table %} + {% if projects.display_more %} + + {% endif %} - {% if projects.display_more %} - +
{% endif %} -
- {% endif %} + {% if active_invoices.count %} +
+

{% trans "Active Invoices" %}

+ {% render_table active_invoices.table %} +
+ {% endif %} - {% if active_invoices.count %} -
-

{% trans "Active Invoices" %}

- {% render_table active_invoices.table %} -
- {% endif %} + {% if my_reviewed.table.data %} +
+ {% trans "Your previous reviews" as review_heading %} + {% include "funds/includes/table_filter_and_search.html" with filter=my_reviewed.filterset filter_action=my_reviewed.url search_term=search_term search_action=my_reviewed.url use_search=True use_batch_actions=False heading=review_heading %} + {% render_table my_reviewed.table %} - {% if my_reviewed.table.data %} -
- {% trans "Your previous reviews" as review_heading %} - {% include "funds/includes/table_filter_and_search.html" with filter=my_reviewed.filterset filter_action=my_reviewed.url search_term=search_term search_action=my_reviewed.url use_search=True use_batch_actions=False heading=review_heading %} - {% render_table my_reviewed.table %} - - {% if my_reviewed.display_more %} - - {% endif %} -
- {% endif %} + {% if my_reviewed.display_more %} + + {% endif %} +
+ {% endif %} -
+
{% endblock %} {% block extra_js %} diff --git a/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html b/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html index f46efa0278..2b0e6f9a5d 100644 --- a/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html @@ -16,35 +16,35 @@

{% trans 'Invoices' %}

@@ -84,16 +84,16 @@

{% trans 'Invoices' %} - {% if paf_waiting_for_approval.count %} - {% include "dashboard/includes/paf_waiting_for_approval.html" with paf_waiting_for_approval=paf_waiting_for_approval %} - {% endif %} + {% if paf_waiting_for_approval.count %} + {% include "dashboard/includes/paf_waiting_for_approval.html" with paf_waiting_for_approval=paf_waiting_for_approval %} + {% endif %} - {% if paf_waiting_for_assignment.count %} -
-

{% trans "PAF waiting for assignee" %}

- {% render_table paf_waiting_for_assignment.table %} -
- {% endif %} + {% if paf_waiting_for_assignment.count %} +
+

{% trans "PAF waiting for assignee" %}

+ {% render_table paf_waiting_for_assignment.table %} +
+ {% endif %}

{% endblock %} diff --git a/hypha/apply/dashboard/templates/dashboard/includes/paf_waiting_for_approval.html b/hypha/apply/dashboard/templates/dashboard/includes/paf_waiting_for_approval.html index 3464bc2401..0fdfcaa1a5 100644 --- a/hypha/apply/dashboard/templates/dashboard/includes/paf_waiting_for_approval.html +++ b/hypha/apply/dashboard/templates/dashboard/includes/paf_waiting_for_approval.html @@ -8,20 +8,20 @@

diff --git a/hypha/apply/dashboard/templates/dashboard/includes/projects_in_contracting.html b/hypha/apply/dashboard/templates/dashboard/includes/projects_in_contracting.html index 968d78503b..157854bc4d 100644 --- a/hypha/apply/dashboard/templates/dashboard/includes/projects_in_contracting.html +++ b/hypha/apply/dashboard/templates/dashboard/includes/projects_in_contracting.html @@ -8,20 +8,20 @@

diff --git a/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html b/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html index ff466c71f6..8ff142e2a6 100644 --- a/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html @@ -13,52 +13,52 @@ {% endadminbar %} -
+
-
-

- {% trans "You are the partner of these submissions" %} {{ partner_submissions_count }} -

+
+

+ {% trans "You are the partner of these submissions" %} {{ partner_submissions_count }} +

- {% if partner_submissions.data %} - {% render_table partner_submissions %} - {% else %} - {% trans "No submissions" %} - {% endif %} -
+ {% if partner_submissions.data %} + {% render_table partner_submissions %} + {% else %} + {% trans "No submissions" %} + {% endif %} +
-
-

{% trans "Your active submissions" %}

- {% for submission in my_submissions %} -
-
-
-
{{ submission.title }}
-
{% trans "Submitted" %}: {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }}
+
+

{% trans "Your active submissions" %}

+ {% for submission in my_submissions %} +
+
+
+
{{ submission.title }}
+
{% trans "Submitted" %}: {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }}
+
+ {% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %}
- {% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %} + {% if request.user|has_edit_perm:submission %} + + {% if submission.status == 'draft_proposal' %} + {% trans "Start your" %} {{ submission.stage }} {% trans "application" %} + {% else %} + {% trans "Edit" %} + {% endif %} + + {% endif %}
- {% if request.user|has_edit_perm:submission %} - - {% if submission.status == 'draft_proposal' %} - {% trans "Start your" %} {{ submission.stage }} {% trans "application" %} - {% else %} - {% trans "Edit" %} - {% endif %} - - {% endif %} + {% empty %} + {% trans "No active submissions" %} + {% endfor %} +
+ + {% if my_inactive_submissions.data %} +
+

{% trans "Submission history" %}

+ {% render_table my_inactive_submissions %}
- {% empty %} - {% trans "No active submissions" %} - {% endfor %} + {% endif %}
- {% if my_inactive_submissions.data %} -
-

{% trans "Submission history" %}

- {% render_table my_inactive_submissions %} -
- {% endif %} -
- {% endblock %} diff --git a/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html b/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html index f977fa5998..1d6d0c05b6 100644 --- a/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html @@ -14,79 +14,79 @@ {% slot header %}{% trans "Dashboard" %}{% endslot %} {% endadminbar %} -
+
-
- {% include "dashboard/includes/submissions-waiting-for-review.html" with in_review_count=awaiting_reviews.count my_review=awaiting_reviews.table display_more=awaiting_reviews.display_more active_statuses_filter=awaiting_reviews.active_statuses_filter %} -
- - {% if my_flagged.table.data %} -
- {% include "dashboard/includes/flagged.html" with my_flagged=my_flagged.table display_more=my_flagged.display_more %} -
- {% endif %} - - {% if my_reviewed.table.data %}
+ {% include "dashboard/includes/submissions-waiting-for-review.html" with in_review_count=awaiting_reviews.count my_review=awaiting_reviews.table display_more=awaiting_reviews.display_more active_statuses_filter=awaiting_reviews.active_statuses_filter %} +
- {% trans "Your previous reviews" as review_heading %} - {% include "funds/includes/table_filter_and_search.html" with filter=my_reviewed.filterset filter_action=my_reviewed.url search_term=search_term search_action=my_reviewed.url use_search=True use_batch_actions=False heading=review_heading %} - {% render_table my_reviewed.table %} + {% if my_flagged.table.data %} +
+ {% include "dashboard/includes/flagged.html" with my_flagged=my_flagged.table display_more=my_flagged.display_more %} +
+ {% endif %} - {% if my_reviewed.display_more %} - - {% endif %} -
- {% endif %} + {% if my_reviewed.table.data %} +
+ + {% trans "Your previous reviews" as review_heading %} + {% include "funds/includes/table_filter_and_search.html" with filter=my_reviewed.filterset filter_action=my_reviewed.url search_term=search_term search_action=my_reviewed.url use_search=True use_batch_actions=False heading=review_heading %} + {% render_table my_reviewed.table %} - {% if my_submissions %} -
-

- {% trans "Your active submissions" %} -

- {% for submission in my_submissions %} -
-
-
-
{{ submission.title }}
-
{% trans "Submitted" %}: {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }}
+ {% if my_reviewed.display_more %} + - {% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %} -
- {% if request.user|has_edit_perm:submission %} - - {% if submission.status == 'draft_proposal' %} - {% trans "Start your" %} {{ submission.stage }} {% trans "application" %} - {% else %} - {% trans "Edit" %} - {% endif %} - {% endif %}
- {% endfor %} -
- {% endif %} + {% endif %} - {% if paf_waiting_for_assignment.count %} -
-

- {% trans "PAF waiting for assignee" %} -

- {% render_table paf_waiting_for_assignment.table %} -
- {% endif %} + {% if my_submissions %} +
+

+ {% trans "Your active submissions" %} +

+ {% for submission in my_submissions %} +
+
+
+
{{ submission.title }}
+
{% trans "Submitted" %}: {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }}
+
+ {% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %} +
+ {% if request.user|has_edit_perm:submission %} + + {% if submission.status == 'draft_proposal' %} + {% trans "Start your" %} {{ submission.stage }} {% trans "application" %} + {% else %} + {% trans "Edit" %} + {% endif %} + + {% endif %} +
+ {% endfor %} +
+ {% endif %} - {% if my_inactive_submissions.data %} -
-

- {% trans "Submission history" %} -

- {% render_table my_inactive_submissions %} -
- {% endif %} -
+ {% if paf_waiting_for_assignment.count %} +
+

+ {% trans "PAF waiting for assignee" %} +

+ {% render_table paf_waiting_for_assignment.table %} +
+ {% endif %} + + {% if my_inactive_submissions.data %} +
+

+ {% trans "Submission history" %} +

+ {% render_table my_inactive_submissions %} +
+ {% endif %} +
{% endblock %} diff --git a/hypha/apply/dashboard/tests/test_views.py b/hypha/apply/dashboard/tests/test_views.py index 635d6740e2..980dd6dcce 100644 --- a/hypha/apply/dashboard/tests/test_views.py +++ b/hypha/apply/dashboard/tests/test_views.py @@ -26,14 +26,16 @@ class TestApplicantDashboard(BaseViewTestCase): user_factory = ApplicantFactory - url_name = 'dashboard:{}' - base_view_name = 'dashboard' + url_name = "dashboard:{}" + base_view_name = "dashboard" def test_can_access_dashboard_with_active(self): - application = ApplicationSubmissionFactory(user=self.user, form_data__title='Improve the internet') + application = ApplicationSubmissionFactory( + user=self.user, form_data__title="Improve the internet" + ) response = self.get_page() self.assertContains(response, application.title) - self.assertNotContains(response, 'Submission history') + self.assertNotContains(response, "Submission history") def test_can_have_draft_titles_on_dashboard(self): submission = ApplicationSubmissionFactory(user=self.user) @@ -43,58 +45,75 @@ def test_can_have_draft_titles_on_dashboard(self): response = self.get_page() self.assertNotContains(response, submission.title) self.assertContains(response, submission.from_draft().title) - self.assertNotContains(response, 'Submission history') + self.assertNotContains(response, "Submission history") def test_can_not_access_other_users_active(self): - application = ApplicationSubmissionFactory(form_data__title='Ruin the internet') + application = ApplicationSubmissionFactory(form_data__title="Ruin the internet") response = self.get_page() self.assertNotContains(response, application.title) - self.assertNotContains(response, 'Submission history') + self.assertNotContains(response, "Submission history") def test_gets_invite_if_invited_to_proposal(self): InvitedToProposalFactory(user=self.user, draft=True) response = self.get_page() - self.assertContains(response, 'Start your ') + self.assertContains(response, "Start your ") def test_no_invite_if_can_edit(self): - ApplicationSubmissionFactory(user=self.user, status='concept_more_info', workflow_stages=2) + ApplicationSubmissionFactory( + user=self.user, status="concept_more_info", workflow_stages=2 + ) response = self.get_page() - self.assertNotContains(response, 'Start your ') - self.assertContains(response, 'Edit', 1) + self.assertNotContains(response, "Start your ") + self.assertContains(response, "Edit", 1) def test_no_edit_if_in_review(self): - ApplicationSubmissionFactory(user=self.user, status='internal_review') + ApplicationSubmissionFactory(user=self.user, status="internal_review") response = self.get_page() - self.assertNotContains(response, 'Edit') - self.assertNotContains(response, 'Submission history') + self.assertNotContains(response, "Edit") + self.assertNotContains(response, "Submission history") class TestStaffDashboard(BaseViewTestCase): user_factory = StaffFactory - url_name = 'dashboard:{}' - base_view_name = 'dashboard' + url_name = "dashboard:{}" + base_view_name = "dashboard" def test_cannot_see_submission_in_determination_when_not_lead(self): - ApplicationSubmissionFactory(status='concept_review_discussion', workflow_stages=2, form_data__title='Reviewr') + ApplicationSubmissionFactory( + status="concept_review_discussion", + workflow_stages=2, + form_data__title="Reviewr", + ) response = self.get_page() - self.assertNotContains(response, 'Reviewr') + self.assertNotContains(response, "Reviewr") def test_waiting_for_review_with_count(self): - submission = ApplicationSubmissionFactory(status='external_review', workflow_stages=2, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="external_review", workflow_stages=2, reviewers=[self.user] + ) response = self.get_page() - self.assertContains(response, 'Submissions waiting for your review') + self.assertContains(response, "Submissions waiting for your review") self.assertContains(response, submission.title) - self.assertEqual(response.context['awaiting_reviews']['count'], 1) + self.assertEqual(response.context["awaiting_reviews"]["count"], 1) def test_waiting_for_review_after_agreement_is_empty(self): staff = StaffFactory() - submission = ApplicationSubmissionFactory(status='external_review', workflow_stages=2, reviewers=[staff, self.user]) - review = ReviewFactory(submission=submission, author__reviewer=staff, author__staff=True, recommendation_yes=True) - ReviewOpinionFactory(review=review, author__reviewer=self.user, opinion_agree=True) - response = self.get_page() - self.assertContains(response, 'Submissions waiting for your review') + submission = ApplicationSubmissionFactory( + status="external_review", workflow_stages=2, reviewers=[staff, self.user] + ) + review = ReviewFactory( + submission=submission, + author__reviewer=staff, + author__staff=True, + recommendation_yes=True, + ) + ReviewOpinionFactory( + review=review, author__reviewer=self.user, opinion_agree=True + ) + response = self.get_page() + self.assertContains(response, "Submissions waiting for your review") self.assertContains(response, "Nice! You're all caught up.") - self.assertEqual(response.context['awaiting_reviews']['count'], 0) + self.assertEqual(response.context["awaiting_reviews"]["count"], 0) def test_active_invoices_with_no_project(self): response = self.get_page() @@ -141,54 +160,60 @@ def test_unassigned_staff_cant_see_projects_awaiting_review_stats_or_table(self) class TestStaffDashboardWithWagtailAdminAccess(BaseViewTestCase): user_factory = StaffWithWagtailAdminAccessFactory - url_name = 'dashboard:{}' - base_view_name = 'dashboard' + url_name = "dashboard:{}" + base_view_name = "dashboard" def test_does_show_admin_button_to_staff_with_wagtail_admin_access(self): response = self.get_page() - self.assertContains(response, 'wagtail-admin-button') + self.assertContains(response, "wagtail-admin-button") class TestStaffDashboardWithoutWagtailAdminAccess(BaseViewTestCase): user_factory = StaffWithoutWagtailAdminAccessFactory - url_name = 'dashboard:{}' - base_view_name = 'dashboard' + url_name = "dashboard:{}" + base_view_name = "dashboard" def test_doesnt_show_admin_button_to_staff_without_wagtail_admin_access(self): response = self.get_page() - self.assertNotContains(response, 'wagtail-admin-button') + self.assertNotContains(response, "wagtail-admin-button") class TestReviewerDashboard(BaseViewTestCase): user_factory = ReviewerFactory - url_name = 'dashboard:{}' - base_view_name = 'dashboard' + url_name = "dashboard:{}" + base_view_name = "dashboard" def test_waiting_for_review_with_count(self): - submission = ApplicationSubmissionFactory(status='external_review', workflow_stages=2, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="external_review", workflow_stages=2, reviewers=[self.user] + ) response = self.get_page() - self.assertContains(response, 'Submissions waiting for your review') + self.assertContains(response, "Submissions waiting for your review") self.assertContains(response, submission.title) - self.assertEqual(response.context['in_review_count'], 1) + self.assertEqual(response.context["in_review_count"], 1) def test_no_submissions_waiting_for_review(self): - submission = ApplicationSubmissionFactory(status='external_review', workflow_stages=2, reviewers=[]) + submission = ApplicationSubmissionFactory( + status="external_review", workflow_stages=2, reviewers=[] + ) response = self.get_page() self.assertNotContains(response, submission.title) - self.assertEqual(response.context['in_review_count'], 0) + self.assertEqual(response.context["in_review_count"], 0) def test_submission_assigned_but_not_in_external_review_status(self): - submission = ApplicationSubmissionFactory(status='concept_review_discussion', workflow_stages=2, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="concept_review_discussion", workflow_stages=2, reviewers=[self.user] + ) response = self.get_page() self.assertNotContains(response, submission.title) - self.assertEqual(response.context['in_review_count'], 0) + self.assertEqual(response.context["in_review_count"], 0) class TestAdminDashboard(BaseViewTestCase): user_factory = AdminFactory - url_name = 'dashboard:{}' - base_view_name = 'dashboard' + url_name = "dashboard:{}" + base_view_name = "dashboard" def test_does_show_admin_button_to_admins(self): response = self.get_page() - self.assertContains(response, 'wagtail-admin-button') + self.assertContains(response, "wagtail-admin-button") diff --git a/hypha/apply/dashboard/urls.py b/hypha/apply/dashboard/urls.py index 1c906f43b0..b1d468c529 100644 --- a/hypha/apply/dashboard/urls.py +++ b/hypha/apply/dashboard/urls.py @@ -2,8 +2,8 @@ from .views import DashboardView -app_name = 'dashboard' +app_name = "dashboard" urlpatterns = [ - path('', DashboardView.as_view(), name="dashboard"), + path("", DashboardView.as_view(), name="dashboard"), ] diff --git a/hypha/apply/dashboard/views.py b/hypha/apply/dashboard/views.py index 3c9e76dbe6..975e10ad1e 100644 --- a/hypha/apply/dashboard/views.py +++ b/hypha/apply/dashboard/views.py @@ -34,16 +34,19 @@ class MySubmissionContextMixin: def get_context_data(self, **kwargs): submissions = ApplicationSubmission.objects.all().for_table(self.request.user) - my_submissions = submissions.filter( - user=self.request.user - ).active().current().select_related('draft_revision') - my_submissions = [ - submission.from_draft() for submission in my_submissions - ] - - my_inactive_submissions = submissions.filter(user=self.request.user).inactive().current() + my_submissions = ( + submissions.filter(user=self.request.user) + .active() + .current() + .select_related("draft_revision") + ) + my_submissions = [submission.from_draft() for submission in my_submissions] + + my_inactive_submissions = ( + submissions.filter(user=self.request.user).inactive().current() + ) my_inactive_submissions_table = ReviewerSubmissionsTable( - my_inactive_submissions, prefix='my-submissions-' + my_inactive_submissions, prefix="my-submissions-" ) return super().get_context_data( @@ -55,46 +58,62 @@ def get_context_data(self, **kwargs): class MyFlaggedMixin: def my_flagged(self, submissions): - submissions = submissions.flagged_by(self.request.user).order_by('-submit_time') - row_attrs = dict({'data-flag-type': 'user'}, **SummarySubmissionsTable._meta.row_attrs) + submissions = submissions.flagged_by(self.request.user).order_by("-submit_time") + row_attrs = dict( + {"data-flag-type": "user"}, **SummarySubmissionsTable._meta.row_attrs + ) limit = 5 return { - 'table': SummarySubmissionsTable(submissions[:limit], prefix='my-flagged-', attrs={'class': 'all-submissions-table flagged-table'}, row_attrs=row_attrs), - 'display_more': submissions.count() > limit, + "table": SummarySubmissionsTable( + submissions[:limit], + prefix="my-flagged-", + attrs={"class": "all-submissions-table flagged-table"}, + row_attrs=row_attrs, + ), + "display_more": submissions.count() > limit, } class AdminDashboardView(MyFlaggedMixin, TemplateView): - template_name = 'dashboard/dashboard.html' + template_name = "dashboard/dashboard.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) submissions = ApplicationSubmission.objects.all().for_table(self.request.user) - context.update({ - 'active_invoices': self.active_invoices(), - 'awaiting_reviews': self.awaiting_reviews(submissions), - 'my_reviewed': self.my_reviewed(submissions), - 'projects': self.projects(), - 'paf_waiting_for_approval': self.paf_waiting_for_approval(), - 'rounds': self.rounds(), - 'my_flagged': self.my_flagged(submissions), - 'paf_waiting_for_assignment': self.paf_waiting_for_approver_assignment(), - }) + context.update( + { + "active_invoices": self.active_invoices(), + "awaiting_reviews": self.awaiting_reviews(submissions), + "my_reviewed": self.my_reviewed(submissions), + "projects": self.projects(), + "paf_waiting_for_approval": self.paf_waiting_for_approval(), + "rounds": self.rounds(), + "my_flagged": self.my_flagged(submissions), + "paf_waiting_for_assignment": self.paf_waiting_for_approver_assignment(), + } + ) return context def awaiting_reviews(self, submissions): - submissions = submissions.in_review_for(self.request.user).order_by('-submit_time') + submissions = submissions.in_review_for(self.request.user).order_by( + "-submit_time" + ) count = submissions.count() limit = 5 return { - 'active_statuses_filter': ''.join(f'&status={status}' for status in review_filter_for_user(self.request.user)), - 'count': count, - 'display_more': count > limit, - 'table': SummarySubmissionsTableWithRole(submissions[:limit], prefix='my-review-'), + "active_statuses_filter": "".join( + f"&status={status}" + for status in review_filter_for_user(self.request.user) + ), + "count": count, + "display_more": count > limit, + "table": SummarySubmissionsTableWithRole( + submissions[:limit], prefix="my-review-" + ), } def active_invoices(self): @@ -103,82 +122,100 @@ def active_invoices(self): ).in_progress() return { - 'count': invoices.count(), - 'table': InvoiceDashboardTable(invoices), + "count": invoices.count(), + "table": InvoiceDashboardTable(invoices), } def projects(self): projects = Project.objects.filter(lead=self.request.user).for_table() filterset = ProjectListFilter( - data=self.request.GET or None, request=self.request, queryset=projects) + data=self.request.GET or None, request=self.request, queryset=projects + ) limit = 10 return { - 'count': projects.count(), - 'filterset': filterset, - 'table': ProjectsDashboardTable(projects[:limit]), - 'display_more': projects.count() > limit, - 'url': reverse('apply:projects:all'), + "count": projects.count(), + "filterset": filterset, + "table": ProjectsDashboardTable(projects[:limit]), + "display_more": projects.count() > limit, + "url": reverse("apply:projects:all"), } def paf_waiting_for_approver_assignment(self): project_settings = ProjectSettings.for_request(self.request) paf_approvals = PAFApprovals.objects.annotate( - roles_count=Count('paf_reviewer_role__user_roles') - ).filter(roles_count=len(list(self.request.user.groups.all())), approved=False, user__isnull=True) + roles_count=Count("paf_reviewer_role__user_roles") + ).filter( + roles_count=len(list(self.request.user.groups.all())), + approved=False, + user__isnull=True, + ) for role in self.request.user.groups.all(): - paf_approvals = paf_approvals.filter(paf_reviewer_role__user_roles__id=role.id) + paf_approvals = paf_approvals.filter( + paf_reviewer_role__user_roles__id=role.id + ) - paf_approvals_ids = paf_approvals.values_list('id', flat=True) - projects = Project.objects.filter(paf_approvals__id__in=paf_approvals_ids).for_table() + paf_approvals_ids = paf_approvals.values_list("id", flat=True) + projects = Project.objects.filter( + paf_approvals__id__in=paf_approvals_ids + ).for_table() if project_settings.paf_approval_sequential: all_projects = list(projects) for project in all_projects: - matched_paf_approval = paf_approvals.filter(project=project).order_by( - 'paf_reviewer_role__sort_order').first() + matched_paf_approval = ( + paf_approvals.filter(project=project) + .order_by("paf_reviewer_role__sort_order") + .first() + ) if project.paf_approvals.filter( paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, - approved=False).exists(): + approved=False, + ).exists(): projects = projects.exclude(id=project.id) return { - 'count': projects.count(), - 'table': ProjectsAssigneeDashboardTable(projects), + "count": projects.count(), + "table": ProjectsAssigneeDashboardTable(projects), } def paf_waiting_for_approval(self): - if not self.request.user.is_apply_staff or not PAFApprovals.objects.filter( - project__status=INTERNAL_APPROVAL, - user=self.request.user, - ).exists(): + if ( + not self.request.user.is_apply_staff + or not PAFApprovals.objects.filter( + project__status=INTERNAL_APPROVAL, + user=self.request.user, + ).exists() + ): return { - 'count': None, - 'awaiting_your_approval': { - 'count': None, - 'table': None, + "count": None, + "awaiting_your_approval": { + "count": None, + "table": None, + }, + "approved_by_you": { + "count": None, + "table": None, }, - 'approved_by_you': { - 'count': None, - 'table': None, - } } waiting_paf_approval = Project.objects.internal_approval().for_table() project_settings = ProjectSettings.for_request(self.request) if project_settings.paf_approval_sequential: awaiting_user_approval = [] - for waiting_project in waiting_paf_approval.filter(paf_approvals__approved=False): + for waiting_project in waiting_paf_approval.filter( + paf_approvals__approved=False + ): permission, _ = has_permission( - 'paf_status_update', + "paf_status_update", self.request.user, object=waiting_project, raise_exception=False, - request=self.request + request=self.request, ) if permission: awaiting_user_approval.append(waiting_project) @@ -193,53 +230,66 @@ def paf_waiting_for_approval(self): ) return { - 'count': len(awaiting_user_approval) + len(approved_by_user), - 'awaiting_your_approval': { - 'count': len(awaiting_user_approval), - 'table': ProjectsDashboardTable(data=awaiting_user_approval), + "count": len(awaiting_user_approval) + len(approved_by_user), + "awaiting_your_approval": { + "count": len(awaiting_user_approval), + "table": ProjectsDashboardTable(data=awaiting_user_approval), + }, + "approved_by_you": { + "count": len(approved_by_user), + "table": ProjectsDashboardTable(data=approved_by_user), }, - 'approved_by_you': { - 'count': len(approved_by_user), - 'table': ProjectsDashboardTable(data=approved_by_user), - } } def my_reviewed(self, submissions): """Staff reviewer's reviewed submissions for 'Previous reviews' block""" - submissions = submissions.reviewed_by(self.request.user).order_by('-submit_time') + submissions = submissions.reviewed_by(self.request.user).order_by( + "-submit_time" + ) limit = 5 return { - 'filterset': SubmissionFilterAndSearch( - data=self.request.GET or None, request=self.request, queryset=submissions), - 'table': SummarySubmissionsTableWithRole(submissions[:limit], prefix='my-review-'), - 'display_more': submissions.count() > limit, - 'url': reverse('funds:submissions:list'), + "filterset": SubmissionFilterAndSearch( + data=self.request.GET or None, + request=self.request, + queryset=submissions, + ), + "table": SummarySubmissionsTableWithRole( + submissions[:limit], prefix="my-review-" + ), + "display_more": submissions.count() > limit, + "url": reverse("funds:submissions:list"), } def rounds(self): limit = 6 - rounds = RoundsAndLabs.objects.with_progress().active().order_by('-end_date').by_lead( - self.request.user) + rounds = ( + RoundsAndLabs.objects.with_progress() + .active() + .order_by("-end_date") + .by_lead(self.request.user) + ) return { - 'closed': rounds.closed()[:limit], - 'open': rounds.open()[:limit], + "closed": rounds.closed()[:limit], + "open": rounds.open()[:limit], } class FinanceDashboardView(MyFlaggedMixin, TemplateView): - template_name = 'dashboard/finance_dashboard.html' + template_name = "dashboard/finance_dashboard.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context.update({ - 'active_invoices': self.active_invoices(), - 'invoices_for_approval': self.invoices_for_approval(), - 'invoices_to_convert': self.invoices_to_convert(), - 'paf_waiting_for_approval': self.paf_waiting_for_approval(), - 'paf_waiting_for_assignment': self.paf_waiting_for_approver_assignment(), - }) + context.update( + { + "active_invoices": self.active_invoices(), + "invoices_for_approval": self.invoices_for_approval(), + "invoices_to_convert": self.invoices_to_convert(), + "paf_waiting_for_approval": self.paf_waiting_for_approval(), + "paf_waiting_for_assignment": self.paf_waiting_for_approver_assignment(), + } + ) return context @@ -250,33 +300,48 @@ def active_invoices(self): invoices = Invoice.objects.for_finance_1() return { - 'count': invoices.count(), - 'table': InvoiceDashboardTable(invoices), + "count": invoices.count(), + "table": InvoiceDashboardTable(invoices), } def paf_waiting_for_approver_assignment(self): project_settings = ProjectSettings.for_request(self.request) paf_approvals = PAFApprovals.objects.annotate( - roles_count=Count('paf_reviewer_role__user_roles') - ).filter(roles_count=len(list(self.request.user.groups.all())), approved=False, user__isnull=True) + roles_count=Count("paf_reviewer_role__user_roles") + ).filter( + roles_count=len(list(self.request.user.groups.all())), + approved=False, + user__isnull=True, + ) for role in self.request.user.groups.all(): - paf_approvals = paf_approvals.filter(paf_reviewer_role__user_roles__id=role.id) + paf_approvals = paf_approvals.filter( + paf_reviewer_role__user_roles__id=role.id + ) - paf_approvals_ids = paf_approvals.values_list('id', flat=True) - projects = Project.objects.filter(paf_approvals__id__in=paf_approvals_ids).for_table() + paf_approvals_ids = paf_approvals.values_list("id", flat=True) + projects = Project.objects.filter( + paf_approvals__id__in=paf_approvals_ids + ).for_table() if project_settings.paf_approval_sequential: all_projects = list(projects) for project in all_projects: - matched_paf_approval = paf_approvals.filter(project=project).order_by('paf_reviewer_role__sort_order').first() - if project.paf_approvals.filter(paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, approved=False).exists(): + matched_paf_approval = ( + paf_approvals.filter(project=project) + .order_by("paf_reviewer_role__sort_order") + .first() + ) + if project.paf_approvals.filter( + paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, + approved=False, + ).exists(): projects = projects.exclude(id=project.id) return { - 'count': projects.count(), - 'table': ProjectsAssigneeDashboardTable(projects), + "count": projects.count(), + "table": ProjectsAssigneeDashboardTable(projects), } def invoices_for_approval(self): @@ -285,51 +350,53 @@ def invoices_for_approval(self): else: invoices = Invoice.objects.approved_by_staff() - return { - 'count': invoices.count(), - 'table': InvoiceDashboardTable(invoices) - } + return {"count": invoices.count(), "table": InvoiceDashboardTable(invoices)} def invoices_to_convert(self): if settings.INVOICE_EXTENDED_WORKFLOW and self.request.user.is_finance_level_1: return { - 'count': None, - 'table': None, + "count": None, + "table": None, } invoices = Invoice.objects.waiting_to_convert() return { - 'count': invoices.count(), - 'table': InvoiceDashboardTable(invoices), + "count": invoices.count(), + "table": InvoiceDashboardTable(invoices), } def paf_waiting_for_approval(self): - if not self.request.user.is_finance or not PAFApprovals.objects.filter( - project__status=INTERNAL_APPROVAL, - user=self.request.user, - ).exists(): + if ( + not self.request.user.is_finance + or not PAFApprovals.objects.filter( + project__status=INTERNAL_APPROVAL, + user=self.request.user, + ).exists() + ): return { - 'count': None, - 'awaiting_your_approval': { - 'count': None, - 'table': None, + "count": None, + "awaiting_your_approval": { + "count": None, + "table": None, + }, + "approved_by_you": { + "count": None, + "table": None, }, - 'approved_by_you': { - 'count': None, - 'table': None, - } } waiting_paf_approval = Project.objects.internal_approval().for_table() project_settings = ProjectSettings.for_request(self.request) if project_settings.paf_approval_sequential: awaiting_user_approval = [] - for waiting_project in waiting_paf_approval.filter(paf_approvals__approved=False): + for waiting_project in waiting_paf_approval.filter( + paf_approvals__approved=False + ): permission, _ = has_permission( - 'paf_status_update', + "paf_status_update", self.request.user, object=waiting_project, raise_exception=False, - request=self.request + request=self.request, ) if permission: awaiting_user_approval.append(waiting_project) @@ -344,170 +411,216 @@ def paf_waiting_for_approval(self): ) return { - 'count': len(awaiting_user_approval) + len(approved_by_user), - 'awaiting_your_approval': { - 'count': len(awaiting_user_approval), - 'table': ProjectsDashboardTable(data=awaiting_user_approval), + "count": len(awaiting_user_approval) + len(approved_by_user), + "awaiting_your_approval": { + "count": len(awaiting_user_approval), + "table": ProjectsDashboardTable(data=awaiting_user_approval), + }, + "approved_by_you": { + "count": len(approved_by_user), + "table": ProjectsDashboardTable(data=approved_by_user), }, - 'approved_by_you': { - 'count': len(approved_by_user), - 'table': ProjectsDashboardTable(data=approved_by_user), - } } class ReviewerDashboardView(MyFlaggedMixin, MySubmissionContextMixin, TemplateView): - template_name = 'dashboard/reviewer_dashboard.html' + template_name = "dashboard/reviewer_dashboard.html" def get(self, request, *args, **kwargs): # redirect to submissions list when we use the filter to search for something if len(request.GET): - query_str = '?' + query_str = "?" for key, value in request.GET.items(): - query_str += key + '=' + value + '&' - return HttpResponseRedirect(reverse_lazy('funds:submissions:list') + query_str) + query_str += key + "=" + value + "&" + return HttpResponseRedirect( + reverse_lazy("funds:submissions:list") + query_str + ) context = self.get_context_data(**kwargs) return render(request, self.template_name, context) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - ''' + """ If use_settings variable is set for ReviewerSettings use settings parameters to filter submissions or return all as it was by default. - ''' + """ reviewer_settings = ReviewerSettings.for_request(self.request) if reviewer_settings.use_settings: - submissions = ApplicationSubmission.objects.for_reviewer_settings(self.request.user, reviewer_settings).for_table(self.request.user) + submissions = ApplicationSubmission.objects.for_reviewer_settings( + self.request.user, reviewer_settings + ).for_table(self.request.user) else: - submissions = ApplicationSubmission.objects.all().for_table(self.request.user) + submissions = ApplicationSubmission.objects.all().for_table( + self.request.user + ) - context.update({ - 'awaiting_reviews': self.awaiting_reviews(submissions), - 'my_reviewed': self.my_reviewed(submissions), - 'my_flagged': self.my_flagged(submissions), - 'paf_waiting_for_assignment': self.paf_waiting_for_approver_assignment(), - }) + context.update( + { + "awaiting_reviews": self.awaiting_reviews(submissions), + "my_reviewed": self.my_reviewed(submissions), + "my_flagged": self.my_flagged(submissions), + "paf_waiting_for_assignment": self.paf_waiting_for_approver_assignment(), + } + ) return context def awaiting_reviews(self, submissions): - submissions = submissions.in_review_for(self.request.user).order_by('-submit_time') + submissions = submissions.in_review_for(self.request.user).order_by( + "-submit_time" + ) count = submissions.count() limit = 5 return { - 'active_statuses_filter': ''.join(f'&status={status}' for status in review_filter_for_user(self.request.user)), - 'count': count, - 'display_more': count > limit, - 'table': ReviewerSubmissionsTable(submissions[:limit], prefix='my-review-'), + "active_statuses_filter": "".join( + f"&status={status}" + for status in review_filter_for_user(self.request.user) + ), + "count": count, + "display_more": count > limit, + "table": ReviewerSubmissionsTable(submissions[:limit], prefix="my-review-"), } def paf_waiting_for_approver_assignment(self): project_settings = ProjectSettings.for_request(self.request) paf_approvals = PAFApprovals.objects.annotate( - roles_count=Count('paf_reviewer_role__user_roles') - ).filter(roles_count=len(list(self.request.user.groups.all())), approved=False, user__isnull=True) + roles_count=Count("paf_reviewer_role__user_roles") + ).filter( + roles_count=len(list(self.request.user.groups.all())), + approved=False, + user__isnull=True, + ) for role in self.request.user.groups.all(): - paf_approvals = paf_approvals.filter(paf_reviewer_role__user_roles__id=role.id) + paf_approvals = paf_approvals.filter( + paf_reviewer_role__user_roles__id=role.id + ) - paf_approvals_ids = paf_approvals.values_list('id', flat=True) - projects = Project.objects.filter(paf_approvals__id__in=paf_approvals_ids).for_table() + paf_approvals_ids = paf_approvals.values_list("id", flat=True) + projects = Project.objects.filter( + paf_approvals__id__in=paf_approvals_ids + ).for_table() if project_settings.paf_approval_sequential: all_projects = list(projects) for project in all_projects: - matched_paf_approval = paf_approvals.filter(project=project).order_by('paf_reviewer_role__sort_order').first() - if project.paf_approvals.filter(paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, approved=False).exists(): + matched_paf_approval = ( + paf_approvals.filter(project=project) + .order_by("paf_reviewer_role__sort_order") + .first() + ) + if project.paf_approvals.filter( + paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, + approved=False, + ).exists(): projects = projects.exclude(id=project.id) return { - 'count': projects.count(), - 'table': ProjectsAssigneeDashboardTable(projects), + "count": projects.count(), + "table": ProjectsAssigneeDashboardTable(projects), } def my_reviewed(self, submissions): """Staff reviewer's reviewed submissions for 'Previous reviews' block""" - submissions = submissions.reviewed_by(self.request.user).order_by('-submit_time') + submissions = submissions.reviewed_by(self.request.user).order_by( + "-submit_time" + ) limit = 5 return { - 'filterset': SubmissionReviewerFilterAndSearch( - data=self.request.GET or None, request=self.request, queryset=submissions), - 'table': ReviewerSubmissionsTable(submissions[:limit], prefix='my-review-'), - 'display_more': submissions.count() > limit, - 'url': reverse('funds:submissions:list'), + "filterset": SubmissionReviewerFilterAndSearch( + data=self.request.GET or None, + request=self.request, + queryset=submissions, + ), + "table": ReviewerSubmissionsTable(submissions[:limit], prefix="my-review-"), + "display_more": submissions.count() > limit, + "url": reverse("funds:submissions:list"), } class PartnerDashboardView(MySubmissionContextMixin, TemplateView): - template_name = 'dashboard/partner_dashboard.html' + template_name = "dashboard/partner_dashboard.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) submissions = ApplicationSubmission.objects.all().for_table(self.request.user) # Submissions in which user added as partner - partner_submissions, partner_submissions_table = self.partner_submissions(self.request.user, submissions) + partner_submissions, partner_submissions_table = self.partner_submissions( + self.request.user, submissions + ) - context.update({ - 'partner_submissions': partner_submissions_table, - 'partner_submissions_count': partner_submissions.count(), - }) + context.update( + { + "partner_submissions": partner_submissions_table, + "partner_submissions_count": partner_submissions.count(), + } + ) return context def partner_submissions(self, user, submissions): - partner_submissions = submissions.partner_for(user).order_by('-submit_time') - partner_submissions_table = SubmissionsTable(partner_submissions, prefix='my-partnered-') + partner_submissions = submissions.partner_for(user).order_by("-submit_time") + partner_submissions_table = SubmissionsTable( + partner_submissions, prefix="my-partnered-" + ) return partner_submissions, partner_submissions_table class ContractingDashboardView(MyFlaggedMixin, TemplateView): - template_name = 'dashboard/contracting_dashboard.html' + template_name = "dashboard/contracting_dashboard.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context.update({ - 'paf_waiting_for_approval': self.paf_waiting_for_approval(), - 'projects_in_contracting': self.projects_in_contracting(), - 'paf_waiting_for_assignment': self.paf_waiting_for_approver_assignment(), - }) + context.update( + { + "paf_waiting_for_approval": self.paf_waiting_for_approval(), + "projects_in_contracting": self.projects_in_contracting(), + "paf_waiting_for_assignment": self.paf_waiting_for_approver_assignment(), + } + ) return context def paf_waiting_for_approval(self): - if not self.request.user.is_contracting or not PAFApprovals.objects.filter( - project__status=INTERNAL_APPROVAL, - user=self.request.user, - ).exists(): + if ( + not self.request.user.is_contracting + or not PAFApprovals.objects.filter( + project__status=INTERNAL_APPROVAL, + user=self.request.user, + ).exists() + ): return { - 'count': None, - 'awaiting_your_approval': { - 'count': None, - 'table': None, + "count": None, + "awaiting_your_approval": { + "count": None, + "table": None, + }, + "approved_by_you": { + "count": None, + "table": None, }, - 'approved_by_you': { - 'count': None, - 'table': None, - } } waiting_paf_approval = Project.objects.internal_approval().for_table() project_settings = ProjectSettings.for_request(self.request) if project_settings.paf_approval_sequential: awaiting_user_approval = [] - for waiting_project in waiting_paf_approval.filter(paf_approvals__approved=False): + for waiting_project in waiting_paf_approval.filter( + paf_approvals__approved=False + ): permission, _ = has_permission( - 'paf_status_update', + "paf_status_update", self.request.user, object=waiting_project, raise_exception=False, - request=self.request + request=self.request, ) if permission: awaiting_user_approval.append(waiting_project) @@ -522,144 +635,188 @@ def paf_waiting_for_approval(self): ) return { - 'count': len(awaiting_user_approval) + len(approved_by_user), - 'awaiting_your_approval': { - 'count': len(awaiting_user_approval), - 'table': ProjectsDashboardTable(data=awaiting_user_approval), + "count": len(awaiting_user_approval) + len(approved_by_user), + "awaiting_your_approval": { + "count": len(awaiting_user_approval), + "table": ProjectsDashboardTable(data=awaiting_user_approval), + }, + "approved_by_you": { + "count": len(approved_by_user), + "table": ProjectsDashboardTable(data=approved_by_user), }, - 'approved_by_you': { - 'count': len(approved_by_user), - 'table': ProjectsDashboardTable(data=approved_by_user), - } } def paf_waiting_for_approver_assignment(self): project_settings = ProjectSettings.for_request(self.request) paf_approvals = PAFApprovals.objects.annotate( - roles_count=Count('paf_reviewer_role__user_roles') - ).filter(roles_count=len(list(self.request.user.groups.all())), approved=False, user__isnull=True) + roles_count=Count("paf_reviewer_role__user_roles") + ).filter( + roles_count=len(list(self.request.user.groups.all())), + approved=False, + user__isnull=True, + ) for role in self.request.user.groups.all(): - paf_approvals = paf_approvals.filter(paf_reviewer_role__user_roles__id=role.id) + paf_approvals = paf_approvals.filter( + paf_reviewer_role__user_roles__id=role.id + ) - paf_approvals_ids = paf_approvals.values_list('id', flat=True) - projects = Project.objects.filter(paf_approvals__id__in=paf_approvals_ids).for_table() + paf_approvals_ids = paf_approvals.values_list("id", flat=True) + projects = Project.objects.filter( + paf_approvals__id__in=paf_approvals_ids + ).for_table() if project_settings.paf_approval_sequential: all_projects = list(projects) for project in all_projects: - matched_paf_approval = paf_approvals.filter(project=project).order_by('paf_reviewer_role__sort_order').first() - if project.paf_approvals.filter(paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, approved=False).exists(): + matched_paf_approval = ( + paf_approvals.filter(project=project) + .order_by("paf_reviewer_role__sort_order") + .first() + ) + if project.paf_approvals.filter( + paf_reviewer_role__sort_order__lt=matched_paf_approval.paf_reviewer_role.sort_order, + approved=False, + ).exists(): projects = projects.exclude(id=project.id) return { - 'count': projects.count(), - 'table': ProjectsAssigneeDashboardTable(projects), + "count": projects.count(), + "table": ProjectsAssigneeDashboardTable(projects), } def projects_in_contracting(self): if not self.request.user.is_contracting: return { - 'count': None, - 'waiting_for_contract': { - 'count': None, - 'table': None, + "count": None, + "waiting_for_contract": { + "count": None, + "table": None, + }, + "waiting_for_contract_approval": { + "count": None, + "table": None, }, - 'waiting_for_contract_approval': { - 'count': None, - 'table': None, - } } projects_in_contracting = Project.objects.in_contracting() - waiting_for_contract = projects_in_contracting.filter(contracts__isnull=True).for_table() - waiting_for_contract_approval = projects_in_contracting.filter(contracts__isnull=False).for_table() + waiting_for_contract = projects_in_contracting.filter( + contracts__isnull=True + ).for_table() + waiting_for_contract_approval = projects_in_contracting.filter( + contracts__isnull=False + ).for_table() return { - 'count': projects_in_contracting.count(), - 'waiting_for_contract': { - 'count': waiting_for_contract.count(), - 'table': ProjectsDashboardTable(data=waiting_for_contract) + "count": projects_in_contracting.count(), + "waiting_for_contract": { + "count": waiting_for_contract.count(), + "table": ProjectsDashboardTable(data=waiting_for_contract), + }, + "waiting_for_contract_approval": { + "count": waiting_for_contract_approval.count(), + "table": ProjectsDashboardTable(data=waiting_for_contract_approval), }, - 'waiting_for_contract_approval': { - 'count': waiting_for_contract_approval.count(), - 'table': ProjectsDashboardTable(data=waiting_for_contract_approval) - } } class CommunityDashboardView(MySubmissionContextMixin, TemplateView): - template_name = 'dashboard/community_dashboard.html' + template_name = "dashboard/community_dashboard.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) submissions = ApplicationSubmission.objects.all().for_table(self.request.user) # Submissions in community review phase - my_community_review, my_community_review = self.my_community_review(self.request.user, submissions) + my_community_review, my_community_review = self.my_community_review( + self.request.user, submissions + ) # Partner's reviewed submissions my_reviewed = self.my_reviewed(self.request, submissions) - context.update({ - 'my_community_review': my_community_review, - 'my_community_review_count': my_community_review.count(), - 'my_reviewed': my_reviewed - }) + context.update( + { + "my_community_review": my_community_review, + "my_community_review_count": my_community_review.count(), + "my_reviewed": my_reviewed, + } + ) return context def my_community_review(self, user, submissions): - my_community_review = submissions.in_community_review(user).order_by('-submit_time') - my_community_review_table = ReviewerSubmissionsTable(my_community_review, prefix='my-community-review-') + my_community_review = submissions.in_community_review(user).order_by( + "-submit_time" + ) + my_community_review_table = ReviewerSubmissionsTable( + my_community_review, prefix="my-community-review-" + ) return my_community_review, my_community_review_table def my_reviewed(self, request, submissions): - return ReviewerSubmissionsTable(submissions.reviewed_by(request.user).order_by('-submit_time'), prefix='my-reviewed-') + return ReviewerSubmissionsTable( + submissions.reviewed_by(request.user).order_by("-submit_time"), + prefix="my-reviewed-", + ) class ApplicantDashboardView(TemplateView): - template_name = 'dashboard/applicant_dashboard.html' + template_name = "dashboard/applicant_dashboard.html" def get_context_data(self, **kwargs): my_active_submissions = list(self.my_active_submissions(self.request.user)) context = super().get_context_data(**kwargs) - context['my_active_submissions'] = my_active_submissions - context['active_projects'] = self.active_project_data() - context['historical_projects'] = self.historical_project_data() - context['historical_submissions'] = self.historical_submission_data() + context["my_active_submissions"] = my_active_submissions + context["active_projects"] = self.active_project_data() + context["historical_projects"] = self.historical_project_data() + context["historical_submissions"] = self.historical_submission_data() return context def active_project_data(self): - active_projects = Project.objects.filter(user=self.request.user).active().for_table() + active_projects = ( + Project.objects.filter(user=self.request.user).active().for_table() + ) return { - 'count': active_projects.count(), - 'table': ProjectsDashboardTable(data=active_projects), + "count": active_projects.count(), + "table": ProjectsDashboardTable(data=active_projects), } def my_active_submissions(self, user): - active_subs = ApplicationSubmission.objects.filter( - user=user, - ) .active().current().select_related('draft_revision') + active_subs = ( + ApplicationSubmission.objects.filter( + user=user, + ) + .active() + .current() + .select_related("draft_revision") + ) for submission in active_subs: yield submission.from_draft() def historical_project_data(self): - historical_projects = Project.objects.filter(user=self.request.user).complete().for_table() + historical_projects = ( + Project.objects.filter(user=self.request.user).complete().for_table() + ) return { - 'count': historical_projects.count(), - 'table': ProjectsDashboardTable(data=historical_projects), + "count": historical_projects.count(), + "table": ProjectsDashboardTable(data=historical_projects), } def historical_submission_data(self): - historical_submissions = ApplicationSubmission.objects.filter( - user=self.request.user, - ).inactive().current().for_table(self.request.user) + historical_submissions = ( + ApplicationSubmission.objects.filter( + user=self.request.user, + ) + .inactive() + .current() + .for_table(self.request.user) + ) return { - 'count': historical_submissions.count(), - 'table': SubmissionsTable(data=historical_submissions) + "count": historical_submissions.count(), + "table": SubmissionsTable(data=historical_submissions), } diff --git a/hypha/apply/dashboard/wagtail_hooks.py b/hypha/apply/dashboard/wagtail_hooks.py index 4925637e2d..28f6c0ba7f 100644 --- a/hypha/apply/dashboard/wagtail_hooks.py +++ b/hypha/apply/dashboard/wagtail_hooks.py @@ -7,12 +7,12 @@ from hypha.apply.home.models import ApplyHomePage -@hooks.register('register_admin_menu_item') +@hooks.register("register_admin_menu_item") def register_dashboard_menu_item(): apply_home = ApplyHomePage.objects.first() return MenuItem( - 'Apply Dashboard', - urljoin(apply_home.url, reverse('dashboard:dashboard', 'hypha.apply.urls')), - classnames='icon icon-arrow-left', + "Apply Dashboard", + urljoin(apply_home.url, reverse("dashboard:dashboard", "hypha.apply.urls")), + classnames="icon icon-arrow-left", order=100000, ) diff --git a/hypha/apply/determinations/admin.py b/hypha/apply/determinations/admin.py index 571d185f67..167aa83f4b 100644 --- a/hypha/apply/determinations/admin.py +++ b/hypha/apply/determinations/admin.py @@ -22,17 +22,17 @@ def __init__(self, *args, **kwargs): class DeterminationFormAdmin(ListRelatedMixin, ModelAdmin): model = DeterminationForm - menu_icon = 'form' - list_display = ('name', 'used_by') + menu_icon = "form" + list_display = ("name", "used_by") button_helper_class = ButtonsWithClone clone_view_class = CloneView create_view_class = CreateDeterminationFormView edit_view_class = EditDeterminationFormView related_models = [ - ('applicationbasedeterminationform', 'application'), - ('roundbasedeterminationform', 'round'), - ('labbasedeterminationform', 'lab'), + ("applicationbasedeterminationform", "application"), + ("roundbasedeterminationform", "round"), + ("labbasedeterminationform", "lab"), ] def get_admin_urls_for_registration(self): @@ -40,16 +40,16 @@ def get_admin_urls_for_registration(self): urls += ( re_path( - self.url_helper.get_action_url_pattern('clone'), + self.url_helper.get_action_url_pattern("clone"), self.clone_view, - name=self.url_helper.get_action_url_name('clone') + name=self.url_helper.get_action_url_name("clone"), ), ) return urls def clone_view(self, request, **kwargs): - kwargs.update(**{'model_admin': self}) + kwargs.update(**{"model_admin": self}) view_class = self.clone_view_class return view_class.as_view(**kwargs)(request) diff --git a/hypha/apply/determinations/admin_views.py b/hypha/apply/determinations/admin_views.py index 93e41c35ce..a363b49365 100644 --- a/hypha/apply/determinations/admin_views.py +++ b/hypha/apply/determinations/admin_views.py @@ -4,14 +4,12 @@ class CreateDeterminationFormView(CreateView): - def form_invalid(self, form): show_admin_form_error_messages(self.request, form) return self.render_to_response(self.get_context_data(form=form)) class EditDeterminationFormView(EditView): - def form_invalid(self, form): show_admin_form_error_messages(self.request, form) return self.render_to_response(self.get_context_data(form=form)) diff --git a/hypha/apply/determinations/apps.py b/hypha/apply/determinations/apps.py index 79bd722956..97ed2ff3da 100644 --- a/hypha/apply/determinations/apps.py +++ b/hypha/apply/determinations/apps.py @@ -2,4 +2,4 @@ class DeterminationsConfig(AppConfig): - name = 'hypha.apply.determinations' + name = "hypha.apply.determinations" diff --git a/hypha/apply/determinations/blocks.py b/hypha/apply/determinations/blocks.py index 859a93945b..81e055a63f 100644 --- a/hypha/apply/determinations/blocks.py +++ b/hypha/apply/determinations/blocks.py @@ -19,51 +19,51 @@ class DeterminationMustIncludeFieldBlock(MustIncludeFieldBlock): class DeterminationBlock(DeterminationMustIncludeFieldBlock): - name = 'determination' - description = 'Overall determination' + name = "determination" + description = "Overall determination" field_class = forms.TypedChoiceField class Meta: - icon = 'pick' + icon = "pick" def get_field_kwargs(self, struct_value): kwargs = super().get_field_kwargs(struct_value) - kwargs['choices'] = DETERMINATION_CHOICES + kwargs["choices"] = DETERMINATION_CHOICES return kwargs def render(self, value, context=None): - data = int(context['data']) + data = int(context["data"]) choices = dict(DETERMINATION_CHOICES) - context['data'] = choices[data] + context["data"] = choices[data] return super().render(value, context) class DeterminationMessageBlock(DeterminationMustIncludeFieldBlock): - name = 'message' - description = 'Determination message' + name = "message" + description = "Determination message" widget = RICH_TEXT_WIDGET class Meta: - icon = 'openquote' - template = 'stream_forms/render_unsafe_field.html' + icon = "openquote" + template = "stream_forms/render_unsafe_field.html" def get_field_kwargs(self, struct_value): kwargs = super().get_field_kwargs(struct_value) - kwargs['required'] = False + kwargs["required"] = False return kwargs class SendNoticeBlock(DeterminationMustIncludeFieldBlock): - name = 'send_notice' - description = 'Send Notice' + name = "send_notice" + description = "Send Notice" default_value = BooleanBlock(default=True, required=False) field_class = forms.BooleanField class Meta: - label = _('Send Notice') - icon = 'tick-inverse' + label = _("Send Notice") + icon = "tick-inverse" def get_searchable_content(self, value, data): return None @@ -73,9 +73,9 @@ def no_response(self): class DeterminationCustomFormFieldsBlock(CustomFormFieldsBlock): - char = CharFieldBlock(group=_('Fields')) - text = TextFieldBlock(group=_('Fields')) - text_markup = RichTextBlock(group=_('Fields'), label=_('Paragraph')) - checkbox = CheckboxFieldBlock(group=_('Fields')) - dropdown = DropdownFieldBlock(group=_('Fields')) + char = CharFieldBlock(group=_("Fields")) + text = TextFieldBlock(group=_("Fields")) + text_markup = RichTextBlock(group=_("Fields"), label=_("Paragraph")) + checkbox = CheckboxFieldBlock(group=_("Fields")) + dropdown = DropdownFieldBlock(group=_("Fields")) required_blocks = DeterminationMustIncludeFieldBlock.__subclasses__() diff --git a/hypha/apply/determinations/forms.py b/hypha/apply/determinations/forms.py index ac7e3858ff..9a337cf291 100644 --- a/hypha/apply/determinations/forms.py +++ b/hypha/apply/determinations/forms.py @@ -18,8 +18,8 @@ class BaseDeterminationForm: def __init__(self, *args, user, initial, action, edit=False, **kwargs): - if 'site' in kwargs: - site = kwargs.pop('site') + if "site" in kwargs: + site = kwargs.pop("site") self.form_settings = DeterminationFormSettings.for_site(site) try: initial.update(outcome=TRANSITION_DETERMINATION[action]) @@ -33,11 +33,11 @@ def data_fields(self): def clean_outcome(self): # Enforce outcome as an int - return int(self.cleaned_data['outcome']) + return int(self.cleaned_data["outcome"]) def clean(self): cleaned_data = super().clean() - cleaned_data['data'] = { + cleaned_data["data"] = { key: value for key, value in cleaned_data.items() if key in self.data_fields() @@ -47,11 +47,15 @@ def clean(self): def apply_form_settings(self, application_type, fields): for field in fields: try: - self.fields[field].label = getattr(self.form_settings, f'{application_type}_{field}_label') + self.fields[field].label = getattr( + self.form_settings, f"{application_type}_{field}_label" + ) except AttributeError: pass try: - self.fields[field].help_text = getattr(self.form_settings, f'{application_type}_{field}_help_text') + self.fields[field].help_text = getattr( + self.form_settings, f"{application_type}_{field}_help_text" + ) except AttributeError: pass return fields @@ -60,7 +64,7 @@ def apply_form_settings(self, application_type, fields): def get_detailed_response(cls, saved_data): data = {} for group, title in cls.titles.items(): - data.setdefault(group, {'title': title, 'questions': []}) + data.setdefault(group, {"title": title, "questions": []}) for name, field in cls.base_fields.items(): try: @@ -69,7 +73,7 @@ def get_detailed_response(cls, saved_data): # The field is not stored in the data pass else: - data[field.group]['questions'].append((field.label, str(value))) + data[field.group]["questions"].append((field.label, str(value))) return data @@ -79,25 +83,22 @@ class BaseNormalDeterminationForm(BaseDeterminationForm, forms.ModelForm): class Meta: model = Determination - fields = ['outcome', 'message', 'submission', 'author', 'data', 'send_notice'] + fields = ["outcome", "message", "submission", "author", "data", "send_notice"] widgets = { - 'submission': forms.HiddenInput(), - 'author': forms.HiddenInput(), - 'data': forms.HiddenInput(), + "submission": forms.HiddenInput(), + "author": forms.HiddenInput(), + "data": forms.HiddenInput(), } error_messages = { NON_FIELD_ERRORS: { - 'unique_together': "You have already created a determination for this submission", + "unique_together": "You have already created a determination for this submission", } } def data_fields(self): - return [ - field for field in self.fields - if field not in self._meta.fields - ] + return [field for field in self.fields if field not in self._meta.fields] def outcome_choices_for_phase(self, submission, user): """ @@ -105,8 +106,8 @@ def outcome_choices_for_phase(self, submission, user): We need to filter out non-matching choices. i.e. a transition to In Review is not a determination, while Needs more info or Rejected are. """ - available_choices = [('', _('-- No determination selected -- '))] - choices = dict(self.fields['outcome'].choices) + available_choices = [("", _("-- No determination selected -- "))] + choices = dict(self.fields["outcome"].choices) for transition_name in determination_actions(user, submission): try: @@ -114,7 +115,9 @@ def outcome_choices_for_phase(self, submission, user): except KeyError: pass else: - available_choices.append((determination_type, choices[determination_type])) + available_choices.append( + (determination_type, choices[determination_type]) + ) return available_choices def save(self, commit=True): @@ -136,15 +139,17 @@ class BaseBatchDeterminationForm(BaseDeterminationForm, forms.Form): def data_fields(self): return [ - field for field in self.fields - if field not in ['submissions', 'outcome', 'author', 'send_notice', 'message'] + field + for field in self.fields + if field + not in ["submissions", "outcome", "author", "send_notice", "message"] ] def _post_clean(self): - submissions = self.cleaned_data['submissions'].undetermined() + submissions = self.cleaned_data["submissions"].undetermined() data = { field: self.cleaned_data[field] - for field in ['author', 'data', 'outcome', 'message'] + for field in ["author", "data", "outcome", "message"] } self.instances = [ @@ -165,163 +170,168 @@ def save(self): class BaseConceptDeterminationForm(forms.Form): titles = { - 1: 'Feedback', + 1: "Feedback", } outcome = forms.ChoiceField( choices=DETERMINATION_CHOICES, - label=_('Determination'), - help_text='Do you recommend requesting a proposal based on this concept note?', + label=_("Determination"), + help_text="Do you recommend requesting a proposal based on this concept note?", ) outcome.group = 1 message = RichTextField( - label=_('Determination message'), - help_text='This text will be e-mailed to the applicant. ' - 'Ones when text is first added and then every time the text is changed.' + label=_("Determination message"), + help_text="This text will be e-mailed to the applicant. " + "Ones when text is first added and then every time the text is changed.", ) message.group = 1 principles = RichTextField( - label=_('Goals and principles'), - help_text='Does the project contribute and/or have relevance to OTF goals and principles?' - 'Are the goals and objectives of the project clear? Is it a technology research, development, or deployment ' - 'project? Can project’s effort be explained to external audiences and non-technical people? What problem are ' - 'they trying to solve and is the solution strategical or tactical? Is the project strategically or tactically ' - 'important to OTF’s goals, principles and rationale and other OTF efforts? Is it clear how? What tools, if any, ' - 'currently exist to solve this problem? How is this project different? Does the effort have any overlap with ' - 'existing OTF and/or USG supported projects? Is the overlap complementary or duplicative? If complementary, ' - 'can it be explained clearly? I.e. geographic focus, technology, organization profile, etc. What are the ' - 'liabilities and risks of taking on this project? I.e. political personalities, financial concerns, technical ' - 'controversial, etc. Is the organization or its members known within any relevant communities? If yes, what is ' - 'their reputation and why? What is the entity’s motivation and principles? What are the entity member(s) ' - 'motivations and principles? Where is the organization physically and legally based? If the organization is ' - 'distributed, where is the main point of contact? Does the organization have any conflicts of interest with ' - 'RFA, OTF, the Advisory Council, or other RFA-OTF projects? Is the project team an organization, community ' - 'or an individual?' + label=_("Goals and principles"), + help_text="Does the project contribute and/or have relevance to OTF goals and principles?" + "Are the goals and objectives of the project clear? Is it a technology research, development, or deployment " + "project? Can project’s effort be explained to external audiences and non-technical people? What problem are " + "they trying to solve and is the solution strategical or tactical? Is the project strategically or tactically " + "important to OTF’s goals, principles and rationale and other OTF efforts? Is it clear how? What tools, if any, " + "currently exist to solve this problem? How is this project different? Does the effort have any overlap with " + "existing OTF and/or USG supported projects? Is the overlap complementary or duplicative? If complementary, " + "can it be explained clearly? I.e. geographic focus, technology, organization profile, etc. What are the " + "liabilities and risks of taking on this project? I.e. political personalities, financial concerns, technical " + "controversial, etc. Is the organization or its members known within any relevant communities? If yes, what is " + "their reputation and why? What is the entity’s motivation and principles? What are the entity member(s) " + "motivations and principles? Where is the organization physically and legally based? If the organization is " + "distributed, where is the main point of contact? Does the organization have any conflicts of interest with " + "RFA, OTF, the Advisory Council, or other RFA-OTF projects? Is the project team an organization, community " + "or an individual?", ) principles.group = 1 technical = RichTextField( - label=_('Technical merit'), - help_text='Does the project clearly articulate the technical problem, solution, and approach? ' - 'Is the problem clearly justifiable? Does the project clearly articulate the technological objectives? ' - 'Is it an open or closed development project? I.e. Open source like Android or open source like Firefox OS ' - 'or closed like iOS. Does a similar technical solution already exist? If so, what are the differentiating ' - 'factors? Is the effort to sustain an existing technical approach? If so, are these considered successful? ' - 'Is the effort a new technical approach or improvement to an existing solution? If so, how? Is the effort ' - 'a completely new technical approach fostering new solutions in the field? Does the project’s technical ' - 'approach solve the problem? What are the limitations of the project’s technical approach and solution? ' - 'What are the unintended or illicit uses and consequences of this technology? Has the project identified ' - 'and/or developed any safeguards for these consequences?' + label=_("Technical merit"), + help_text="Does the project clearly articulate the technical problem, solution, and approach? " + "Is the problem clearly justifiable? Does the project clearly articulate the technological objectives? " + "Is it an open or closed development project? I.e. Open source like Android or open source like Firefox OS " + "or closed like iOS. Does a similar technical solution already exist? If so, what are the differentiating " + "factors? Is the effort to sustain an existing technical approach? If so, are these considered successful? " + "Is the effort a new technical approach or improvement to an existing solution? If so, how? Is the effort " + "a completely new technical approach fostering new solutions in the field? Does the project’s technical " + "approach solve the problem? What are the limitations of the project’s technical approach and solution? " + "What are the unintended or illicit uses and consequences of this technology? Has the project identified " + "and/or developed any safeguards for these consequences?", ) technical.group = 1 sustainable = RichTextField( - label=_('Reasonable, realistic and sustainable'), - help_text='Is the requested amount reasonable, realistic, and justified? If OTF doesn’t support the project, ' - 'is it likely to be realized? Does the project provide a detailed and realistic description of effort and ' - 'schedule? I.e. is the project capable of creating a work plan including objectives, activities, and ' - 'deliverable(s)? Does the project have a clear support model? Is there a known sustainability plan for the ' - 'future? What in-kind support or other revenue streams is the project receiving? I.e. volunteer developers, ' - 'service or product sales. Is the project receiving any financial support from the USG? Is this information ' - 'disclosed? Is the project receiving any other financial support? Is this information disclosed? Are existing ' - 'supporters approachable? Are they likely aware and/or comfortable with the Intellectual property language ' - 'within USG contracts?' + label=_("Reasonable, realistic and sustainable"), + help_text="Is the requested amount reasonable, realistic, and justified? If OTF doesn’t support the project, " + "is it likely to be realized? Does the project provide a detailed and realistic description of effort and " + "schedule? I.e. is the project capable of creating a work plan including objectives, activities, and " + "deliverable(s)? Does the project have a clear support model? Is there a known sustainability plan for the " + "future? What in-kind support or other revenue streams is the project receiving? I.e. volunteer developers, " + "service or product sales. Is the project receiving any financial support from the USG? Is this information " + "disclosed? Is the project receiving any other financial support? Is this information disclosed? Are existing " + "supporters approachable? Are they likely aware and/or comfortable with the Intellectual property language " + "within USG contracts?", ) sustainable.group = 1 - comments = RichTextField( - label=_('Other comments'), - help_text='' - ) + comments = RichTextField(label=_("Other comments"), help_text="") comments.group = 1 class BaseProposalDeterminationForm(forms.Form): titles = { - 1: 'A. Determination', - 2: 'B. General thoughts', - 3: 'C. Specific aspects', - 4: 'D. Rationale and appropriateness consideration', - 5: 'E. General recommendation', + 1: "A. Determination", + 2: "B. General thoughts", + 3: "C. Specific aspects", + 4: "D. Rationale and appropriateness consideration", + 5: "E. General recommendation", } # A. Determination outcome = forms.ChoiceField( choices=DETERMINATION_CHOICES, - label=_('Determination'), - help_text='Do you recommend requesting a proposal based on this concept note?' + label=_("Determination"), + help_text="Do you recommend requesting a proposal based on this concept note?", ) outcome.group = 1 message = RichTextField( - label=_('Determination message'), - help_text='This text will be e-mailed to the applicant. ' - 'Ones when text is first added and then every time the text is changed.' + label=_("Determination message"), + help_text="This text will be e-mailed to the applicant. " + "Ones when text is first added and then every time the text is changed.", ) message.group = 1 # B. General thoughts liked = RichTextField( - label=_('Positive aspects'), - help_text='Any general or specific aspects that got you really excited or that you like about this proposal.' + label=_("Positive aspects"), + help_text="Any general or specific aspects that got you really excited or that you like about this proposal.", ) liked.group = 2 concerns = RichTextField( - label=_('Concerns'), - help_text='Any general or specific aspects that concern you or leave you feeling uneasy about this proposal.' + label=_("Concerns"), + help_text="Any general or specific aspects that concern you or leave you feeling uneasy about this proposal.", ) concerns.group = 2 red_flags = RichTextField( - label=_('Items that must be addressed'), - help_text='Anything you think should be flagged for our attention.' + label=_("Items that must be addressed"), + help_text="Anything you think should be flagged for our attention.", ) red_flags.group = 2 # C. Specific aspects - overview = RichTextField(label=_('Project overview questions and comments')) + overview = RichTextField(label=_("Project overview questions and comments")) overview.group = 3 - objectives = RichTextField(label=_('Objectives questions and comments')) + objectives = RichTextField(label=_("Objectives questions and comments")) objectives.group = 3 - strategy = RichTextField(label=_('Methods and strategy questions and comments')) + strategy = RichTextField(label=_("Methods and strategy questions and comments")) strategy.group = 3 - technical = RichTextField(label=_('Technical feasibility questions and comments')) + technical = RichTextField(label=_("Technical feasibility questions and comments")) technical.group = 3 - alternative = RichTextField(label=_('Alternative analysis - "red teaming" questions and comments')) + alternative = RichTextField( + label=_('Alternative analysis - "red teaming" questions and comments') + ) alternative.group = 3 - usability = RichTextField(label=_('Usability questions and comments')) + usability = RichTextField(label=_("Usability questions and comments")) usability.group = 3 - sustainability = RichTextField(label=_('Sustainability questions and comments')) + sustainability = RichTextField(label=_("Sustainability questions and comments")) sustainability.group = 3 - collaboration = RichTextField(label=_('Collaboration questions and comments')) + collaboration = RichTextField(label=_("Collaboration questions and comments")) collaboration.group = 3 - realism = RichTextField(label=_('Cost realism questions and comments')) + realism = RichTextField(label=_("Cost realism questions and comments")) realism.group = 3 - qualifications = RichTextField(label=_('Qualifications questions and comments')) + qualifications = RichTextField(label=_("Qualifications questions and comments")) qualifications.group = 3 - evaluation = RichTextField(label=_('Evaluation questions and comments')) + evaluation = RichTextField(label=_("Evaluation questions and comments")) evaluation.group = 3 # D. Rationale and appropriateness consideration - rationale = RichTextField(label=_('Rationale and appropriateness questions and comments')) + rationale = RichTextField( + label=_("Rationale and appropriateness questions and comments") + ) rationale.group = 4 -class ConceptDeterminationForm(BaseConceptDeterminationForm, BaseNormalDeterminationForm): - def __init__(self, *args, submission, user, edit=False, initial=None, instance=None, **kwargs): +class ConceptDeterminationForm( + BaseConceptDeterminationForm, BaseNormalDeterminationForm +): + def __init__( + self, *args, submission, user, edit=False, initial=None, instance=None, **kwargs + ): initial = initial or {} initial.update(submission=submission.id) @@ -330,7 +340,9 @@ def __init__(self, *args, submission, user, edit=False, initial=None, instance=N if key not in self._meta.fields: initial[key] = value - super(BaseNormalDeterminationForm, self).__init__(*args, initial=initial, user=user, instance=instance, edit=edit, **kwargs) + super(BaseNormalDeterminationForm, self).__init__( + *args, initial=initial, user=user, instance=instance, edit=edit, **kwargs + ) # convert a python dict to orderedDict, to use move_to_end method self.fields = OrderedDict(self.fields) @@ -338,46 +350,58 @@ def __init__(self, *args, submission, user, edit=False, initial=None, instance=N for field in self._meta.widgets: self.fields[field].disabled = True - self.fields['outcome'].choices = self.outcome_choices_for_phase(submission, user) + self.fields["outcome"].choices = self.outcome_choices_for_phase( + submission, user + ) if self.draft_button_name in self.data: for field in self.fields.values(): field.required = False - self.fields = self.apply_form_settings('concept', self.fields) - self.fields.move_to_end('send_notice') + self.fields = self.apply_form_settings("concept", self.fields) + self.fields.move_to_end("send_notice") - action = kwargs.get('action') + action = kwargs.get("action") stages_num = len(submission.workflow.stages) if stages_num > 1: - second_stage_forms = submission.get_from_parent('forms').filter(stage=2) + second_stage_forms = submission.get_from_parent("forms").filter(stage=2) if second_stage_forms.count() > 1: proposal_form_choices = [ (index, form.form.name) for index, form in enumerate(second_stage_forms) ] - proposal_form_choices.insert(0, ('', _('-- No proposal form selected -- '))) - proposal_form_help_text = _('Select the proposal form only for determination approval') - if action == 'invited_to_proposal': - proposal_form_help_text = _('Select the proposal form to use for proposal stage.') - self.fields['proposal_form'] = forms.ChoiceField( - label=_('Proposal Form'), + proposal_form_choices.insert( + 0, ("", _("-- No proposal form selected -- ")) + ) + proposal_form_help_text = _( + "Select the proposal form only for determination approval" + ) + if action == "invited_to_proposal": + proposal_form_help_text = _( + "Select the proposal form to use for proposal stage." + ) + self.fields["proposal_form"] = forms.ChoiceField( + label=_("Proposal Form"), choices=proposal_form_choices, help_text=proposal_form_help_text, - required=True if action == 'invited_to_proposal' else False, - disabled=False if action == 'invited_to_proposal' else True, + required=True if action == "invited_to_proposal" else False, + disabled=False if action == "invited_to_proposal" else True, ) - self.fields['proposal_form'].group = 1 - self.fields.move_to_end('proposal_form', last=False) + self.fields["proposal_form"].group = 1 + self.fields.move_to_end("proposal_form", last=False) if edit: - self.fields.pop('outcome') + self.fields.pop("outcome") self.draft_button_name = None -class ProposalDeterminationForm(BaseProposalDeterminationForm, BaseNormalDeterminationForm): - def __init__(self, *args, submission, user, edit=False, initial=None, instance=None, **kwargs): +class ProposalDeterminationForm( + BaseProposalDeterminationForm, BaseNormalDeterminationForm +): + def __init__( + self, *args, submission, user, edit=False, initial=None, instance=None, **kwargs + ): if initial is None: initial = {} initial.update(submission=submission.id) @@ -387,7 +411,9 @@ def __init__(self, *args, submission, user, edit=False, initial=None, instance=N if key not in self._meta.fields: initial[key] = value - super(BaseNormalDeterminationForm, self).__init__(*args, initial=initial, user=user, instance=instance, edit=edit, **kwargs) + super(BaseNormalDeterminationForm, self).__init__( + *args, initial=initial, user=user, instance=instance, edit=edit, **kwargs + ) # convert a python dict to orderedDict, to use move_to_end method self.fields = OrderedDict(self.fields) @@ -395,40 +421,50 @@ def __init__(self, *args, submission, user, edit=False, initial=None, instance=N for field in self._meta.widgets: self.fields[field].disabled = True - self.fields['outcome'].choices = self.outcome_choices_for_phase(submission, user) - self.fields.move_to_end('send_notice') + self.fields["outcome"].choices = self.outcome_choices_for_phase( + submission, user + ) + self.fields.move_to_end("send_notice") if self.draft_button_name in self.data: for field in self.fields.values(): field.required = False - self.fields = self.apply_form_settings('proposal', self.fields) + self.fields = self.apply_form_settings("proposal", self.fields) if edit: - self.fields.pop('outcome') + self.fields.pop("outcome") self.draft_button_name = None -class BatchConceptDeterminationForm(BaseConceptDeterminationForm, BaseBatchDeterminationForm): +class BatchConceptDeterminationForm( + BaseConceptDeterminationForm, BaseBatchDeterminationForm +): def __init__(self, *args, submissions, initial=None, **kwargs): if initial is None: initial = {} - initial.update(submissions=submissions.values_list('id', flat=True)) - super(BaseBatchDeterminationForm, self).__init__(*args, initial=initial, **kwargs) - self.fields['outcome'].widget = forms.HiddenInput() + initial.update(submissions=submissions.values_list("id", flat=True)) + super(BaseBatchDeterminationForm, self).__init__( + *args, initial=initial, **kwargs + ) + self.fields["outcome"].widget = forms.HiddenInput() - self.fields = self.apply_form_settings('concept', self.fields) + self.fields = self.apply_form_settings("concept", self.fields) -class BatchProposalDeterminationForm(BaseProposalDeterminationForm, BaseBatchDeterminationForm): +class BatchProposalDeterminationForm( + BaseProposalDeterminationForm, BaseBatchDeterminationForm +): def __init__(self, *args, submissions, initial=None, **kwargs): if initial is None: initial = {} - initial.update(submissions=submissions.values_list('id', flat=True)) - super(BaseBatchDeterminationForm, self).__init__(*args, initial=initial, **kwargs) - self.fields['outcome'].widget = forms.HiddenInput() + initial.update(submissions=submissions.values_list("id", flat=True)) + super(BaseBatchDeterminationForm, self).__init__( + *args, initial=initial, **kwargs + ) + self.fields["outcome"].widget = forms.HiddenInput() - self.fields = self.apply_form_settings('proposal', self.fields) + self.fields = self.apply_form_settings("proposal", self.fields) class MixedMetaClass(type(StreamBaseForm), type(forms.ModelForm)): @@ -440,26 +476,33 @@ class DeterminationModelForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMet class Meta: model = Determination - fields = ['outcome', 'message', 'submission', 'author', 'send_notice'] + fields = ["outcome", "message", "submission", "author", "send_notice"] widgets = { - 'outcome': forms.HiddenInput(), - 'message': forms.HiddenInput(), - 'submission': forms.HiddenInput(), - 'author': forms.HiddenInput(), - 'send_notice': forms.HiddenInput(), + "outcome": forms.HiddenInput(), + "message": forms.HiddenInput(), + "submission": forms.HiddenInput(), + "author": forms.HiddenInput(), + "send_notice": forms.HiddenInput(), } error_messages = { NON_FIELD_ERRORS: { - 'unique_together': "You have already created a determination for this submission", + "unique_together": "You have already created a determination for this submission", } } def __init__( - self, *args, submission, action, user=None, - edit=False, initial=None, instance=None, site=None, - **kwargs + self, + *args, + submission, + action, + user=None, + edit=False, + initial=None, + instance=None, + site=None, + **kwargs, ): if initial is None: initial = {} @@ -481,12 +524,12 @@ def __init__( field.required = False if edit: - self.fields.pop('outcome') + self.fields.pop("outcome") self.draft_button_name = None def clean(self): cleaned_data = super().clean() - cleaned_data['form_data'] = { + cleaned_data["form_data"] = { key: value for key, value in cleaned_data.items() if key not in self._meta.fields @@ -497,16 +540,19 @@ def clean(self): def save(self, commit=True): self.instance.send_notice = ( self.cleaned_data[self.instance.send_notice_field.id] - if self.instance.send_notice_field else True + if self.instance.send_notice_field + else True ) self.instance.message = self.cleaned_data[self.instance.message_field.id] try: - self.instance.outcome = int(self.cleaned_data[self.instance.determination_field.id]) + self.instance.outcome = int( + self.cleaned_data[self.instance.determination_field.id] + ) # Need to catch KeyError as outcome field would not exist in case of edit. except KeyError: pass self.instance.is_draft = self.draft_button_name in self.data - self.instance.form_data = self.cleaned_data['form_data'] + self.instance.form_data = self.cleaned_data["form_data"] return super().save(commit) @@ -526,37 +572,45 @@ class BatchDeterminationForm(StreamBaseForm, forms.Form, metaclass=FormMixedMeta ) outcome = forms.ChoiceField( choices=DETERMINATION_CHOICES, - label=_('Determination'), - help_text='Do you recommend requesting a proposal based on this concept note?', - widget=forms.HiddenInput() + label=_("Determination"), + help_text="Do you recommend requesting a proposal based on this concept note?", + widget=forms.HiddenInput(), ) def __init__( - self, *args, user, submissions, action, initial=None, - edit=False, site=None, **kwargs + self, + *args, + user, + submissions, + action, + initial=None, + edit=False, + site=None, + **kwargs, ): if initial is None: initial = {} - initial.update(submissions=submissions.values_list('id', flat=True)) + initial.update(submissions=submissions.values_list("id", flat=True)) try: initial.update(outcome=TRANSITION_DETERMINATION[action]) except KeyError: pass initial.update(author=user.id) super().__init__(*args, initial=initial, **kwargs) - self.fields['submissions'].disabled = True - self.fields['author'].disabled = True - self.fields['outcome'].disabled = True + self.fields["submissions"].disabled = True + self.fields["author"].disabled = True + self.fields["outcome"].disabled = True def data_fields(self): return [ - field for field in self.fields - if field not in ['submissions', 'outcome', 'author', 'send_notice'] + field + for field in self.fields + if field not in ["submissions", "outcome", "author", "send_notice"] ] def clean(self): cleaned_data = super().clean() - cleaned_data['form_data'] = { + cleaned_data["form_data"] = { key: value for key, value in cleaned_data.items() if key in self.data_fields() @@ -565,13 +619,13 @@ def clean(self): def clean_outcome(self): # Enforce outcome as an int - return int(self.cleaned_data['outcome']) + return int(self.cleaned_data["outcome"]) def _post_clean(self): - submissions = self.cleaned_data['submissions'].undetermined() + submissions = self.cleaned_data["submissions"].undetermined() data = { field: self.cleaned_data[field] - for field in ['author', 'form_data', 'outcome'] + for field in ["author", "form_data", "outcome"] } self.instances = [ diff --git a/hypha/apply/determinations/management/commands/migrate_concept_determinations.py b/hypha/apply/determinations/management/commands/migrate_concept_determinations.py index 48078e6c69..3c1eafe1cb 100644 --- a/hypha/apply/determinations/management/commands/migrate_concept_determinations.py +++ b/hypha/apply/determinations/management/commands/migrate_concept_determinations.py @@ -44,11 +44,13 @@ class Command(BaseCommand): } def add_arguments(self, parser): - parser.add_argument('source', type=argparse.FileType('r'), help='Migration source JSON file') + parser.add_argument( + "source", type=argparse.FileType("r"), help="Migration source JSON file" + ) @transaction.atomic def handle(self, *args, **options): - with options['source'] as json_data: + with options["source"] as json_data: self.data = json.load(json_data) blacklist = {"8104"} @@ -62,9 +64,9 @@ def process(self, id): form_data = {} try: - determination = Determination.objects.get(drupal_id=node['nid']) + determination = Determination.objects.get(drupal_id=node["nid"]) except Determination.DoesNotExist: - determination = Determination(drupal_id=node['nid']) + determination = Determination(drupal_id=node["nid"]) # Disable auto_* on date fields so imported dates are used. for field in determination._meta.local_fields: @@ -74,18 +76,24 @@ def process(self, id): field.auto_now = False # TODO timezone? - determination.created_at = datetime.fromtimestamp(int(node['created']), timezone.utc) - determination.updated_at = datetime.fromtimestamp(int(node['changed']), timezone.utc) - determination.author = self.get_user(node['uid']) + determination.created_at = datetime.fromtimestamp( + int(node["created"]), timezone.utc + ) + determination.updated_at = datetime.fromtimestamp( + int(node["changed"]), timezone.utc + ) + determination.author = self.get_user(node["uid"]) determination.submission = self.get_submission(node) determination.outcome = self.get_determination(node) - determination.message = self.get_field_value('field_cnsr_determination_message', node) + determination.message = self.get_field_value( + "field_cnsr_determination_message", node + ) for field in node: if field in self.STREAMFIELD_MAP: try: - id = self.STREAMFIELD_MAP[field]['id'] - if id != 'message': + id = self.STREAMFIELD_MAP[field]["id"] + if id != "message": form_data[id] = self.get_field_value(field, node) except TypeError: pass @@ -96,7 +104,9 @@ def process(self, id): determination.save() self.stdout.write(f"Processed \"{node['title']}\" ({node['nid']})") except IntegrityError: - self.stdout.write(f"Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError") + self.stdout.write( + f"Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError" + ) pass def get_field_value(self, field, node): @@ -109,32 +119,32 @@ def get_field_value(self, field, node): field: [{value|target_id|tid: VALUE},] """ mapping = self.STREAMFIELD_MAP[field] - mapping_type = mapping['type'] - key = mapping.get('key', 'value') + mapping_type = mapping["type"] + key = mapping.get("key", "value") source_value = node[field] value = None if mapping_type == "direct": value = source_value - elif mapping_type == 'value': + elif mapping_type == "value": if key in source_value: - value = self.nl2br(source_value[key]) if source_value else '' + value = self.nl2br(source_value[key]) if source_value else "" else: - value = self.nl2br(source_value['value']) if source_value else '' - elif mapping_type == 'map' and 'map' in 'mapping': - value = mapping['map'].get(source_value[key]) - elif mapping_type == 'address' and 'map' in mapping: + value = self.nl2br(source_value["value"]) if source_value else "" + elif mapping_type == "map" and "map" in "mapping": + value = mapping["map"].get(source_value[key]) + elif mapping_type == "address" and "map" in mapping: try: - value_map = mapping['map'] + value_map = mapping["map"] value = {} for item in value_map: value[value_map[item]] = source_value[item] value = json.dumps(value) except TypeError: value = {} - elif mapping_type == 'boolean': - value = source_value[key] == '1' if source_value else False - elif mapping_type == 'category': + elif mapping_type == "boolean": + value = source_value[key] == "1" if source_value else False + elif mapping_type == "category": if not source_value: value = [] else: @@ -147,7 +157,7 @@ def get_field_value(self, field, node): option = self.get_referenced_term(item[key]) if option: value.append(option) - elif mapping_type == 'file': + elif mapping_type == "file": # TODO finish mapping. Requires access to the files. value = {} @@ -162,10 +172,10 @@ def get_user(self, uid): def get_submission(self, node): try: - nid = node['field_submission_concept_note']['target_id'] + nid = node["field_submission_concept_note"]["target_id"] return ApplicationSubmission.objects.get(drupal_id=nid) except ApplicationSubmission.DoesNotExist: - return 'None' + return "None" def get_determination(self, node): choices = { @@ -173,15 +183,15 @@ def get_determination(self, node): "approved": 2, "dropped": 0, "unapproved": 0, - "undetermined": 1 + "undetermined": 1, } try: - determination = choices.get(node['field_cnsr_determination']['value'], 1) + determination = choices.get(node["field_cnsr_determination"]["value"], 1) except TypeError: determination = 1 return determination def nl2br(self, value): - return value.replace('\r\n', '
\n') + return value.replace("\r\n", "
\n") diff --git a/hypha/apply/determinations/management/commands/migrate_proposal_determinations.py b/hypha/apply/determinations/management/commands/migrate_proposal_determinations.py index 4333565d77..dca0549646 100644 --- a/hypha/apply/determinations/management/commands/migrate_proposal_determinations.py +++ b/hypha/apply/determinations/management/commands/migrate_proposal_determinations.py @@ -99,11 +99,13 @@ class Command(BaseCommand): } def add_arguments(self, parser): - parser.add_argument('source', type=argparse.FileType('r'), help='Migration source JSON file') + parser.add_argument( + "source", type=argparse.FileType("r"), help="Migration source JSON file" + ) @transaction.atomic def handle(self, *args, **options): - with options['source'] as json_data: + with options["source"] as json_data: self.data = json.load(json_data) for id in self.data: @@ -114,9 +116,9 @@ def process(self, id): form_data = {} try: - determination = Determination.objects.get(drupal_id=node['nid']) + determination = Determination.objects.get(drupal_id=node["nid"]) except Determination.DoesNotExist: - determination = Determination(drupal_id=node['nid']) + determination = Determination(drupal_id=node["nid"]) # Disable auto_* on date fields so imported dates are used. for field in determination._meta.local_fields: @@ -126,18 +128,24 @@ def process(self, id): field.auto_now = False # TODO timezone? - determination.created_at = datetime.fromtimestamp(int(node['created']), timezone.utc) - determination.updated_at = datetime.fromtimestamp(int(node['changed']), timezone.utc) - determination.author = self.get_user(node['uid']) + determination.created_at = datetime.fromtimestamp( + int(node["created"]), timezone.utc + ) + determination.updated_at = datetime.fromtimestamp( + int(node["changed"]), timezone.utc + ) + determination.author = self.get_user(node["uid"]) determination.submission = self.get_submission(node) determination.outcome = self.get_determination(node) - determination.message = self.get_field_value('field_psr_determination_message', node) + determination.message = self.get_field_value( + "field_psr_determination_message", node + ) for field in node: if field in self.STREAMFIELD_MAP: try: - id = self.STREAMFIELD_MAP[field]['id'] - if id != 'message': + id = self.STREAMFIELD_MAP[field]["id"] + if id != "message": form_data[id] = self.get_field_value(field, node) except TypeError: pass @@ -149,8 +157,11 @@ def process(self, id): self.stdout.write(f"Processed \"{node['title']}\" ({node['nid']})") except IntegrityError: import pprint + pprint.pprint(determination.submission) - self.stdout.write(f"Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError") + self.stdout.write( + f"Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError" + ) pass def get_field_value(self, field, node): @@ -163,32 +174,32 @@ def get_field_value(self, field, node): field: [{value|target_id|tid: VALUE},] """ mapping = self.STREAMFIELD_MAP[field] - mapping_type = mapping['type'] - key = mapping.get('key', 'value') + mapping_type = mapping["type"] + key = mapping.get("key", "value") source_value = node[field] value = None if mapping_type == "direct": value = source_value - elif mapping_type == 'value': + elif mapping_type == "value": if key in source_value: - value = self.nl2br(source_value[key]) if source_value else '' + value = self.nl2br(source_value[key]) if source_value else "" else: - value = self.nl2br(source_value['value']) if source_value else '' - elif mapping_type == 'map' and 'map' in 'mapping': - value = mapping['map'].get(source_value[key]) - elif mapping_type == 'address' and 'map' in mapping: + value = self.nl2br(source_value["value"]) if source_value else "" + elif mapping_type == "map" and "map" in "mapping": + value = mapping["map"].get(source_value[key]) + elif mapping_type == "address" and "map" in mapping: try: - value_map = mapping['map'] + value_map = mapping["map"] value = {} for item in value_map: value[value_map[item]] = source_value[item] value = json.dumps(value) except TypeError: value = {} - elif mapping_type == 'boolean': - value = source_value[key] == '1' if source_value else False - elif mapping_type == 'category': + elif mapping_type == "boolean": + value = source_value[key] == "1" if source_value else False + elif mapping_type == "category": if not source_value: value = [] else: @@ -201,7 +212,7 @@ def get_field_value(self, field, node): option = self.get_referenced_term(item[key]) if option: value.append(option) - elif mapping_type == 'file': + elif mapping_type == "file": # TODO finish mapping. Requires access to the files. value = {} @@ -210,8 +221,8 @@ def get_field_value(self, field, node): def get_user(self, uid): # Dan Blah hade one extra admin account uid 52 in old system, # all content should be set to uid 2 in the new system. - if uid == '52': - uid = '2' + if uid == "52": + uid = "2" try: User = get_user_model() return User.objects.get(drupal_id=uid) @@ -220,10 +231,10 @@ def get_user(self, uid): def get_submission(self, node): try: - nid = node['field_submission_proposal']['target_id'] + nid = node["field_submission_proposal"]["target_id"] return ApplicationSubmission.objects.get(drupal_id=nid) except ApplicationSubmission.DoesNotExist: - return 'None' + return "None" def get_determination(self, node): choices = { @@ -231,15 +242,15 @@ def get_determination(self, node): "approved": 2, "dropped": 0, "unapproved": 0, - "undetermined": 1 + "undetermined": 1, } try: - determination = choices.get(node['field_psr_determination']['value'], 1) + determination = choices.get(node["field_psr_determination"]["value"], 1) except TypeError: determination = 1 return determination def nl2br(self, value): - return value.replace('\r\n', '
\n') + return value.replace("\r\n", "
\n") diff --git a/hypha/apply/determinations/migrations/0001_initial.py b/hypha/apply/determinations/migrations/0001_initial.py index 4729c5a3ee..1653ae5034 100644 --- a/hypha/apply/determinations/migrations/0001_initial.py +++ b/hypha/apply/determinations/migrations/0001_initial.py @@ -7,28 +7,62 @@ class Migration(migrations.Migration): - initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0032_make_reviewers_optional_in_all_instances'), + ("funds", "0032_make_reviewers_optional_in_all_instances"), ] operations = [ migrations.CreateModel( - name='Determination', + name="Determination", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('determination_data', django.contrib.postgres.fields.jsonb.JSONField()), - ('determination', models.IntegerField(choices=[(0, 'Unapproved'), (1, 'Undetermined'), (2, 'Approved')], default=0, verbose_name='Determination')), - ('is_draft', models.BooleanField(default=False, verbose_name='Draft')), - ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), - ('submission', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='determination', to='funds.ApplicationSubmission')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "determination_data", + django.contrib.postgres.fields.jsonb.JSONField(), + ), + ( + "determination", + models.IntegerField( + choices=[ + (0, "Unapproved"), + (1, "Undetermined"), + (2, "Approved"), + ], + default=0, + verbose_name="Determination", + ), + ), + ("is_draft", models.BooleanField(default=False, verbose_name="Draft")), + ( + "author", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "submission", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name="determination", + to="funds.ApplicationSubmission", + ), + ), ], ), migrations.AlterUniqueTogether( - name='determination', - unique_together={('author', 'submission')}, + name="determination", + unique_together={("author", "submission")}, ), ] diff --git a/hypha/apply/determinations/migrations/0002_add_fields.py b/hypha/apply/determinations/migrations/0002_add_fields.py index 648e297fd9..23344d6079 100644 --- a/hypha/apply/determinations/migrations/0002_add_fields.py +++ b/hypha/apply/determinations/migrations/0002_add_fields.py @@ -6,49 +6,56 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0001_initial'), + ("determinations", "0001_initial"), ] operations = [ migrations.AddField( - model_name='determination', - name='created_at', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Creation time'), + model_name="determination", + name="created_at", + field=models.DateTimeField( + auto_now_add=True, + default=django.utils.timezone.now, + verbose_name="Creation time", + ), preserve_default=False, ), migrations.AddField( - model_name='determination', - name='data', + model_name="determination", + name="data", field=django.contrib.postgres.fields.jsonb.JSONField(blank=True), preserve_default=False, ), migrations.AddField( - model_name='determination', - name='message', - field=models.TextField(blank=True, verbose_name='Determination message'), + model_name="determination", + name="message", + field=models.TextField(blank=True, verbose_name="Determination message"), ), migrations.AddField( - model_name='determination', - name='outcome', - field=models.IntegerField(choices=[(0, 'Rejected'), (1, 'Needs more info'), (2, 'Accepted')], default=1, verbose_name='Determination'), + model_name="determination", + name="outcome", + field=models.IntegerField( + choices=[(0, "Rejected"), (1, "Needs more info"), (2, "Accepted")], + default=1, + verbose_name="Determination", + ), ), migrations.AddField( - model_name='determination', - name='updated_at', - field=models.DateTimeField(auto_now=True, verbose_name='Update time'), + model_name="determination", + name="updated_at", + field=models.DateTimeField(auto_now=True, verbose_name="Update time"), ), migrations.AlterUniqueTogether( - name='determination', + name="determination", unique_together=set(), ), migrations.RemoveField( - model_name='determination', - name='determination', + model_name="determination", + name="determination", ), migrations.RemoveField( - model_name='determination', - name='determination_data', + model_name="determination", + name="determination_data", ), ] diff --git a/hypha/apply/determinations/migrations/0003_message_template_settings.py b/hypha/apply/determinations/migrations/0003_message_template_settings.py index 0ba59cffd5..180dd9e98a 100644 --- a/hypha/apply/determinations/migrations/0003_message_template_settings.py +++ b/hypha/apply/determinations/migrations/0003_message_template_settings.py @@ -6,30 +6,71 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('determinations', '0002_add_fields'), + ("wagtailcore", "0040_page_draft_title"), + ("determinations", "0002_add_fields"), ] operations = [ migrations.CreateModel( - name='DeterminationMessageSettings', + name="DeterminationMessageSettings", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('request_accepted', wagtail.fields.RichTextField(verbose_name='Accepted')), - ('request_rejected', wagtail.fields.RichTextField(verbose_name='Rejected')), - ('request_more_info', wagtail.fields.RichTextField(verbose_name='Needs more info')), - ('concept_accepted', wagtail.fields.RichTextField(verbose_name='Accepted')), - ('concept_rejected', wagtail.fields.RichTextField(verbose_name='Rejected')), - ('concept_more_info', wagtail.fields.RichTextField(verbose_name='Needs more info')), - ('proposal_accepted', wagtail.fields.RichTextField(verbose_name='Accepted')), - ('proposal_rejected', wagtail.fields.RichTextField(verbose_name='Rejected')), - ('proposal_more_info', wagtail.fields.RichTextField(verbose_name='Needs more info')), - ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "request_accepted", + wagtail.fields.RichTextField(verbose_name="Accepted"), + ), + ( + "request_rejected", + wagtail.fields.RichTextField(verbose_name="Rejected"), + ), + ( + "request_more_info", + wagtail.fields.RichTextField(verbose_name="Needs more info"), + ), + ( + "concept_accepted", + wagtail.fields.RichTextField(verbose_name="Accepted"), + ), + ( + "concept_rejected", + wagtail.fields.RichTextField(verbose_name="Rejected"), + ), + ( + "concept_more_info", + wagtail.fields.RichTextField(verbose_name="Needs more info"), + ), + ( + "proposal_accepted", + wagtail.fields.RichTextField(verbose_name="Accepted"), + ), + ( + "proposal_rejected", + wagtail.fields.RichTextField(verbose_name="Rejected"), + ), + ( + "proposal_more_info", + wagtail.fields.RichTextField(verbose_name="Needs more info"), + ), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Site", + ), + ), ], options={ - 'verbose_name': 'determination messages', + "verbose_name": "determination messages", }, ), ] diff --git a/hypha/apply/determinations/migrations/0004_change_labels.py b/hypha/apply/determinations/migrations/0004_change_labels.py index ece3150b24..d7b1826408 100644 --- a/hypha/apply/determinations/migrations/0004_change_labels.py +++ b/hypha/apply/determinations/migrations/0004_change_labels.py @@ -5,45 +5,48 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0003_message_template_settings'), + ("determinations", "0003_message_template_settings"), ] operations = [ migrations.AlterField( - model_name='determination', - name='outcome', - field=models.IntegerField(choices=[(0, 'Dismissed'), (1, 'Needs more info'), (2, 'Approved')], default=1, verbose_name='Determination'), + model_name="determination", + name="outcome", + field=models.IntegerField( + choices=[(0, "Dismissed"), (1, "Needs more info"), (2, "Approved")], + default=1, + verbose_name="Determination", + ), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='concept_accepted', - field=wagtail.fields.RichTextField(verbose_name='Approved'), + model_name="determinationmessagesettings", + name="concept_accepted", + field=wagtail.fields.RichTextField(verbose_name="Approved"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='concept_rejected', - field=wagtail.fields.RichTextField(verbose_name='Dismissed'), + model_name="determinationmessagesettings", + name="concept_rejected", + field=wagtail.fields.RichTextField(verbose_name="Dismissed"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='proposal_accepted', - field=wagtail.fields.RichTextField(verbose_name='Approved'), + model_name="determinationmessagesettings", + name="proposal_accepted", + field=wagtail.fields.RichTextField(verbose_name="Approved"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='proposal_rejected', - field=wagtail.fields.RichTextField(verbose_name='Dismissed'), + model_name="determinationmessagesettings", + name="proposal_rejected", + field=wagtail.fields.RichTextField(verbose_name="Dismissed"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='request_accepted', - field=wagtail.fields.RichTextField(verbose_name='Approved'), + model_name="determinationmessagesettings", + name="request_accepted", + field=wagtail.fields.RichTextField(verbose_name="Approved"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='request_rejected', - field=wagtail.fields.RichTextField(verbose_name='Dismissed'), + model_name="determinationmessagesettings", + name="request_rejected", + field=wagtail.fields.RichTextField(verbose_name="Dismissed"), ), ] diff --git a/hypha/apply/determinations/migrations/0005_determination_drupal_id.py b/hypha/apply/determinations/migrations/0005_determination_drupal_id.py index 5b3c5626e3..580b15ee48 100644 --- a/hypha/apply/determinations/migrations/0005_determination_drupal_id.py +++ b/hypha/apply/determinations/migrations/0005_determination_drupal_id.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0004_change_labels'), + ("determinations", "0004_change_labels"), ] operations = [ migrations.AddField( - model_name='determination', - name='drupal_id', + model_name="determination", + name="drupal_id", field=models.IntegerField(blank=True, editable=False, null=True), ), ] diff --git a/hypha/apply/determinations/migrations/0006_allow_multiple_determinations.py b/hypha/apply/determinations/migrations/0006_allow_multiple_determinations.py index 7a4bddebee..7a35dd97b1 100644 --- a/hypha/apply/determinations/migrations/0006_allow_multiple_determinations.py +++ b/hypha/apply/determinations/migrations/0006_allow_multiple_determinations.py @@ -5,15 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0005_determination_drupal_id'), + ("determinations", "0005_determination_drupal_id"), ] operations = [ migrations.AlterField( - model_name='determination', - name='submission', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='determinations', to='funds.ApplicationSubmission'), + model_name="determination", + name="submission", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="determinations", + to="funds.ApplicationSubmission", + ), ), ] diff --git a/hypha/apply/determinations/migrations/0007_add_determinationformsettings.py b/hypha/apply/determinations/migrations/0007_add_determinationformsettings.py index c71c2876bb..dd9a005fc9 100644 --- a/hypha/apply/determinations/migrations/0007_add_determinationformsettings.py +++ b/hypha/apply/determinations/migrations/0007_add_determinationformsettings.py @@ -5,55 +5,233 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('determinations', '0006_allow_multiple_determinations'), + ("wagtailcore", "0040_page_draft_title"), + ("determinations", "0006_allow_multiple_determinations"), ] operations = [ migrations.CreateModel( - name='DeterminationFormSettings', + name="DeterminationFormSettings", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('concept_principles_label', models.CharField(default='Goals and principles', max_length=255, verbose_name='label')), - ('concept_principles_help_text', models.TextField(blank=True, verbose_name='help text')), - ('concept_technical_label', models.CharField(default='Technical merit', max_length=255, verbose_name='label')), - ('concept_technical_help_text', models.TextField(blank=True, verbose_name='help text')), - ('concept_sustainable_label', models.CharField(default='Reasonable, realistic and sustainable', max_length=255, verbose_name='label')), - ('concept_sustainable_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_liked_label', models.CharField(default='Positive aspects', max_length=255, verbose_name='label')), - ('proposal_liked_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_concerns_label', models.CharField(default='Concerns', max_length=255, verbose_name='label')), - ('proposal_concerns_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_red_flags_label', models.CharField(default='Items that must be addressed', max_length=255, verbose_name='label')), - ('proposal_red_flags_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_overview_label', models.CharField(default='Project overview questions and comments', max_length=255, verbose_name='label')), - ('proposal_overview_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_objectives_label', models.CharField(default='Objectives questions and comments', max_length=255, verbose_name='label')), - ('proposal_objectives_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_strategy_label', models.CharField(default='Methods and strategy questions and comments', max_length=255, verbose_name='label')), - ('proposal_strategy_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_technical_label', models.CharField(default='Technical feasibility questions and comments', max_length=255, verbose_name='label')), - ('proposal_technical_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_alternative_label', models.CharField(default='Alternative analysis - "red teaming" questions and comments', max_length=255, verbose_name='label')), - ('proposal_alternative_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_usability_label', models.CharField(default='Usability questions and comments', max_length=255, verbose_name='label')), - ('proposal_usability_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_sustainability_label', models.CharField(default='Sustainability questions and comments', max_length=255, verbose_name='label')), - ('proposal_sustainability_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_collaboration_label', models.CharField(default='Collaboration questions and comments', max_length=255, verbose_name='label')), - ('proposal_collaboration_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_realism_label', models.CharField(default='Cost realism questions and comments', max_length=255, verbose_name='label')), - ('proposal_realism_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_qualifications_label', models.CharField(default='Qualifications questions and comments', max_length=255, verbose_name='label')), - ('proposal_qualifications_help_text', models.TextField(blank=True, verbose_name='help text')), - ('proposal_evaluation_label', models.CharField(default='Evaluation questions and comments', max_length=255, verbose_name='label')), - ('proposal_evaluation_help_text', models.TextField(blank=True, verbose_name='help text')), - ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "concept_principles_label", + models.CharField( + default="Goals and principles", + max_length=255, + verbose_name="label", + ), + ), + ( + "concept_principles_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "concept_technical_label", + models.CharField( + default="Technical merit", max_length=255, verbose_name="label" + ), + ), + ( + "concept_technical_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "concept_sustainable_label", + models.CharField( + default="Reasonable, realistic and sustainable", + max_length=255, + verbose_name="label", + ), + ), + ( + "concept_sustainable_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_liked_label", + models.CharField( + default="Positive aspects", max_length=255, verbose_name="label" + ), + ), + ( + "proposal_liked_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_concerns_label", + models.CharField( + default="Concerns", max_length=255, verbose_name="label" + ), + ), + ( + "proposal_concerns_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_red_flags_label", + models.CharField( + default="Items that must be addressed", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_red_flags_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_overview_label", + models.CharField( + default="Project overview questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_overview_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_objectives_label", + models.CharField( + default="Objectives questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_objectives_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_strategy_label", + models.CharField( + default="Methods and strategy questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_strategy_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_technical_label", + models.CharField( + default="Technical feasibility questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_technical_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_alternative_label", + models.CharField( + default='Alternative analysis - "red teaming" questions and comments', + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_alternative_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_usability_label", + models.CharField( + default="Usability questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_usability_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_sustainability_label", + models.CharField( + default="Sustainability questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_sustainability_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_collaboration_label", + models.CharField( + default="Collaboration questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_collaboration_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_realism_label", + models.CharField( + default="Cost realism questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_realism_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_qualifications_label", + models.CharField( + default="Qualifications questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_qualifications_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "proposal_evaluation_label", + models.CharField( + default="Evaluation questions and comments", + max_length=255, + verbose_name="label", + ), + ), + ( + "proposal_evaluation_help_text", + models.TextField(blank=True, verbose_name="help text"), + ), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Site", + ), + ), ], options={ - 'verbose_name': 'determination settings', + "verbose_name": "determination settings", }, ), ] diff --git a/hypha/apply/determinations/migrations/0008_rename_more_info.py b/hypha/apply/determinations/migrations/0008_rename_more_info.py index f397dc4d8f..b2ad8a4365 100644 --- a/hypha/apply/determinations/migrations/0008_rename_more_info.py +++ b/hypha/apply/determinations/migrations/0008_rename_more_info.py @@ -4,15 +4,22 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0007_add_determinationformsettings'), + ("determinations", "0007_add_determinationformsettings"), ] operations = [ migrations.AlterField( - model_name='determination', - name='outcome', - field=models.IntegerField(choices=[(0, 'Dismissed'), (1, 'More information requested'), (2, 'Approved')], default=1, verbose_name='Determination'), + model_name="determination", + name="outcome", + field=models.IntegerField( + choices=[ + (0, "Dismissed"), + (1, "More information requested"), + (2, "Approved"), + ], + default=1, + verbose_name="Determination", + ), ), ] diff --git a/hypha/apply/determinations/migrations/0009_add_send_notice_field.py b/hypha/apply/determinations/migrations/0009_add_send_notice_field.py index 330519e11a..10562d01a3 100644 --- a/hypha/apply/determinations/migrations/0009_add_send_notice_field.py +++ b/hypha/apply/determinations/migrations/0009_add_send_notice_field.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0008_rename_more_info'), + ("determinations", "0008_rename_more_info"), ] operations = [ migrations.AddField( - model_name='determination', - name='send_notice', - field=models.BooleanField(default=True, verbose_name='Send message to applicant'), + model_name="determination", + name="send_notice", + field=models.BooleanField( + default=True, verbose_name="Send message to applicant" + ), ), ] diff --git a/hypha/apply/determinations/migrations/0010_add_determination_stream_field_forms.py b/hypha/apply/determinations/migrations/0010_add_determination_stream_field_forms.py index b747186fe6..3e5ccbcf3c 100644 --- a/hypha/apply/determinations/migrations/0010_add_determination_stream_field_forms.py +++ b/hypha/apply/determinations/migrations/0010_add_determination_stream_field_forms.py @@ -9,36 +9,725 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0009_add_send_notice_field'), + ("determinations", "0009_add_send_notice_field"), ] operations = [ migrations.CreateModel( - name='DeterminationForm', + name="DeterminationForm", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('form_fields', wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Section text/header')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[])), - ('name', models.CharField(max_length=255)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "form_fields", + wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Fields", label="Section text/header" + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "info", + wagtail.blocks.static_block.StaticBlock(), + ), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "info", + wagtail.blocks.static_block.StaticBlock(), + ), + ], + group=" Required", + ), + ), + ], + default=[], + ), + ), + ("name", models.CharField(max_length=255)), ], options={ - 'abstract': False, + "abstract": False, }, ), migrations.AddField( - model_name='determination', - name='form_data', - field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder), + model_name="determination", + name="form_data", + field=django.contrib.postgres.fields.jsonb.JSONField( + default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder + ), ), migrations.AddField( - model_name='determination', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Section text/header')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[]), + model_name="determination", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Fields", label="Section text/header" + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + ), ), migrations.AlterField( - model_name='determination', - name='data', + model_name="determination", + name="data", field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True), ), ] diff --git a/hypha/apply/determinations/migrations/0011_auto_20220111_1314.py b/hypha/apply/determinations/migrations/0011_auto_20220111_1314.py index b2ca4b01ae..4b4e906c85 100644 --- a/hypha/apply/determinations/migrations/0011_auto_20220111_1314.py +++ b/hypha/apply/determinations/migrations/0011_auto_20220111_1314.py @@ -5,20 +5,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0010_add_determination_stream_field_forms'), + ("determinations", "0010_add_determination_stream_field_forms"), ] operations = [ migrations.AlterField( - model_name='determination', - name='data', + model_name="determination", + name="data", field=models.JSONField(blank=True, null=True), ), migrations.AlterField( - model_name='determination', - name='form_data', - field=models.JSONField(default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder), + model_name="determination", + name="form_data", + field=models.JSONField( + default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder + ), ), ] diff --git a/hypha/apply/determinations/migrations/0012_auto_20220509_1136.py b/hypha/apply/determinations/migrations/0012_auto_20220509_1136.py index 044519ade4..3467152c92 100644 --- a/hypha/apply/determinations/migrations/0012_auto_20220509_1136.py +++ b/hypha/apply/determinations/migrations/0012_auto_20220509_1136.py @@ -5,55 +5,60 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0011_auto_20220111_1314'), + ("determinations", "0011_auto_20220111_1314"), ] operations = [ migrations.AlterField( - model_name='determinationmessagesettings', - name='concept_accepted', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Approved'), + model_name="determinationmessagesettings", + name="concept_accepted", + field=wagtail.fields.RichTextField(blank=True, verbose_name="Approved"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='concept_more_info', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Needs more info'), + model_name="determinationmessagesettings", + name="concept_more_info", + field=wagtail.fields.RichTextField( + blank=True, verbose_name="Needs more info" + ), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='concept_rejected', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Dismissed'), + model_name="determinationmessagesettings", + name="concept_rejected", + field=wagtail.fields.RichTextField(blank=True, verbose_name="Dismissed"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='proposal_accepted', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Approved'), + model_name="determinationmessagesettings", + name="proposal_accepted", + field=wagtail.fields.RichTextField(blank=True, verbose_name="Approved"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='proposal_more_info', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Needs more info'), + model_name="determinationmessagesettings", + name="proposal_more_info", + field=wagtail.fields.RichTextField( + blank=True, verbose_name="Needs more info" + ), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='proposal_rejected', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Dismissed'), + model_name="determinationmessagesettings", + name="proposal_rejected", + field=wagtail.fields.RichTextField(blank=True, verbose_name="Dismissed"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='request_accepted', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Approved'), + model_name="determinationmessagesettings", + name="request_accepted", + field=wagtail.fields.RichTextField(blank=True, verbose_name="Approved"), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='request_more_info', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Needs more info'), + model_name="determinationmessagesettings", + name="request_more_info", + field=wagtail.fields.RichTextField( + blank=True, verbose_name="Needs more info" + ), ), migrations.AlterField( - model_name='determinationmessagesettings', - name='request_rejected', - field=wagtail.fields.RichTextField(blank=True, verbose_name='Dismissed'), + model_name="determinationmessagesettings", + name="request_rejected", + field=wagtail.fields.RichTextField(blank=True, verbose_name="Dismissed"), ), ] diff --git a/hypha/apply/determinations/migrations/0013_auto_20220722_0844.py b/hypha/apply/determinations/migrations/0013_auto_20220722_0844.py index be5e5086b0..ec4af3333a 100644 --- a/hypha/apply/determinations/migrations/0013_auto_20220722_0844.py +++ b/hypha/apply/determinations/migrations/0013_auto_20220722_0844.py @@ -7,20 +7,689 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0012_auto_20220509_1136'), + ("determinations", "0012_auto_20220509_1136"), ] operations = [ migrations.AlterField( - model_name='determination', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Section text/header')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[], use_json_field=True), + model_name="determination", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Fields", label="Section text/header" + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + use_json_field=True, + ), ), migrations.AlterField( - model_name='determinationform', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Section text/header')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[], use_json_field=True), + model_name="determinationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Fields", label="Section text/header" + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/determinations/migrations/0014_alter_determination_formfield_send_notice.py b/hypha/apply/determinations/migrations/0014_alter_determination_formfield_send_notice.py index 3c539916ce..98daae3ceb 100644 --- a/hypha/apply/determinations/migrations/0014_alter_determination_formfield_send_notice.py +++ b/hypha/apply/determinations/migrations/0014_alter_determination_formfield_send_notice.py @@ -7,20 +7,683 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0013_auto_20220722_0844'), + ("determinations", "0013_auto_20220722_0844"), ] operations = [ migrations.AlterField( - model_name='determination', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Section text/header')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('default_value', wagtail.blocks.BooleanBlock(default=True, required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[], use_json_field=True), + model_name="determination", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Fields", label="Section text/header" + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock( + default=True, required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + use_json_field=True, + ), ), migrations.AlterField( - model_name='determinationform', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Section text/header')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('default_value', wagtail.blocks.BooleanBlock(default=True, required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[], use_json_field=True), + model_name="determinationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Fields", label="Section text/header" + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock( + default=True, required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/determinations/migrations/0015_alter_determinationformsettings_options.py b/hypha/apply/determinations/migrations/0015_alter_determinationformsettings_options.py index 4f6775b25d..a18906912c 100644 --- a/hypha/apply/determinations/migrations/0015_alter_determinationformsettings_options.py +++ b/hypha/apply/determinations/migrations/0015_alter_determinationformsettings_options.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0014_alter_determination_formfield_send_notice'), + ("determinations", "0014_alter_determination_formfield_send_notice"), ] operations = [ migrations.AlterModelOptions( - name='determinationformsettings', - options={'verbose_name': 'determination form settings'}, + name="determinationformsettings", + options={"verbose_name": "determination form settings"}, ), ] diff --git a/hypha/apply/determinations/migrations/0016_rename_section_text_field.py b/hypha/apply/determinations/migrations/0016_rename_section_text_field.py index f0da11f85f..e8b5420436 100644 --- a/hypha/apply/determinations/migrations/0016_rename_section_text_field.py +++ b/hypha/apply/determinations/migrations/0016_rename_section_text_field.py @@ -7,20 +7,679 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0015_alter_determinationformsettings_options'), + ("determinations", "0015_alter_determinationformsettings_options"), ] operations = [ migrations.AlterField( - model_name='determination', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Paragraph')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('default_value', wagtail.blocks.BooleanBlock(default=True, required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[], use_json_field=True), + model_name="determination", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Fields", label="Paragraph"), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock( + default=True, required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + use_json_field=True, + ), ), migrations.AlterField( - model_name='determinationform', - name='form_fields', - field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Fields', label='Paragraph')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('determination', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('message', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('send_notice', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('default_value', wagtail.blocks.BooleanBlock(default=True, required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required'))], default=[], use_json_field=True), + model_name="determinationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Fields", label="Paragraph"), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "determination", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "message", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "send_notice", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock( + default=True, required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ], + default=[], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/determinations/models.py b/hypha/apply/determinations/models.py index f5ebe09ea8..0707ba0cf6 100644 --- a/hypha/apply/determinations/models.py +++ b/hypha/apply/determinations/models.py @@ -29,21 +29,20 @@ class DeterminationQuerySet(models.QuerySet): def staff(self): # Designed to be used with a queryset related to submissions - return self.all().order_by('-updated_at') + return self.all().order_by("-updated_at") def active(self): # Designed to be used with a queryset related to submissions return self.get(is_draft=True) def submitted(self): - return self.filter(is_draft=False).order_by('-updated_at') + return self.filter(is_draft=False).order_by("-updated_at") def final(self): return self.submitted().filter(outcome__in=[ACCEPTED, REJECTED]) class DeterminationFormFieldsMixin(models.Model): - wagtail_reference_index_ignore = True class Meta: @@ -86,8 +85,8 @@ class DeterminationForm(DeterminationFormFieldsMixin, models.Model): name = models.CharField(max_length=255) panels = [ - FieldPanel('name'), - FieldPanel('form_fields'), + FieldPanel("name"), + FieldPanel("form_fields"), ] def __str__(self): @@ -96,16 +95,18 @@ def __str__(self): class Determination(DeterminationFormFieldsMixin, AccessFormData, models.Model): submission = models.ForeignKey( - 'funds.ApplicationSubmission', + "funds.ApplicationSubmission", on_delete=models.CASCADE, - related_name='determinations' + related_name="determinations", ) author = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.PROTECT, ) - outcome = models.IntegerField(verbose_name=_("Determination"), choices=DETERMINATION_CHOICES, default=1) + outcome = models.IntegerField( + verbose_name=_("Determination"), choices=DETERMINATION_CHOICES, default=1 + ) message = models.TextField(verbose_name=_("Determination message"), blank=True) # Stores old determination forms data @@ -114,9 +115,13 @@ class Determination(DeterminationFormFieldsMixin, AccessFormData, models.Model): # Stores data submitted via streamfield determination forms form_data = models.JSONField(default=dict, encoder=DjangoJSONEncoder) is_draft = models.BooleanField(default=False, verbose_name=_("Draft")) - created_at = models.DateTimeField(verbose_name=_('Creation time'), auto_now_add=True) - updated_at = models.DateTimeField(verbose_name=_('Update time'), auto_now=True) - send_notice = models.BooleanField(default=True, verbose_name=_("Send message to applicant")) + created_at = models.DateTimeField( + verbose_name=_("Creation time"), auto_now_add=True + ) + updated_at = models.DateTimeField(verbose_name=_("Update time"), auto_now=True) + send_notice = models.BooleanField( + default=True, verbose_name=_("Send message to applicant") + ) # Meta: used for migration purposes only drupal_id = models.IntegerField(null=True, blank=True, editable=False) @@ -132,17 +137,20 @@ def clean_outcome(self): return self.get_outcome_display() def get_absolute_url(self): - return reverse('apply:submissions:determinations:detail', args=(self.submission.id, self.id)) + return reverse( + "apply:submissions:determinations:detail", + args=(self.submission.id, self.id), + ) @property def submitted(self): return not self.is_draft def __str__(self): - return f'Determination for {self.submission.title} by {self.author!s}' + return f"Determination for {self.submission.title} by {self.author!s}" def __repr__(self): - return f'<{self.__class__.__name__}: {str(self.form_data)}>' + return f"<{self.__class__.__name__}: {str(self.form_data)}>" @property def use_new_determination_form(self): @@ -162,13 +170,14 @@ def use_new_determination_form(self): def detailed_data(self): if not self.use_new_determination_form: from .views import get_form_for_stage + return get_form_for_stage(self.submission).get_detailed_response(self.data) return self.get_detailed_response() def get_detailed_response(self): data = {} group = 0 - data.setdefault(group, {'title': None, 'questions': []}) + data.setdefault(group, {"title": None, "questions": []}) for field in self.form_fields: if issubclass( field.block.__class__, DeterminationMustIncludeFieldBlock @@ -178,21 +187,18 @@ def get_detailed_response(self): value = self.form_data[field.id] except KeyError: group = group + 1 - data.setdefault(group, {'title': field.value.source, 'questions': []}) + data.setdefault(group, {"title": field.value.source, "questions": []}) else: - data[group]['questions'].append( - (field.value.get('field_label'), value) - ) + data[group]["questions"].append((field.value.get("field_label"), value)) return data @register_setting class DeterminationMessageSettings(BaseSiteSetting): - wagtail_reference_index_ignore = True class Meta: - verbose_name = 'determination messages' + verbose_name = "determination messages" request_accepted = RichTextField("Approved", blank=True) request_rejected = RichTextField("Dismissed", blank=True) @@ -216,151 +222,242 @@ def get_for_stage(self, stage_name): for field in self._meta.get_fields(): if prefix in field.name: - key = field.name.replace(prefix, '') + key = field.name.replace(prefix, "") message_templates[key] = getattr(self, field.name) return message_templates request_tab_panels = [ - FieldPanel('request_accepted'), - FieldPanel('request_rejected'), - FieldPanel('request_more_info'), + FieldPanel("request_accepted"), + FieldPanel("request_rejected"), + FieldPanel("request_more_info"), ] concept_tab_panels = [ - FieldPanel('concept_accepted'), - FieldPanel('concept_rejected'), - FieldPanel('concept_more_info'), + FieldPanel("concept_accepted"), + FieldPanel("concept_rejected"), + FieldPanel("concept_more_info"), ] proposal_tab_panels = [ - FieldPanel('proposal_accepted'), - FieldPanel('proposal_rejected'), - FieldPanel('proposal_more_info'), + FieldPanel("proposal_accepted"), + FieldPanel("proposal_rejected"), + FieldPanel("proposal_more_info"), ] - edit_handler = TabbedInterface([ - ObjectList(request_tab_panels, heading=_('Request')), - ObjectList(concept_tab_panels, heading=_('Concept note')), - ObjectList(proposal_tab_panels, heading=_('Proposal')), - ]) + edit_handler = TabbedInterface( + [ + ObjectList(request_tab_panels, heading=_("Request")), + ObjectList(concept_tab_panels, heading=_("Concept note")), + ObjectList(proposal_tab_panels, heading=_("Proposal")), + ] + ) @register_setting class DeterminationFormSettings(BaseSiteSetting): class Meta: - verbose_name = 'determination form settings' - - concept_principles_label = models.CharField('label', default='Goals and principles', max_length=255) - concept_principles_help_text = models.TextField('help text', blank=True) - concept_technical_label = models.CharField('label', default='Technical merit', max_length=255) - concept_technical_help_text = models.TextField('help text', blank=True) - concept_sustainable_label = models.CharField('label', default='Reasonable, realistic and sustainable', max_length=255) - concept_sustainable_help_text = models.TextField('help text', blank=True) - - proposal_liked_label = models.CharField('label', default='Positive aspects', max_length=255) - proposal_liked_help_text = models.TextField('help text', blank=True) - proposal_concerns_label = models.CharField('label', default='Concerns', max_length=255) - proposal_concerns_help_text = models.TextField('help text', blank=True) - proposal_red_flags_label = models.CharField('label', default='Items that must be addressed', max_length=255) - proposal_red_flags_help_text = models.TextField('help text', blank=True) - proposal_overview_label = models.CharField('label', default='Project overview questions and comments', max_length=255) - proposal_overview_help_text = models.TextField('help text', blank=True) - proposal_objectives_label = models.CharField('label', default='Objectives questions and comments', max_length=255) - proposal_objectives_help_text = models.TextField('help text', blank=True) - proposal_strategy_label = models.CharField('label', default='Methods and strategy questions and comments', max_length=255) - proposal_strategy_help_text = models.TextField('help text', blank=True) - proposal_technical_label = models.CharField('label', default='Technical feasibility questions and comments', max_length=255) - proposal_technical_help_text = models.TextField('help text', blank=True) - proposal_alternative_label = models.CharField('label', default='Alternative analysis - "red teaming" questions and comments', max_length=255) - proposal_alternative_help_text = models.TextField('help text', blank=True) - proposal_usability_label = models.CharField('label', default='Usability questions and comments', max_length=255) - proposal_usability_help_text = models.TextField('help text', blank=True) - proposal_sustainability_label = models.CharField('label', default='Sustainability questions and comments', max_length=255) - proposal_sustainability_help_text = models.TextField('help text', blank=True) - proposal_collaboration_label = models.CharField('label', default='Collaboration questions and comments', max_length=255) - proposal_collaboration_help_text = models.TextField('help text', blank=True) - proposal_realism_label = models.CharField('label', default='Cost realism questions and comments', max_length=255) - proposal_realism_help_text = models.TextField('help text', blank=True) - proposal_qualifications_label = models.CharField('label', default='Qualifications questions and comments', max_length=255) - proposal_qualifications_help_text = models.TextField('help text', blank=True) - proposal_evaluation_label = models.CharField('label', default='Evaluation questions and comments', max_length=255) - proposal_evaluation_help_text = models.TextField('help text', blank=True) + verbose_name = "determination form settings" + + concept_principles_label = models.CharField( + "label", default="Goals and principles", max_length=255 + ) + concept_principles_help_text = models.TextField("help text", blank=True) + concept_technical_label = models.CharField( + "label", default="Technical merit", max_length=255 + ) + concept_technical_help_text = models.TextField("help text", blank=True) + concept_sustainable_label = models.CharField( + "label", default="Reasonable, realistic and sustainable", max_length=255 + ) + concept_sustainable_help_text = models.TextField("help text", blank=True) + + proposal_liked_label = models.CharField( + "label", default="Positive aspects", max_length=255 + ) + proposal_liked_help_text = models.TextField("help text", blank=True) + proposal_concerns_label = models.CharField( + "label", default="Concerns", max_length=255 + ) + proposal_concerns_help_text = models.TextField("help text", blank=True) + proposal_red_flags_label = models.CharField( + "label", default="Items that must be addressed", max_length=255 + ) + proposal_red_flags_help_text = models.TextField("help text", blank=True) + proposal_overview_label = models.CharField( + "label", default="Project overview questions and comments", max_length=255 + ) + proposal_overview_help_text = models.TextField("help text", blank=True) + proposal_objectives_label = models.CharField( + "label", default="Objectives questions and comments", max_length=255 + ) + proposal_objectives_help_text = models.TextField("help text", blank=True) + proposal_strategy_label = models.CharField( + "label", default="Methods and strategy questions and comments", max_length=255 + ) + proposal_strategy_help_text = models.TextField("help text", blank=True) + proposal_technical_label = models.CharField( + "label", default="Technical feasibility questions and comments", max_length=255 + ) + proposal_technical_help_text = models.TextField("help text", blank=True) + proposal_alternative_label = models.CharField( + "label", + default='Alternative analysis - "red teaming" questions and comments', + max_length=255, + ) + proposal_alternative_help_text = models.TextField("help text", blank=True) + proposal_usability_label = models.CharField( + "label", default="Usability questions and comments", max_length=255 + ) + proposal_usability_help_text = models.TextField("help text", blank=True) + proposal_sustainability_label = models.CharField( + "label", default="Sustainability questions and comments", max_length=255 + ) + proposal_sustainability_help_text = models.TextField("help text", blank=True) + proposal_collaboration_label = models.CharField( + "label", default="Collaboration questions and comments", max_length=255 + ) + proposal_collaboration_help_text = models.TextField("help text", blank=True) + proposal_realism_label = models.CharField( + "label", default="Cost realism questions and comments", max_length=255 + ) + proposal_realism_help_text = models.TextField("help text", blank=True) + proposal_qualifications_label = models.CharField( + "label", default="Qualifications questions and comments", max_length=255 + ) + proposal_qualifications_help_text = models.TextField("help text", blank=True) + proposal_evaluation_label = models.CharField( + "label", default="Evaluation questions and comments", max_length=255 + ) + proposal_evaluation_help_text = models.TextField("help text", blank=True) concept_help_text_tab_panels = [ - MultiFieldPanel([ - FieldPanel('concept_principles_label'), - FieldPanel('concept_principles_help_text'), - ], 'concept principles'), - MultiFieldPanel([ - FieldPanel('concept_technical_label'), - FieldPanel('concept_technical_help_text'), - ], 'concept technical'), - MultiFieldPanel([ - FieldPanel('concept_sustainable_label'), - FieldPanel('concept_sustainable_help_text'), - ], 'concept sustainable'), + MultiFieldPanel( + [ + FieldPanel("concept_principles_label"), + FieldPanel("concept_principles_help_text"), + ], + "concept principles", + ), + MultiFieldPanel( + [ + FieldPanel("concept_technical_label"), + FieldPanel("concept_technical_help_text"), + ], + "concept technical", + ), + MultiFieldPanel( + [ + FieldPanel("concept_sustainable_label"), + FieldPanel("concept_sustainable_help_text"), + ], + "concept sustainable", + ), ] proposal_help_text_tab_panels = [ - MultiFieldPanel([ - FieldPanel('proposal_liked_label'), - FieldPanel('proposal_liked_help_text'), - ], 'proposal liked'), - MultiFieldPanel([ - FieldPanel('proposal_concerns_label'), - FieldPanel('proposal_concerns_help_text'), - ], 'proposal concerns'), - MultiFieldPanel([ - FieldPanel('proposal_red_flags_label'), - FieldPanel('proposal_red_flags_help_text'), - ], 'proposal red flags'), - MultiFieldPanel([ - FieldPanel('proposal_overview_label'), - FieldPanel('proposal_overview_help_text'), - ], 'proposal overview'), - MultiFieldPanel([ - FieldPanel('proposal_objectives_label'), - FieldPanel('proposal_objectives_help_text'), - ], 'proposal objectives'), - MultiFieldPanel([ - FieldPanel('proposal_strategy_label'), - FieldPanel('proposal_strategy_help_text'), - ], 'proposal strategy'), - MultiFieldPanel([ - FieldPanel('proposal_technical_label'), - FieldPanel('proposal_technical_help_text'), - ], 'proposal technical'), - MultiFieldPanel([ - FieldPanel('proposal_alternative_label'), - FieldPanel('proposal_alternative_help_text'), - ], 'proposal alternative'), - MultiFieldPanel([ - FieldPanel('proposal_usability_label'), - FieldPanel('proposal_usability_help_text'), - ], 'proposal usability'), - MultiFieldPanel([ - FieldPanel('proposal_sustainability_label'), - FieldPanel('proposal_sustainability_help_text'), - ], 'proposal sustainability'), - MultiFieldPanel([ - FieldPanel('proposal_collaboration_label'), - FieldPanel('proposal_collaboration_help_text'), - ], 'proposal collaboration'), - MultiFieldPanel([ - FieldPanel('proposal_realism_label'), - FieldPanel('proposal_realism_help_text'), - ], 'proposal realism'), - MultiFieldPanel([ - FieldPanel('proposal_qualifications_label'), - FieldPanel('proposal_qualifications_help_text'), - ], 'proposal qualifications'), - MultiFieldPanel([ - FieldPanel('proposal_evaluation_label'), - FieldPanel('proposal_evaluation_help_text'), - ], 'proposal evaluation'), + MultiFieldPanel( + [ + FieldPanel("proposal_liked_label"), + FieldPanel("proposal_liked_help_text"), + ], + "proposal liked", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_concerns_label"), + FieldPanel("proposal_concerns_help_text"), + ], + "proposal concerns", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_red_flags_label"), + FieldPanel("proposal_red_flags_help_text"), + ], + "proposal red flags", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_overview_label"), + FieldPanel("proposal_overview_help_text"), + ], + "proposal overview", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_objectives_label"), + FieldPanel("proposal_objectives_help_text"), + ], + "proposal objectives", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_strategy_label"), + FieldPanel("proposal_strategy_help_text"), + ], + "proposal strategy", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_technical_label"), + FieldPanel("proposal_technical_help_text"), + ], + "proposal technical", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_alternative_label"), + FieldPanel("proposal_alternative_help_text"), + ], + "proposal alternative", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_usability_label"), + FieldPanel("proposal_usability_help_text"), + ], + "proposal usability", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_sustainability_label"), + FieldPanel("proposal_sustainability_help_text"), + ], + "proposal sustainability", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_collaboration_label"), + FieldPanel("proposal_collaboration_help_text"), + ], + "proposal collaboration", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_realism_label"), + FieldPanel("proposal_realism_help_text"), + ], + "proposal realism", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_qualifications_label"), + FieldPanel("proposal_qualifications_help_text"), + ], + "proposal qualifications", + ), + MultiFieldPanel( + [ + FieldPanel("proposal_evaluation_label"), + FieldPanel("proposal_evaluation_help_text"), + ], + "proposal evaluation", + ), ] - edit_handler = TabbedInterface([ - ObjectList(concept_help_text_tab_panels, heading=_('Concept form')), - ObjectList(proposal_help_text_tab_panels, heading=_('Proposal form')), - ]) + edit_handler = TabbedInterface( + [ + ObjectList(concept_help_text_tab_panels, heading=_("Concept form")), + ObjectList(proposal_help_text_tab_panels, heading=_("Proposal form")), + ] + ) diff --git a/hypha/apply/determinations/options.py b/hypha/apply/determinations/options.py index 1da2980b18..c70b8eec9b 100644 --- a/hypha/apply/determinations/options.py +++ b/hypha/apply/determinations/options.py @@ -7,15 +7,15 @@ ACCEPTED = 2 DETERMINATION_CHOICES = ( - (REJECTED, _('Dismissed')), - (NEEDS_MORE_INFO, _('More information requested')), - (ACCEPTED, _('Approved')), + (REJECTED, _("Dismissed")), + (NEEDS_MORE_INFO, _("More information requested")), + (ACCEPTED, _("Approved")), ) DETERMINATION_TO_OUTCOME = { - 'rejected': REJECTED, - 'accepted': ACCEPTED, - 'more_info': NEEDS_MORE_INFO, + "rejected": REJECTED, + "accepted": ACCEPTED, + "more_info": NEEDS_MORE_INFO, } TRANSITION_DETERMINATION = { diff --git a/hypha/apply/determinations/templates/determinations/base_determination_form.html b/hypha/apply/determinations/templates/determinations/base_determination_form.html index 9e1430e680..d575ce5492 100644 --- a/hypha/apply/determinations/templates/determinations/base_determination_form.html +++ b/hypha/apply/determinations/templates/determinations/base_determination_form.html @@ -3,54 +3,54 @@ {% block title %}{% if object %}{% trans "Edit a Determination" %} {% if object.is_draft %}{% trans "draft" %}{% endif %}{% else %}{% trans "Create a Determination" %}{% endif %}{% endblock %} {% block content %} -{% block header %} - {% adminbar %} - {% slot header %}{% if object %}{% trans "Update Determination draft" %}{% else %}{% trans "Create Determination" %}{% endif %}{% endslot %} - {% slot sub_heading %}{% trans "For" %} {{ submission.title }}{% endslot %} - {% endadminbar %} -{% endblock %} + {% block header %} + {% adminbar %} + {% slot header %}{% if object %}{% trans "Update Determination draft" %}{% else %}{% trans "Create Determination" %}{% endif %}{% endslot %} + {% slot sub_heading %}{% trans "For" %} {{ submission.title }}{% endslot %} + {% endadminbar %} + {% endblock %} -{% block form %} -
- {% include "forms/includes/form_errors.html" with form=form %} - {% block determination_information %} - {% endblock %} -
- {{ form.media }} - {% csrf_token %} - {% for hidden in form.hidden_fields %} - {{ hidden }} - {% endfor %} - {% for field in form.visible_fields %} + {% block form %} +
+ {% include "forms/includes/form_errors.html" with form=form %} + {% block determination_information %} + {% endblock %} + + {{ form.media }} + {% csrf_token %} + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + {% for field in form.visible_fields %} {# to be replaced with better logic when/if we use stream form #} - {% ifchanged field.field.group %} - {% for key, value in form.titles.items %} - {% if key == field.field.group %} -

{{ value }}

+ {% ifchanged field.field.group %} + {% for key, value in form.titles.items %} + {% if key == field.field.group %} +

{{ value }}

+ {% endif %} + {% endfor %} + {% endifchanged %} + {% if field.field %} + {% include "forms/includes/field.html" %} + {% else %} + {{ field.block }} + {% endif %} + {% endfor %} + {% block form_buttons %} +
+ {% if form.draft_button_name %} + {% endif %} - {% endfor %} - {% endifchanged %} - {% if field.field %} - {% include "forms/includes/field.html" %} - {% else %} - {{ field.block }} - {% endif %} + +
+ {% endblock %} + + {% for type, message in message_templates.items %} + {% endfor %} - {% block form_buttons %} -
- {% if form.draft_button_name %} - - {% endif %} - -
- {% endblock %} - - {% for type, message in message_templates.items %} - - {% endfor %} - {% endblock %} + {% endblock %}
{% endblock %} diff --git a/hypha/apply/determinations/templates/determinations/batch_determination_form.html b/hypha/apply/determinations/templates/determinations/batch_determination_form.html index 3d4be72628..77a17247c3 100644 --- a/hypha/apply/determinations/templates/determinations/batch_determination_form.html +++ b/hypha/apply/determinations/templates/determinations/batch_determination_form.html @@ -2,46 +2,46 @@ {% load i18n static %} {% block extra_css %} -{{ block.super }} - + {{ block.super }} + {% endblock %} {% block header %} -
-
-

{% trans "Add Batch Determination" %} - {{ action_name }}

+
+
+

{% trans "Add Batch Determination" %} - {{ action_name }}

+
-
{% endblock %} {% block determination_information %} -
-
- {% trans "Determining" %} {{ submissions.count }} {% trans "submission" %}{{ submissions.count|pluralize }} {% trans "as" %} "{{ action_name }}" - {% trans "Show" %} +
+
+ {% trans "Determining" %} {{ submissions.count }} {% trans "submission" %}{{ submissions.count|pluralize }} {% trans "as" %} "{{ action_name }}" + {% trans "Show" %} +
+
+ {% for submission in submissions %} + + {{ submission.title }} + + + + + {% endfor %} +
-
- {% for submission in submissions %} - - {{ submission.title }} - - - - - {% endfor %} -
-
{% endblock %} {% block form_buttons %} - -{% include "determinations/includes/batch_determination_confirmation.html" with count=submissions.count %} - + + {% include "determinations/includes/batch_determination_confirmation.html" with count=submissions.count %} + {% endblock %} {% block extra_js %} -{{ block.super }} - - - + {{ block.super }} + + + {% endblock %} diff --git a/hypha/apply/determinations/templates/determinations/includes/batch_determination_confirmation.html b/hypha/apply/determinations/templates/determinations/includes/batch_determination_confirmation.html index 86aa4de894..e1d1b4e493 100644 --- a/hypha/apply/determinations/templates/determinations/includes/batch_determination_confirmation.html +++ b/hypha/apply/determinations/templates/determinations/includes/batch_determination_confirmation.html @@ -1,12 +1,12 @@ {% load i18n %}
diff --git a/hypha/apply/flags/urls.py b/hypha/apply/flags/urls.py index ea85dab48e..dab946dc5e 100644 --- a/hypha/apply/flags/urls.py +++ b/hypha/apply/flags/urls.py @@ -2,8 +2,12 @@ from .views import FlagSubmissionCreateView -app_name = 'flags' +app_name = "flags" urlpatterns = [ - path('//flag/', FlagSubmissionCreateView.as_view(), name="create_submission_flag"), + path( + "//flag/", + FlagSubmissionCreateView.as_view(), + name="create_submission_flag", + ), ] diff --git a/hypha/apply/flags/views.py b/hypha/apply/flags/views.py index e6572c236c..2de2db491a 100644 --- a/hypha/apply/flags/views.py +++ b/hypha/apply/flags/views.py @@ -10,12 +10,12 @@ from .models import Flag -@method_decorator(login_required, name='dispatch') +@method_decorator(login_required, name="dispatch") class FlagSubmissionCreateView(UserPassesTestMixin, View): model = Flag def post(self, request, type, submission_pk): - if request.headers.get('x-requested-with') != 'XMLHttpRequest': + if request.headers.get("x-requested-with") != "XMLHttpRequest": return HttpResponseNotAllowed() # Only staff can create staff flags. @@ -24,7 +24,12 @@ def post(self, request, type, submission_pk): submission_type = ContentType.objects.get_for_model(ApplicationSubmission) # Trying to get a flag from the table, or create a new one - flag, created = self.model.objects.get_or_create(user=request.user, target_object_id=submission_pk, target_content_type=submission_type, type=type) + flag, created = self.model.objects.get_or_create( + user=request.user, + target_object_id=submission_pk, + target_content_type=submission_type, + type=type, + ) # If no new flag has been created, # Then we believe that the request was to delete the flag. if not created: diff --git a/hypha/apply/funds/admin.py b/hypha/apply/funds/admin.py index 929e6fffe8..9c6241c987 100644 --- a/hypha/apply/funds/admin.py +++ b/hypha/apply/funds/admin.py @@ -40,7 +40,7 @@ class BaseRoundAdmin(ModelAdmin): choose_parent_view_class = RoundFundChooserView - choose_parent_template_name = 'funds/admin/parent_chooser.html' + choose_parent_template_name = "funds/admin/parent_chooser.html" button_helper_class = ButtonsWithPreview def fund(self, obj): @@ -49,13 +49,20 @@ def fund(self, obj): class RoundAdmin(BaseRoundAdmin, RelatedFormsMixin): model = Round - menu_icon = 'repeat' - list_display = ('title', 'fund', 'start_date', 'end_date', 'application_forms', 'review_forms') + menu_icon = "repeat" + list_display = ( + "title", + "fund", + "start_date", + "end_date", + "application_forms", + "review_forms", + ) list_filter = (RoundStateListFilter,) url_helper_class = RoundAdminURLHelper def fund(self, obj): - url = self.url_helper.get_action_url('edit', obj.fund.id) + url = self.url_helper.get_action_url("edit", obj.fund.id) url_tag = f'{obj.fund}' return mark_safe(url_tag) @@ -78,51 +85,50 @@ def user_can_delete_obj(self, user, obj): class ScreeningStatusAdmin(ModelAdmin): model = ScreeningStatus - menu_icon = 'tag' - list_display = ('title', 'yes', 'default') + menu_icon = "tag" + list_display = ("title", "yes", "default") permission_helper_class = ScreeningStatusPermissionHelper - list_display = ('title', 'yes', 'default') + list_display = ("title", "yes", "default") class SealedRoundAdmin(BaseRoundAdmin): model = SealedRound - menu_icon = 'lock' - menu_label = 'Sealed Rounds' - list_display = ('title', 'fund', 'start_date', 'end_date') + menu_icon = "lock" + menu_label = "Sealed Rounds" + list_display = ("title", "fund", "start_date", "end_date") class FundAdmin(ModelAdmin, RelatedFormsMixin): model = FundType - menu_icon = 'doc-empty' - menu_label = 'Funds' - list_display = ('title', 'application_forms', 'review_forms', 'determination_forms') + menu_icon = "doc-empty" + menu_label = "Funds" + list_display = ("title", "application_forms", "review_forms", "determination_forms") class RFPAdmin(ModelAdmin): model = RequestForPartners - menu_icon = 'group' - menu_label = 'Request For Partners' + menu_icon = "group" + menu_label = "Request For Partners" class LabAdmin(ModelAdmin, RelatedFormsMixin): model = LabType - menu_icon = 'doc-empty' - menu_label = 'Labs' - list_display = ('title', 'application_forms', 'review_forms', 'determination_forms') + menu_icon = "doc-empty" + menu_label = "Labs" + list_display = ("title", "application_forms", "review_forms", "determination_forms") class ReviewerRoleAdmin(ModelAdmin): model = ReviewerRole - menu_icon = 'group' - menu_label = 'Reviewer Roles' + menu_icon = "group" + menu_label = "Reviewer Roles" class DeletePermission(PermissionHelper, ListRelatedMixin): - related_models = [ - ('applicationbaseform', 'application'), - ('roundbaseform', 'round'), - ('labbaseform', 'lab'), + ("applicationbaseform", "application"), + ("roundbaseform", "round"), + ("labbaseform", "lab"), ] def user_can_delete_obj(self, user, obj): @@ -133,8 +139,8 @@ def user_can_delete_obj(self, user, obj): class ApplicationFormAdmin(ListRelatedMixin, ModelAdmin): model = ApplicationForm - menu_icon = 'form' - list_display = ('name', 'used_by') + menu_icon = "form" + list_display = ("name", "used_by") list_filter = (FormsFundRoundListFilter,) permission_helper_class = DeletePermission button_helper_class = ApplicationFormButtonHelper @@ -142,13 +148,13 @@ class ApplicationFormAdmin(ListRelatedMixin, ModelAdmin): edit_view_class = EditApplicationFormView related_models = [ - ('applicationbaseform', 'application'), - ('roundbaseform', 'round'), - ('labbaseform', 'lab'), + ("applicationbaseform", "application"), + ("roundbaseform", "round"), + ("labbaseform", "lab"), ] def copy_form_view(self, request, instance_pk): - kwargs = {'model_admin': self, 'form_pk': instance_pk} + kwargs = {"model_admin": self, "form_pk": instance_pk} view_class = CopyApplicationFormViewClass return view_class.as_view(**kwargs)(request) @@ -156,11 +162,11 @@ def get_admin_urls_for_registration(self): """Add the url for creating form copy.""" urls = super().get_admin_urls_for_registration() copy_form_url = re_path( - self.url_helper.get_action_url_pattern('copy_form'), + self.url_helper.get_action_url_pattern("copy_form"), self.copy_form_view, - name=self.url_helper.get_action_url_name('copy_form') + name=self.url_helper.get_action_url_name("copy_form"), ) - return urls + (copy_form_url, ) + return urls + (copy_form_url,) class ApplicationSettingAdmin(SettingModelAdmin): @@ -172,8 +178,8 @@ class ReviewerSettingAdmin(SettingModelAdmin): class ApplyAdminGroup(ModelAdminGroup): - menu_label = 'Apply' - menu_icon = 'folder-open-inverse' + menu_label = "Apply" + menu_icon = "folder-open-inverse" items = ( RoundAdmin, SealedRoundAdmin, diff --git a/hypha/apply/funds/admin_forms.py b/hypha/apply/funds/admin_forms.py index cc3a7611e1..72c9ef998d 100644 --- a/hypha/apply/funds/admin_forms.py +++ b/hypha/apply/funds/admin_forms.py @@ -11,18 +11,22 @@ class WorkflowFormAdminForm(WagtailAdminPageForm): def clean(self): cleaned_data = super().clean() - workflow = WORKFLOWS[cleaned_data['workflow_name']] - application_forms = self.formsets['forms'] - review_forms = self.formsets['review_forms'] - external_review_forms = self.formsets['external_review_forms'] - determination_forms = self.formsets['determination_forms'] + workflow = WORKFLOWS[cleaned_data["workflow_name"]] + application_forms = self.formsets["forms"] + review_forms = self.formsets["review_forms"] + external_review_forms = self.formsets["external_review_forms"] + determination_forms = self.formsets["determination_forms"] number_of_stages = len(workflow.stages) self.validate_application_forms(workflow, application_forms) if number_of_stages == 1: self.validate_stages_equal_forms(workflow, application_forms) - self.validate_stages_equal_forms(workflow, review_forms, form_type="Review form") - self.validate_stages_equal_forms(workflow, external_review_forms, form_type="External Review form") + self.validate_stages_equal_forms( + workflow, review_forms, form_type="Review form" + ) + self.validate_stages_equal_forms( + workflow, external_review_forms, form_type="External Review form" + ) self.validate_stages_equal_forms( workflow, determination_forms, form_type="Determination form" ) @@ -35,8 +39,8 @@ def validate_application_forms(self, workflow, forms): Now, staff can select a proposal form from multiple forms list in stage 2. """ if forms.is_valid(): - valid_forms = [form for form in forms if not form.cleaned_data['DELETE']] - forms_stages = [form.cleaned_data['stage'] for form in valid_forms] + valid_forms = [form for form in forms if not form.cleaned_data["DELETE"]] + forms_stages = [form.cleaned_data["stage"] for form in valid_forms] stages_counter = Counter(forms_stages) number_of_stages = len(workflow.stages) @@ -45,10 +49,10 @@ def validate_application_forms(self, workflow, forms): for stage in range(1, number_of_stages + 1): is_form_present = True if stages_counter.get(stage, 0) > 0 else False if not is_form_present: - error_list.append(f'Please provide form for Stage {stage}.') + error_list.append(f"Please provide form for Stage {stage}.") if stage == 1 and stages_counter.get(stage, 0) > 1: - error_list.append('Only 1 form can be selected for 1st Stage.') + error_list.append("Only 1 form can be selected for 1st Stage.") if error_list: self.add_error( @@ -58,20 +62,20 @@ def validate_application_forms(self, workflow, forms): def validate_stages_equal_forms(self, workflow, forms, form_type="form"): if forms.is_valid(): - valid_forms = [form for form in forms if not form.cleaned_data['DELETE']] + valid_forms = [form for form in forms if not form.cleaned_data["DELETE"]] number_of_forms = len(valid_forms) - plural_form = 's' if number_of_forms > 1 else '' + plural_form = "s" if number_of_forms > 1 else "" number_of_stages = len(workflow.stages) - plural_stage = 's' if number_of_stages > 1 else '' + plural_stage = "s" if number_of_stages > 1 else "" # External Review Form is optional and should be single if provided if form_type == "External Review form": if number_of_forms > 1: self.add_error( None, - f'Number of {form_type}s should not be more than one: ' - f'{number_of_forms} {form_type}{plural_form} provided', + f"Number of {form_type}s should not be more than one: " + f"{number_of_forms} {form_type}{plural_form} provided", ) return else: @@ -80,32 +84,34 @@ def validate_stages_equal_forms(self, workflow, forms, form_type="form"): if number_of_forms != number_of_stages: self.add_error( None, - f'Number of {form_type}s does not match number of stages: ' - f'{number_of_stages} stage{plural_stage} and {number_of_forms} ' - f'{form_type}{plural_form} provided', + f"Number of {form_type}s does not match number of stages: " + f"{number_of_stages} stage{plural_stage} and {number_of_forms} " + f"{form_type}{plural_form} provided", ) for form in valid_forms[number_of_stages:]: - form.add_error('form', 'Exceeds required number of forms for stage, please remove.') + form.add_error( + "form", + "Exceeds required number of forms for stage, please remove.", + ) class RoundBasePageAdminForm(WagtailAdminPageForm): def clean(self): cleaned_data = super().clean() - start_date = cleaned_data['start_date'] + start_date = cleaned_data["start_date"] if not start_date: - self.add_error('start_date', 'Please select start date.') + self.add_error("start_date", "Please select start date.") return cleaned_data class ScreeningStatusAdminForm(WagtailAdminModelForm): - def save(self, commit=True): - default = self.cleaned_data['default'] - yes = self.cleaned_data['yes'] - ScreeningStatus = apps.get_model('funds', 'ScreeningStatus') + default = self.cleaned_data["default"] + yes = self.cleaned_data["yes"] + ScreeningStatus = apps.get_model("funds", "ScreeningStatus") if default: try: default_screening = ScreeningStatus.objects.get( @@ -116,7 +122,9 @@ def save(self, commit=True): else: screening = super().save(commit) if default_screening.id != screening.id: - submissions = ApplicationSubmission.objects.filter(screening_statuses__id=default_screening.id) + submissions = ApplicationSubmission.objects.filter( + screening_statuses__id=default_screening.id + ) for submission in submissions: submission.screening_statuses.remove(default_screening) submission.screening_statuses.add(screening) diff --git a/hypha/apply/funds/admin_helpers.py b/hypha/apply/funds/admin_helpers.py index ab12bfdb18..be23858d82 100644 --- a/hypha/apply/funds/admin_helpers.py +++ b/hypha/apply/funds/admin_helpers.py @@ -17,13 +17,14 @@ class VerboseLabelModelChoiceField(forms.ModelChoiceField): def label_from_instance(str, obj): - return '[{}] {}'.format(obj._meta.verbose_name, obj.title) + return "[{}] {}".format(obj._meta.verbose_name, obj.title) class FundChooserForm(ParentChooserForm): - """Changes the default chooser to be fund orientated """ + """Changes the default chooser to be fund orientated""" + parent_page = VerboseLabelModelChoiceField( - label=_('Fund or RFP'), + label=_("Fund or RFP"), required=True, empty_label=None, queryset=Page.objects.none(), @@ -42,15 +43,18 @@ def preview_button(self, obj, classnames_add, classnames_exclude): classnames = self.copy_button_classnames + classnames_add cn = self.finalise_classname(classnames, classnames_exclude) return { - 'url': reverse('wagtailadmin_pages:view_draft', args=(obj.id,)), - 'label': 'Preview', - 'classname': cn, - 'title': 'Preview this %s' % self.verbose_name, + "url": reverse("wagtailadmin_pages:view_draft", args=(obj.id,)), + "label": "Preview", + "classname": cn, + "title": "Preview this %s" % self.verbose_name, } - def get_buttons_for_obj(self, obj, exclude=None, classnames_add=None, - classnames_exclude=None): - btns = super().get_buttons_for_obj(obj, exclude, classnames_add, classnames_exclude) + def get_buttons_for_obj( + self, obj, exclude=None, classnames_add=None, classnames_exclude=None + ): + btns = super().get_buttons_for_obj( + obj, exclude, classnames_add, classnames_exclude + ) # Put preview before delete btns.insert(-1, self.preview_button(obj, classnames_add, classnames_exclude)) @@ -59,39 +63,39 @@ def get_buttons_for_obj(self, obj, exclude=None, classnames_add=None, class FormsFundRoundListFilter(admin.SimpleListFilter): - title = 'usage' - parameter_name = 'form-usage' + title = "usage" + parameter_name = "form-usage" def lookups(self, request, model_admin): return ( - ('applicationbase', _('Funds & RFP')), - ('roundbase', _('Rounds and Sealed Rounds')), - ('labbase', _('Labs')), + ("applicationbase", _("Funds & RFP")), + ("roundbase", _("Rounds and Sealed Rounds")), + ("labbase", _("Labs")), ) def queryset(self, request, queryset): value = self.value() if value: - query = {f'{value}form__isnull': False} + query = {f"{value}form__isnull": False} return queryset.filter(**query).distinct() return queryset class RoundStateListFilter(admin.SimpleListFilter): - title = 'state' - parameter_name = 'form-state' + title = "state" + parameter_name = "form-state" def lookups(self, request, model_admin): return ( - ('open', _('Open')), - ('closed', _('Closed')), + ("open", _("Open")), + ("closed", _("Closed")), ) def queryset(self, request, queryset): value = self.value() - if value == 'open': + if value == "open": return queryset.open() - elif value == 'closed': + elif value == "closed": return queryset.closed() return queryset @@ -106,14 +110,14 @@ def prepare_classnames(self, start=None, add=None, exclude=None): def copy_form_button(self, pk, form_name, **kwargs): classnames = self.prepare_classnames( start=self.edit_button_classnames, - add=kwargs.get('classnames_add'), - exclude=kwargs.get('classnames_exclude') + add=kwargs.get("classnames_add"), + exclude=kwargs.get("classnames_exclude"), ) return { - 'classname': classnames, - 'label': 'Copy', - 'title': f'Copy {form_name}', - 'url': self.url_helper.get_action_url('copy_form', admin.utils.quote(pk)), + "classname": classnames, + "label": "Copy", + "title": f"Copy {form_name}", + "url": self.url_helper.get_action_url("copy_form", admin.utils.quote(pk)), } def get_buttons_for_obj(self, obj, exclude=None, *args, **kwargs): @@ -121,9 +125,7 @@ def get_buttons_for_obj(self, obj, exclude=None, *args, **kwargs): buttons = super().get_buttons_for_obj(obj, *args, **kwargs) copy_form_button = self.copy_form_button( - pk=getattr(obj, self.opts.pk.attname), - form_name=obj.name, - **kwargs + pk=getattr(obj, self.opts.pk.attname), form_name=obj.name, **kwargs ) buttons.append(copy_form_button) @@ -135,5 +137,5 @@ class RoundAdminURLHelper(PageAdminURLHelper): def index_url(self): # By default set open filter and sort on end date # for Round listing page's index URL - params = {'form-state': 'open', 'o': '-3'} + params = {"form-state": "open", "o": "-3"} return f"{self.get_action_url('index')}?{urlencode(params)}" diff --git a/hypha/apply/funds/admin_views.py b/hypha/apply/funds/admin_views.py index cd48115a73..ec7a702083 100644 --- a/hypha/apply/funds/admin_views.py +++ b/hypha/apply/funds/admin_views.py @@ -22,64 +22,77 @@ def custom_admin_round_copy_view(request, page): # Check if the user has permission to publish subpages on the parent can_publish = parent_page.permissions_for_user(request.user).can_publish_subpage() - form = CopyForm(request.POST or None, user=request.user, page=page, can_publish=can_publish) + form = CopyForm( + request.POST or None, user=request.user, page=page, can_publish=can_publish + ) next_url = get_valid_next_url_from_request(request) # Prefill parent_page in case the form is invalid (as prepopulated value for the form field, # because ModelChoiceField seems to not fall back to the user given value) - parent_page = Page.objects.get(id=request.POST['new_parent_page']) + parent_page = Page.objects.get(id=request.POST["new_parent_page"]) if form.is_valid(): # Receive the parent page (this should never be empty) - if form.cleaned_data['new_parent_page']: - parent_page = form.cleaned_data['new_parent_page'] + if form.cleaned_data["new_parent_page"]: + parent_page = form.cleaned_data["new_parent_page"] - if not page.permissions_for_user(request.user).can_copy_to(parent_page, - form.cleaned_data.get('copy_subpages')): + if not page.permissions_for_user(request.user).can_copy_to( + parent_page, form.cleaned_data.get("copy_subpages") + ): raise PermissionDenied # Re-check if the user has permission to publish subpages on the new parent - can_publish = parent_page.permissions_for_user(request.user).can_publish_subpage() + can_publish = parent_page.permissions_for_user( + request.user + ).can_publish_subpage() # Copy the page new_page = page.copy( - recursive=form.cleaned_data.get('copy_subpages'), + recursive=form.cleaned_data.get("copy_subpages"), to=parent_page, update_attrs={ - 'title': form.cleaned_data['new_title'], - 'slug': form.cleaned_data['new_slug'], - 'start_date': None, - 'end_date': None, + "title": form.cleaned_data["new_title"], + "slug": form.cleaned_data["new_slug"], + "start_date": None, + "end_date": None, }, - keep_live=(can_publish and form.cleaned_data.get('publish_copies')), + keep_live=(can_publish and form.cleaned_data.get("publish_copies")), user=request.user, ) - messages.info(request, _(( - "Please select the date in the copied page. " - "Newly copied pages have NONE value for the start and end date" - ))) + messages.info( + request, + _( + ( + "Please select the date in the copied page. " + "Newly copied pages have NONE value for the start and end date" + ) + ), + ) # Give a success message back to the user - if form.cleaned_data.get('copy_subpages'): + if form.cleaned_data.get("copy_subpages"): messages.success( - request, _("Page '{0}' and {1} subpages copied.").format( + request, + _("Page '{0}' and {1} subpages copied.").format( page.get_admin_display_title(), new_page.get_descendants().count() - ) + ), ) else: - messages.success(request, _("Page '{0}' copied.").format(page.get_admin_display_title())) + messages.success( + request, _("Page '{0}' copied.").format(page.get_admin_display_title()) + ) - for fn in hooks.get_hooks('after_copy_page'): + for fn in hooks.get_hooks("after_copy_page"): result = fn(request, page, new_page) - if hasattr(result, 'status_code'): + if hasattr(result, "status_code"): return result # Redirect to explore of parent page if next_url: return redirect(next_url) - return redirect('wagtailadmin_explore', parent_page.id) + return redirect("wagtailadmin_explore", parent_page.id) class CopyApplicationFormViewClass(CreateView): @@ -96,18 +109,19 @@ def __init__(self, model_admin, form_pk): super().__init__(model_admin) def get_initial(self): - return {'name': f'[CHANGE] Copy of {self.form_instance.name}', 'form_fields': self.form_instance.form_fields} + return { + "name": f"[CHANGE] Copy of {self.form_instance.name}", + "form_fields": self.form_instance.form_fields, + } class CreateApplicationFormView(CreateView): - def form_invalid(self, form): show_admin_form_error_messages(self.request, form) return self.render_to_response(self.get_context_data(form=form)) class EditApplicationFormView(EditView): - def form_invalid(self, form): show_admin_form_error_messages(self.request, form) return self.render_to_response(self.get_context_data(form=form)) diff --git a/hypha/apply/funds/apps.py b/hypha/apply/funds/apps.py index c1d9ca8353..19ff626a16 100644 --- a/hypha/apply/funds/apps.py +++ b/hypha/apply/funds/apps.py @@ -2,4 +2,4 @@ class ApplyConfig(AppConfig): - name = 'hypha.apply.funds' + name = "hypha.apply.funds" diff --git a/hypha/apply/funds/blocks.py b/hypha/apply/funds/blocks.py index 7676fe37d0..e40b2e9063 100644 --- a/hypha/apply/funds/blocks.py +++ b/hypha/apply/funds/blocks.py @@ -25,109 +25,113 @@ class ApplicationMustIncludeFieldBlock(MustIncludeFieldBlock): class TitleBlock(ApplicationMustIncludeFieldBlock): - name = 'title' - description = 'The title of the project' - field_label = blocks.CharBlock(label=_('Label'), default=_('What is the title of your application?')) - help_text = blocks.TextBlock(required=False, label=_('Help text'), default=_("This project name can be changed if a full proposal is requested.")) + name = "title" + description = "The title of the project" + field_label = blocks.CharBlock( + label=_("Label"), default=_("What is the title of your application?") + ) + help_text = blocks.TextBlock( + required=False, + label=_("Help text"), + default=_("This project name can be changed if a full proposal is requested."), + ) class Meta: - label = _('Application title') - icon = 'tag' + label = _("Application title") + icon = "tag" class ValueBlock(ApplicationSingleIncludeFieldBlock): - name = 'value' - description = 'The value of the project' - widget = forms.NumberInput(attrs={'min': 0}) + name = "value" + description = "The value of the project" + widget = forms.NumberInput(attrs={"min": 0}) class Meta: - label = _('Requested amount') + label = _("Requested amount") def prepare_data(self, value, data, serialize): return format_number_as_currency(str(data)) + class OrganizationNameBlock(ApplicationSingleIncludeFieldBlock): - name = 'organization_name' - description = 'The name of the organization' + name = "organization_name" + description = "The name of the organization" widget = forms.TextInput() class Meta: - label = _('Organization name') + label = _("Organization name") class EmailBlock(ApplicationMustIncludeFieldBlock): - name = 'email' - description = 'The applicant email address' - field_label = blocks.CharBlock(label=_('Label'), default=_('What email address should we use to contact you?')) - help_text = blocks.TextBlock(required=False, label=_('Help text'), - default=_("We will use this email address to communicate with you about your proposal.")) + name = "email" + description = "The applicant email address" + field_label = blocks.CharBlock( + label=_("Label"), default=_("What email address should we use to contact you?") + ) + help_text = blocks.TextBlock( + required=False, + label=_("Help text"), + default=_( + "We will use this email address to communicate with you about your proposal." + ), + ) widget = forms.EmailInput field_class = forms.EmailField class Meta: - icon = 'mail' + icon = "mail" class AddressFieldBlock(ApplicationSingleIncludeFieldBlock): - name = 'address' - description = 'The postal address of the user' + name = "address" + description = "The postal address of the user" field_class = AddressField class Meta: - label = _('Address') - icon = 'home' + label = _("Address") + icon = "home" def format_data(self, data): # Based on the fields listed in addressfields/widgets.py - return ', '.join( - data[field] - for field in ADDRESS_FIELDS_ORDER - if data[field] - ) + return ", ".join(data[field] for field in ADDRESS_FIELDS_ORDER if data[field]) def prepare_data(self, value, data, serialize): data = json.loads(data) - data = { - field: data[field] - for field in ADDRESS_FIELDS_ORDER - } + data = {field: data[field] for field in ADDRESS_FIELDS_ORDER} if serialize: return data - return ', '.join( - value - for value in data.values() - if value - ) + return ", ".join(value for value in data.values() if value) class FullNameBlock(ApplicationMustIncludeFieldBlock): - name = 'full_name' - description = 'Full name' - field_label = blocks.CharBlock(label=_('Label'), default=_('What is your name?')) - help_text = blocks.TextBlock(required=False, label=_('Help text'), - default=_("We will use this name when we communicate with you about your proposal.")) + name = "full_name" + description = "Full name" + field_label = blocks.CharBlock(label=_("Label"), default=_("What is your name?")) + help_text = blocks.TextBlock( + required=False, + label=_("Help text"), + default=_( + "We will use this name when we communicate with you about your proposal." + ), + ) class Meta: - label = _('Full name') - icon = 'user' + label = _("Full name") + icon = "user" class DurationBlock(ApplicationSingleIncludeFieldBlock): - name = 'duration' - description = 'Duration' - - DAYS = 'days' - WEEKS = 'weeks' - MONTHS = 'months' - DURATION_TYPE_CHOICES = ( - (DAYS, 'Days'), - (WEEKS, 'Weeks'), - (MONTHS, 'Months') - ) + name = "duration" + description = "Duration" + + DAYS = "days" + WEEKS = "weeks" + MONTHS = "months" + DURATION_TYPE_CHOICES = ((DAYS, "Days"), (WEEKS, "Weeks"), (MONTHS, "Months")) DURATION_DAY_OPTIONS = { 1: "1 day", 2: "2 days", @@ -170,42 +174,47 @@ class DurationBlock(ApplicationSingleIncludeFieldBlock): field_class = forms.ChoiceField duration_type = blocks.ChoiceBlock( help_text=( - 'Duration type is used to display duration choices in Days, Weeks or Months in application forms. ' - 'Be careful, changing the duration type in the active round can result in data inconsistency.' + "Duration type is used to display duration choices in Days, Weeks or Months in application forms. " + "Be careful, changing the duration type in the active round can result in data inconsistency." ), - choices=DURATION_TYPE_CHOICES, default=MONTHS, + choices=DURATION_TYPE_CHOICES, + default=MONTHS, ) def get_field_kwargs(self, struct_value, *args, **kwargs): field_kwargs = super().get_field_kwargs(struct_value, *args, **kwargs) - if struct_value['duration_type'] == self.DAYS: - field_kwargs['choices'] = self.DURATION_DAY_OPTIONS.items() - elif struct_value['duration_type'] == self.WEEKS: - field_kwargs['choices'] = self.DURATION_WEEK_OPTIONS.items() + if struct_value["duration_type"] == self.DAYS: + field_kwargs["choices"] = self.DURATION_DAY_OPTIONS.items() + elif struct_value["duration_type"] == self.WEEKS: + field_kwargs["choices"] = self.DURATION_WEEK_OPTIONS.items() else: - field_kwargs['choices'] = self.DURATION_MONTH_OPTIONS.items() + field_kwargs["choices"] = self.DURATION_MONTH_OPTIONS.items() return field_kwargs def prepare_data(self, value, data, serialize): - if value['duration_type'] == self.DAYS: + if value["duration_type"] == self.DAYS: return self.DURATION_DAY_OPTIONS[int(data)] - if value['duration_type'] == self.WEEKS: + if value["duration_type"] == self.WEEKS: return self.DURATION_WEEK_OPTIONS[int(data)] return self.DURATION_MONTH_OPTIONS[int(data)] class Meta: - icon = 'date' + icon = "date" class ApplicationCustomFormFieldsBlock(CustomFormFieldsBlock, FormFieldsBlock): - category = CategoryQuestionBlock(group=_('Custom')) - rich_text = RichTextFieldBlock(group=_('Fields')) + category = CategoryQuestionBlock(group=_("Custom")) + rich_text = RichTextFieldBlock(group=_("Fields")) required_blocks = ApplicationMustIncludeFieldBlock.__subclasses__() single_blocks = ApplicationSingleIncludeFieldBlock.__subclasses__() -REQUIRED_BLOCK_NAMES = [block.name for block in ApplicationMustIncludeFieldBlock.__subclasses__()] +REQUIRED_BLOCK_NAMES = [ + block.name for block in ApplicationMustIncludeFieldBlock.__subclasses__() +] -SINGLE_BLOCK_NAMES = [block.name for block in ApplicationSingleIncludeFieldBlock.__subclasses__()] +SINGLE_BLOCK_NAMES = [ + block.name for block in ApplicationSingleIncludeFieldBlock.__subclasses__() +] NAMED_BLOCKS = REQUIRED_BLOCK_NAMES + SINGLE_BLOCK_NAMES diff --git a/hypha/apply/funds/differ.py b/hypha/apply/funds/differ.py index 1047d95ca2..322fd86895 100644 --- a/hypha/apply/funds/differ.py +++ b/hypha/apply/funds/differ.py @@ -7,22 +7,24 @@ def wrap_with_span(text, class_name): - return format_html('{}', class_name, mark_safe(text)) + return format_html( + '{}', class_name, mark_safe(text) + ) def wrap_deleted(text): - return wrap_with_span(text, 'deleted') + return wrap_with_span(text, "deleted") def wrap_added(text): - return wrap_with_span(text, 'added') + return wrap_with_span(text, "added") def compare(answer_a, answer_b, should_bleach=True): if should_bleach: - cleaner = Cleaner(tags=['h4'], attributes={}, strip=True) - answer_a = re.sub('(]*>)', r'\1● ', answer_a) - answer_b = re.sub('(]*>)', r'\1● ', answer_b) + cleaner = Cleaner(tags=["h4"], attributes={}, strip=True) + answer_a = re.sub("(]*>)", r"\1● ", answer_a) + answer_b = re.sub("(]*>)", r"\1● ", answer_b) answer_a = cleaner.clean(answer_a) answer_b = cleaner.clean(answer_b) @@ -30,25 +32,25 @@ def compare(answer_a, answer_b, should_bleach=True): from_diff = [] to_diff = [] for opcode, a0, a1, b0, b1 in diff.get_opcodes(): - if opcode == 'equal': + if opcode == "equal": from_diff.append(mark_safe(diff.a[a0:a1])) to_diff.append(mark_safe(diff.b[b0:b1])) - elif opcode == 'insert': + elif opcode == "insert": from_diff.append(mark_safe(diff.a[a0:a1])) - to_diff.append(wrap_with_span(diff.b[b0:b1], 'added')) - elif opcode == 'delete': - from_diff.append(wrap_with_span(diff.a[a0:a1], 'deleted')) + to_diff.append(wrap_with_span(diff.b[b0:b1], "added")) + elif opcode == "delete": + from_diff.append(wrap_with_span(diff.a[a0:a1], "deleted")) to_diff.append(mark_safe(diff.b[b0:b1])) - elif opcode == 'replace': - from_diff.append(wrap_with_span(diff.a[a0:a1], 'deleted')) - to_diff.append(wrap_with_span(diff.b[b0:b1], 'added')) - - from_display = ''.join(from_diff) - to_display = ''.join(to_diff) - from_display = re.sub(r'([●○]|[0-9]{1,2}[\)\.])', r'
\1', from_display) - to_display = re.sub(r'([●○]|[0-9]{1,2}[\)\.])', r'
\1', to_display) - from_display = re.sub('(\\.\n)', r'\1

', from_display) - to_display = re.sub('(\\.\n)', r'\1

', to_display) + elif opcode == "replace": + from_diff.append(wrap_with_span(diff.a[a0:a1], "deleted")) + to_diff.append(wrap_with_span(diff.b[b0:b1], "added")) + + from_display = "".join(from_diff) + to_display = "".join(to_diff) + from_display = re.sub(r"([●○]|[0-9]{1,2}[\)\.])", r"
\1", from_display) + to_display = re.sub(r"([●○]|[0-9]{1,2}[\)\.])", r"
\1", to_display) + from_display = re.sub("(\\.\n)", r"\1

", from_display) + to_display = re.sub("(\\.\n)", r"\1

", to_display) from_display = mark_safe(from_display) to_display = mark_safe(to_display) diff --git a/hypha/apply/funds/edit_handlers.py b/hypha/apply/funds/edit_handlers.py index 2439e31538..3b01944d8a 100644 --- a/hypha/apply/funds/edit_handlers.py +++ b/hypha/apply/funds/edit_handlers.py @@ -7,14 +7,14 @@ def reverse_edit(obj): if isinstance(obj, Page): - return reverse('wagtailadmin_pages:edit', args=(obj.id,)) + return reverse("wagtailadmin_pages:edit", args=(obj.id,)) - url_name = f'{obj._meta.app_label}_{obj._meta.model_name}_modeladmin_edit' + url_name = f"{obj._meta.app_label}_{obj._meta.model_name}_modeladmin_edit" return reverse(url_name, args=(obj.id,)) class ReadonlyWidget(Widget): - template_name = 'funds/admin/widgets/read_only.html' + template_name = "funds/admin/widgets/read_only.html" def format_value(self, value): self.value = value @@ -28,7 +28,7 @@ def get_context(self, *args, **kwargs): except AttributeError: pass else: - context['widget']['edit_link'] = edit_link + context["widget"]["edit_link"] = edit_link return context @@ -46,14 +46,15 @@ def clone_kwargs(self): a clone of this panel definition. """ kwargs = super().clone_kwargs() - kwargs.update({ - "attr": self.attr, - }) + kwargs.update( + { + "attr": self.attr, + } + ) return kwargs - class BoundPanel(Panel.BoundPanel): - template_name = 'wagtailadmin/panels/field_panel.html' + template_name = "wagtailadmin/panels/field_panel.html" def render_html(self, parent_context): return render_to_string(self.template_name, self.context()) @@ -72,14 +73,16 @@ def context(self): if self.instance.id: self.form.initial[self.panel.attr] = value else: - self.form.initial[self.panel.attr] = '-' + self.form.initial[self.panel.attr] = "-" - self.bound_field = DisplayField().get_bound_field(self.form, self.panel.attr) + self.bound_field = DisplayField().get_bound_field( + self.form, self.panel.attr + ) return { - 'self': self, - 'field': self.bound_field, - 'show_label': False, + "self": self, + "field": self.bound_field, + "show_label": False, } @@ -93,7 +96,7 @@ def __init__(self, *args, filter_query=None, **kwargs): def clone(self): return self.__class__( field_name=self.field_name, - widget=self.widget if hasattr(self, 'widget') else None, + widget=self.widget if hasattr(self, "widget") else None, heading=self.heading, classname=self.classname, help_text=self.help_text, diff --git a/hypha/apply/funds/files.py b/hypha/apply/funds/files.py index 5df115252e..27b8fcba75 100644 --- a/hypha/apply/funds/files.py +++ b/hypha/apply/funds/files.py @@ -6,7 +6,7 @@ def generate_submission_file_path(submission_id, field_id, file_name): - path = os.path.join('submission', str(submission_id), str(field_id)) + path = os.path.join("submission", str(submission_id), str(field_id)) if file_name.startswith(path): return file_name @@ -14,9 +14,9 @@ def generate_submission_file_path(submission_id, field_id, file_name): class SubmissionStreamFieldFile(StreamFieldFile): - def get_submission_id(self): from hypha.apply.funds.models import ApplicationRevision + submission_id = self.instance.pk if isinstance(self.instance, ApplicationRevision): @@ -24,14 +24,17 @@ def get_submission_id(self): return submission_id def generate_filename(self): - return generate_submission_file_path(self.get_submission_id(), self.field.id, self.name) + return generate_submission_file_path( + self.get_submission_id(), self.field.id, self.name + ) @property def url(self): return reverse( - 'apply:submissions:serve_private_media', kwargs={ - 'pk': self.get_submission_id(), - 'field_id': self.field.id, - 'file_name': self.basename, - } + "apply:submissions:serve_private_media", + kwargs={ + "pk": self.get_submission_id(), + "field_id": self.field.id, + "file_name": self.basename, + }, ) diff --git a/hypha/apply/funds/forms.py b/hypha/apply/funds/forms.py index ed1993a84a..b69fcfdeff 100644 --- a/hypha/apply/funds/forms.py +++ b/hypha/apply/funds/forms.py @@ -41,9 +41,10 @@ def save(self, commit=True): """ if self.errors: raise ValueError( - "The %s could not be %s because the data didn't validate." % ( + "The %s could not be %s because the data didn't validate." + % ( self.instance._meta.object_name, - 'created' if self.instance._state.adding else 'changed', + "created" if self.instance._state.adding else "changed", ) ) if commit: @@ -58,63 +59,65 @@ def save(self, commit=True): class ProgressSubmissionForm(ApplicationSubmissionModelForm): - action = forms.ChoiceField(label=_('Take action')) + action = forms.ChoiceField(label=_("Take action")) class Meta: model = ApplicationSubmission fields: list = [] def __init__(self, *args, **kwargs): - self.user = kwargs.pop('user') + self.user = kwargs.pop("user") super().__init__(*args, **kwargs) choices = list(self.instance.get_actions_for_user(self.user)) # Sort the transitions by the order they are listed. sort_by = list(self.instance.phase.transitions.keys()) choices.sort(key=lambda k: sort_by.index(k[0])) - action_field = self.fields['action'] + action_field = self.fields["action"] action_field.choices = choices self.should_show = bool(choices) class BatchProgressSubmissionForm(forms.Form): - action = forms.ChoiceField(label=_('Take action')) - submissions = forms.CharField(widget=forms.HiddenInput(attrs={'class': 'js-submissions-id'})) + action = forms.ChoiceField(label=_("Take action")) + submissions = forms.CharField( + widget=forms.HiddenInput(attrs={"class": "js-submissions-id"}) + ) def __init__(self, *args, round=None, **kwargs): - self.user = kwargs.pop('user') + self.user = kwargs.pop("user") super().__init__(*args, **kwargs) workflow = round and round.workflow self.action_mapping = get_action_mapping(workflow) - choices = [(action, detail['display']) for action, detail in self.action_mapping.items()] - self.fields['action'].choices = choices + choices = [ + (action, detail["display"]) + for action, detail in self.action_mapping.items() + ] + self.fields["action"].choices = choices def clean_submissions(self): - value = self.cleaned_data['submissions'] - submission_ids = [int(submission) for submission in value.split(',')] + value = self.cleaned_data["submissions"] + submission_ids = [int(submission) for submission in value.split(",")] return ApplicationSubmission.objects.filter(id__in=submission_ids) def clean_action(self): - value = self.cleaned_data['action'] - action = self.action_mapping[value]['transitions'] + value = self.cleaned_data["action"] + action = self.action_mapping[value]["transitions"] return action class ScreeningSubmissionForm(ApplicationSubmissionModelForm): - class Meta: model = ApplicationSubmission - fields = ('screening_statuses',) - labels = { - "screening_statuses": "Screening Decisions" - } + fields = ("screening_statuses",) + labels = {"screening_statuses": "Screening Decisions"} def __init__(self, *args, **kwargs): - self.user = kwargs.pop('user') + self.user = kwargs.pop("user") super().__init__(*args, **kwargs) - instance = kwargs.get('instance') + instance = kwargs.get("instance") if instance and instance.has_default_screening_status_set: screening_status = instance.screening_statuses.get(default=True) - self.fields['screening_statuses'].queryset = ScreeningStatus.objects.filter( + self.fields["screening_statuses"].queryset = ScreeningStatus.objects.filter( yes=screening_status.yes ) self.should_show = False @@ -125,22 +128,25 @@ def clean(self): cleaned_data = super().clean() instance = self.instance default_status = instance.screening_statuses.get(default=True) - if default_status not in cleaned_data['screening_statuses']: - self.add_error('screening_statuses', 'Can\'t remove default screening decision.') + if default_status not in cleaned_data["screening_statuses"]: + self.add_error( + "screening_statuses", "Can't remove default screening decision." + ) return cleaned_data class UpdateSubmissionLeadForm(ApplicationSubmissionModelForm): - class Meta: model = ApplicationSubmission - fields = ('lead',) + fields = ("lead",) def __init__(self, *args, **kwargs): - kwargs.pop('user') + kwargs.pop("user") super().__init__(*args, **kwargs) - lead_field = self.fields['lead'] - lead_field.label = _('Update lead from {lead} to').format(lead=self.instance.lead) + lead_field = self.fields["lead"] + lead_field.label = _("Update lead from {lead} to").format( + lead=self.instance.lead + ) lead_field.queryset = lead_field.queryset.exclude(id=self.instance.lead.id) @@ -149,10 +155,10 @@ class UnarchiveSubmissionForm(ApplicationSubmissionModelForm): class Meta: model = ApplicationSubmission - fields = ('unarchive',) + fields = ("unarchive",) def __init__(self, *args, **kwargs): - kwargs.pop('user') + kwargs.pop("user") super().__init__(*args, **kwargs) def save(self, commit=True): @@ -165,10 +171,10 @@ class ArchiveSubmissionForm(ApplicationSubmissionModelForm): class Meta: model = ApplicationSubmission - fields = ('archive',) + fields = ("archive",) def __init__(self, *args, **kwargs): - kwargs.pop('user') + kwargs.pop("user") super().__init__(*args, **kwargs) def save(self, commit=True): @@ -177,55 +183,63 @@ def save(self, commit=True): class BatchUpdateSubmissionLeadForm(forms.Form): - lead = forms.ChoiceField(label=_('Lead')) - submissions = forms.CharField(widget=forms.HiddenInput(attrs={'class': 'js-submissions-id'})) + lead = forms.ChoiceField(label=_("Lead")) + submissions = forms.CharField( + widget=forms.HiddenInput(attrs={"class": "js-submissions-id"}) + ) def __init__(self, *args, round=None, **kwargs): - self.user = kwargs.pop('user') + self.user = kwargs.pop("user") super().__init__(*args, **kwargs) - self.fields['lead'].choices = [(staff.id, staff) for staff in User.objects.staff()] + self.fields["lead"].choices = [ + (staff.id, staff) for staff in User.objects.staff() + ] def clean_lead(self): - value = self.cleaned_data['lead'] + value = self.cleaned_data["lead"] return User.objects.get(id=value) def clean_submissions(self): - value = self.cleaned_data['submissions'] - submission_ids = [int(submission) for submission in value.split(',')] + value = self.cleaned_data["submissions"] + submission_ids = [int(submission) for submission in value.split(",")] return ApplicationSubmission.objects.filter(id__in=submission_ids) class BatchDeleteSubmissionForm(forms.Form): - submissions = forms.CharField(widget=forms.HiddenInput(attrs={'class': 'js-submissions-id'})) + submissions = forms.CharField( + widget=forms.HiddenInput(attrs={"class": "js-submissions-id"}) + ) def __init__(self, *args, round=None, **kwargs): - self.user = kwargs.pop('user') + self.user = kwargs.pop("user") super().__init__(*args, **kwargs) def clean_submissions(self): - value = self.cleaned_data['submissions'] - submission_ids = [int(submission) for submission in value.split(',')] + value = self.cleaned_data["submissions"] + submission_ids = [int(submission) for submission in value.split(",")] return ApplicationSubmission.objects.filter(id__in=submission_ids) class BatchArchiveSubmissionForm(forms.Form): - submissions = forms.CharField(widget=forms.HiddenInput(attrs={'class': 'js-submissions-id'})) + submissions = forms.CharField( + widget=forms.HiddenInput(attrs={"class": "js-submissions-id"}) + ) def __init__(self, *args, round=None, **kwargs): - self.user = kwargs.pop('user') + self.user = kwargs.pop("user") super().__init__(*args, **kwargs) def clean_submissions(self): - value = self.cleaned_data['submissions'] - submission_ids = [int(submission) for submission in value.split(',')] + value = self.cleaned_data["submissions"] + submission_ids = [int(submission) for submission in value.split(",")] return ApplicationSubmission.objects.filter(id__in=submission_ids) class UpdateReviewersForm(ApplicationSubmissionModelForm): reviewer_reviewers = forms.ModelMultipleChoiceField( - queryset=User.objects.reviewers().only('pk', 'full_name'), - widget=Select2MultiCheckboxesWidget(attrs={'data-placeholder': 'Reviewers'}), - label=_('External Reviewers'), + queryset=User.objects.reviewers().only("pk", "full_name"), + widget=Select2MultiCheckboxesWidget(attrs={"data-placeholder": "Reviewers"}), + label=_("External Reviewers"), required=False, ) @@ -234,10 +248,12 @@ class Meta: fields: list = [] def __init__(self, *args, **kwargs): - self.user = kwargs.pop('user') - if kwargs.get('instance'): + self.user = kwargs.pop("user") + if kwargs.get("instance"): # Providing initials(from model's instance) to BaseModelForm - kwargs['initial'] = model_form_initial(kwargs.get('instance'), self._meta.fields, self._meta.exclude) + kwargs["initial"] = model_form_initial( + kwargs.get("instance"), self._meta.fields, self._meta.exclude + ) super().__init__(*args, **kwargs) # convert a python dict to orderedDict, to use move_to_end method @@ -245,36 +261,34 @@ def __init__(self, *args, **kwargs): assigned_roles = { assigned.role: assigned.reviewer - for assigned in self.instance.assigned.filter( - role__isnull=False - ) + for assigned in self.instance.assigned.filter(role__isnull=False) } self.role_fields = {} field_data = make_role_reviewer_fields() for data in field_data: - field_name = data['field_name'] - self.fields[field_name] = data['field'] - self.role_fields[field_name] = data['role'] - self.fields[field_name].initial = assigned_roles.get(data['role']) + field_name = data["field_name"] + self.fields[field_name] = data["field"] + self.role_fields[field_name] = data["role"] + self.fields[field_name].initial = assigned_roles.get(data["role"]) self.submitted_reviewers = User.objects.filter( - id__in=self.instance.assigned.reviewed().values('reviewer'), + id__in=self.instance.assigned.reviewed().values("reviewer"), ) if can_change_external_reviewers(user=self.user, submission=self.instance): - reviewers = self.instance.reviewers.all().only('pk') + reviewers = self.instance.reviewers.all().only("pk") self.prepare_field( - 'reviewer_reviewers', + "reviewer_reviewers", initial=reviewers, - excluded=self.submitted_reviewers + excluded=self.submitted_reviewers, ) # Move the non-role reviewers field to the end of the field list - self.fields.move_to_end('reviewer_reviewers') + self.fields.move_to_end("reviewer_reviewers") else: - self.fields.pop('reviewer_reviewers') + self.fields.pop("reviewer_reviewers") def prepare_field(self, field_name, initial, excluded): field = self.fields[field_name] @@ -290,14 +304,23 @@ def clean(self): ] for field, role in self.role_fields.items(): - assigned_reviewer = AssignedReviewers.objects.filter(role=role, submission=self.instance).last() - if assigned_reviewer and not cleaned_data[field] and assigned_reviewer.reviewer in self.submitted_reviewers: - self.add_error(field, _("Can't unassign, just change, because review already submitted")) + assigned_reviewer = AssignedReviewers.objects.filter( + role=role, submission=self.instance + ).last() + if ( + assigned_reviewer + and not cleaned_data[field] + and assigned_reviewer.reviewer in self.submitted_reviewers + ): + self.add_error( + field, + _("Can't unassign, just change, because review already submitted"), + ) break # If any of the users match and are set to multiple roles, throw an error if len(role_reviewers) != len(set(role_reviewers)) and any(role_reviewers): - self.add_error(None, _('Users cannot be assigned to multiple roles.')) + self.add_error(None, _("Users cannot be assigned to multiple roles.")) return cleaned_data @@ -320,22 +343,30 @@ def save(self, *args, **kwargs): if reviewer: AssignedReviewers.objects.update_role(role, reviewer, instance) else: - AssignedReviewers.objects.filter(role=role, submission=instance, review__isnull=True).delete() + AssignedReviewers.objects.filter( + role=role, submission=instance, review__isnull=True + ).delete() # 2. Update non-role reviewers # 2a. Remove those not on form if can_change_external_reviewers(submission=self.instance, user=self.user): - reviewers = self.cleaned_data.get('reviewer_reviewers') + reviewers = self.cleaned_data.get("reviewer_reviewers") assigned_reviewers = instance.assigned.without_roles() assigned_reviewers.never_tried_to_review().exclude( reviewer__in=reviewers ).delete() - remaining_reviewers = assigned_reviewers.values_list('reviewer_id', flat=True) + remaining_reviewers = assigned_reviewers.values_list( + "reviewer_id", flat=True + ) # 2b. Add in any new non-role reviewers selected AssignedReviewers.objects.bulk_create_reviewers( - [reviewer for reviewer in reviewers if reviewer.id not in remaining_reviewers], + [ + reviewer + for reviewer in reviewers + if reviewer.id not in remaining_reviewers + ], instance, ) @@ -343,17 +374,19 @@ def save(self, *args, **kwargs): class BatchUpdateReviewersForm(forms.Form): - submissions = forms.CharField(widget=forms.HiddenInput(attrs={'class': 'js-submissions-id'})) + submissions = forms.CharField( + widget=forms.HiddenInput(attrs={"class": "js-submissions-id"}) + ) external_reviewers = forms.ModelMultipleChoiceField( - queryset=User.objects.reviewers().only('pk', 'full_name'), - widget=Select2MultiCheckboxesWidget(attrs={'data-placeholder': 'Select...'}), - label=_('External Reviewers'), + queryset=User.objects.reviewers().only("pk", "full_name"), + widget=Select2MultiCheckboxesWidget(attrs={"data-placeholder": "Select..."}), + label=_("External Reviewers"), required=False, ) def __init__(self, *args, user=None, round=None, **kwargs): super().__init__(*args, **kwargs) - self.request = kwargs.pop('request', None) + self.request = kwargs.pop("request", None) self.user = user self.fields = OrderedDict(self.fields) @@ -361,26 +394,34 @@ def __init__(self, *args, user=None, round=None, **kwargs): field_data = make_role_reviewer_fields() for data in field_data: - field_name = data['field_name'] - self.fields[field_name] = data['field'] - self.role_fields[field_name] = data['role'] + field_name = data["field_name"] + self.fields[field_name] = data["field"] + self.role_fields[field_name] = data["role"] - self.fields.move_to_end('external_reviewers') + self.fields.move_to_end("external_reviewers") def clean_submissions(self): - value = self.cleaned_data['submissions'] - submission_ids = [int(submission) for submission in value.split(',')] + value = self.cleaned_data["submissions"] + submission_ids = [int(submission) for submission in value.split(",")] return ApplicationSubmission.objects.filter(id__in=submission_ids) def clean(self): cleaned_data = super().clean() - external_reviewers = self.cleaned_data['external_reviewers'] - submissions = self.cleaned_data['submissions'] + external_reviewers = self.cleaned_data["external_reviewers"] + submissions = self.cleaned_data["submissions"] if external_reviewers: # User needs to be superuser or lead of all selected submissions. - if not all(can_change_external_reviewers(submission=s, user=self.user) for s in submissions): - self.add_error('external_reviewers', _("Make sure all submissions support external reviewers and you are lead for all the selected submissions.")) + if not all( + can_change_external_reviewers(submission=s, user=self.user) + for s in submissions + ): + self.add_error( + "external_reviewers", + _( + "Make sure all submissions support external reviewers and you are lead for all the selected submissions." + ), + ) role_reviewers = [ user @@ -390,7 +431,7 @@ def clean(self): # If any of the users match and are set to multiple roles, throw an error if len(role_reviewers) != len(set(role_reviewers)) and any(role_reviewers): - self.add_error(None, _('Users cannot be assigned to multiple roles.')) + self.add_error(None, _("Users cannot be assigned to multiple roles.")) return cleaned_data @@ -403,22 +444,27 @@ def submissions_cant_have_external_reviewers(self, submissions): def make_role_reviewer_fields(): role_fields = [] - staff_reviewers = User.objects.staff().only('full_name', 'pk') + staff_reviewers = User.objects.staff().only("full_name", "pk") - for role in ReviewerRole.objects.all().order_by('order'): + for role in ReviewerRole.objects.all().order_by("order"): role_name = bleach.clean(role.name, strip=True) - field_name = f'role_reviewer_{role.id}' + field_name = f"role_reviewer_{role.id}" field = forms.ModelChoiceField( queryset=staff_reviewers, - empty_label=_('---'), + empty_label=_("---"), required=False, - label=mark_safe(render_icon(role.icon) + _('{role_name} Reviewer').format(role_name=role_name)), + label=mark_safe( + render_icon(role.icon) + + _("{role_name} Reviewer").format(role_name=role_name) + ), + ) + role_fields.append( + { + "role": role, + "field": field, + "field_name": field_name, + } ) - role_fields.append({ - 'role': role, - 'field': field, - 'field_name': field_name, - }) return role_fields @@ -426,8 +472,8 @@ def make_role_reviewer_fields(): class UpdatePartnersForm(ApplicationSubmissionModelForm): partner_reviewers = forms.ModelMultipleChoiceField( queryset=User.objects.partners(), - widget=Select2MultiCheckboxesWidget(attrs={'data-placeholder': 'Partners'}), - label=_('Partners'), + widget=Select2MultiCheckboxesWidget(attrs={"data-placeholder": "Partners"}), + label=_("Partners"), required=False, ) @@ -436,21 +482,24 @@ class Meta: fields: list = [] def __init__(self, *args, **kwargs): - kwargs.pop('user') + kwargs.pop("user") super().__init__(*args, **kwargs) partners = self.instance.partners.all() - self.submitted_partners = User.objects.partners().filter(id__in=self.instance.reviews.values('author')) + self.submitted_partners = User.objects.partners().filter( + id__in=self.instance.reviews.values("author") + ) - partner_field = self.fields['partner_reviewers'] - partner_field.queryset = partner_field.queryset.exclude(id__in=self.submitted_partners) + partner_field = self.fields["partner_reviewers"] + partner_field.queryset = partner_field.queryset.exclude( + id__in=self.submitted_partners + ) partner_field.initial = partners def save(self, *args, **kwargs): instance = super().save(*args, **kwargs) instance.partners.set( - self.cleaned_data['partner_reviewers'] | - self.submitted_partners + self.cleaned_data["partner_reviewers"] | self.submitted_partners ) return instance @@ -476,22 +525,27 @@ def __init__(self, *args, choices_groupby, **kwargs): if isinstance(choices_groupby, str): choices_groupby = methodcaller(choices_groupby) elif not callable(choices_groupby): - raise TypeError('choices_groupby must either be a str or a callable accepting a single argument') + raise TypeError( + "choices_groupby must either be a str or a callable accepting a single argument" + ) self.iterator = partial(GroupedModelChoiceIterator, groupby=choices_groupby) super().__init__(*args, **kwargs) def label_from_instance(self, obj): - return {'label': super().label_from_instance(obj), 'disabled': not obj.is_leaf()} + return { + "label": super().label_from_instance(obj), + "disabled": not obj.is_leaf(), + } class UpdateMetaTermsForm(ApplicationSubmissionModelForm): meta_terms = GroupedModelMultipleChoiceField( queryset=None, # updated in init method - widget=MetaTermSelect2Widget(attrs={'data-placeholder': 'Meta terms'}), - label=_('Meta terms'), - choices_groupby='get_parent', + widget=MetaTermSelect2Widget(attrs={"data-placeholder": "Meta terms"}), + label=_("Meta terms"), + choices_groupby="get_parent", required=False, - help_text=_('Meta terms are hierarchical in nature.'), + help_text=_("Meta terms are hierarchical in nature."), ) class Meta: @@ -499,9 +553,11 @@ class Meta: fields: list = [] def __init__(self, *args, **kwargs): - kwargs.pop('user') + kwargs.pop("user") super().__init__(*args, **kwargs) - self.fields['meta_terms'].queryset = MetaTerm.get_root_descendants().exclude(depth=2) + self.fields["meta_terms"].queryset = MetaTerm.get_root_descendants().exclude( + depth=2 + ) class CreateReminderForm(forms.ModelForm): @@ -516,16 +572,17 @@ def __init__(self, instance=None, user=None, *args, **kwargs): self.user = user if instance: - self.fields['submission'].initial = instance.id + self.fields["submission"].initial = instance.id def save(self, *args, **kwargs): return Reminder.objects.create( - title=self.cleaned_data['title'], - description=self.cleaned_data['description'], - time=self.cleaned_data['time'], - submission=self.cleaned_data['submission'], - user=self.user) + title=self.cleaned_data["title"], + description=self.cleaned_data["description"], + time=self.cleaned_data["time"], + submission=self.cleaned_data["submission"], + user=self.user, + ) class Meta: model = Reminder - fields = ['title', 'description', 'time', 'action'] + fields = ["title", "description", "time", "action"] diff --git a/hypha/apply/funds/management/commands/export_submissions_csv.py b/hypha/apply/funds/management/commands/export_submissions_csv.py index 999f380d39..af107417a1 100644 --- a/hypha/apply/funds/management/commands/export_submissions_csv.py +++ b/hypha/apply/funds/management/commands/export_submissions_csv.py @@ -9,30 +9,48 @@ class Command(BaseCommand): help = "Export submission stats to a csv file." def handle(self, *args, **options): - with open('export_submissions.csv', 'w', newline='') as csvfile: + with open("export_submissions.csv", "w", newline="") as csvfile: writer = csv.writer(csvfile, quoting=csv.QUOTE_ALL) - writer.writerow(['Submission ID', 'Submission title', 'Submission author', 'Submission e-mail', 'Submission value', 'Submission duration', 'Submission reapplied', 'Submission stage', 'Submission phase', 'Submission screening', 'Submission date', 'Submission region', 'Submission country', 'Submission focus', 'Round/Lab/Fellowship']) + writer.writerow( + [ + "Submission ID", + "Submission title", + "Submission author", + "Submission e-mail", + "Submission value", + "Submission duration", + "Submission reapplied", + "Submission stage", + "Submission phase", + "Submission screening", + "Submission date", + "Submission region", + "Submission country", + "Submission focus", + "Round/Lab/Fellowship", + ] + ) for submission in ApplicationSubmission.objects.exclude_draft(): - submission_region = '' - submission_country = '' - submission_focus = '' - submission_reapplied = '' + submission_region = "" + submission_country = "" + submission_focus = "" + submission_reapplied = "" for field_id in submission.question_text_field_ids: if field_id not in submission.named_blocks: question_field = submission.serialize(field_id) - name = question_field['question'] - if isinstance(question_field['answer'], str): - answer = question_field['answer'] + name = question_field["question"] + if isinstance(question_field["answer"], str): + answer = question_field["answer"] else: - answer = ','.join(question_field['answer']) - if answer and not answer == 'N': - if name == 'Region': + answer = ",".join(question_field["answer"]) + if answer and not answer == "N": + if name == "Region": submission_region = answer - elif name == 'Country': + elif name == "Country": submission_country = answer - elif name == 'Focus': + elif name == "Focus": submission_focus = answer - elif 'or received funding' in name: + elif "or received funding" in name: submission_reapplied = answer if submission.round: @@ -44,4 +62,22 @@ def handle(self, *args, **options): submission_value = submission.value except KeyError: submission_value = 0 - writer.writerow([submission.id, submission.title, submission.full_name, submission.email, submission_value, submission.duration, submission_reapplied, submission.stage, submission.phase, submission.joined_screening_statuses, submission.submit_time.strftime('%Y-%m-%d'), submission_region, submission_country, submission_focus, submission_type]) + writer.writerow( + [ + submission.id, + submission.title, + submission.full_name, + submission.email, + submission_value, + submission.duration, + submission_reapplied, + submission.stage, + submission.phase, + submission.joined_screening_statuses, + submission.submit_time.strftime("%Y-%m-%d"), + submission_region, + submission_country, + submission_focus, + submission_type, + ] + ) diff --git a/hypha/apply/funds/management/commands/migrate_community_lab_applications.py b/hypha/apply/funds/management/commands/migrate_community_lab_applications.py index b887ae8fb3..9f21e8b4df 100644 --- a/hypha/apply/funds/management/commands/migrate_community_lab_applications.py +++ b/hypha/apply/funds/management/commands/migrate_community_lab_applications.py @@ -126,5 +126,4 @@ class Command(MigrateCommand): "id": "a1f03bca-9267-49cf-9880-444d6806065c", "type": "boolean", }, - } diff --git a/hypha/apply/funds/management/commands/migrate_fellowship_proposals.py b/hypha/apply/funds/management/commands/migrate_fellowship_proposals.py index c849494ca9..6fc8a26869 100644 --- a/hypha/apply/funds/management/commands/migrate_fellowship_proposals.py +++ b/hypha/apply/funds/management/commands/migrate_fellowship_proposals.py @@ -17,13 +17,11 @@ class Command(MigrateCommand): "type": "value", "key": "safe_value", }, - "field_proposal_host_text": { "id": "bc03235e-3c78-4770-9fc2-97feb93c2c8c", "type": "value", "key": "safe_value", }, - "field_proposal_start_date": { "id": "672cb6f1-335c-4005-a0f1-46c414feda06", "type": "value", diff --git a/hypha/apply/funds/management/commands/migrate_proposals.py b/hypha/apply/funds/management/commands/migrate_proposals.py index b90a90185a..40844eddeb 100644 --- a/hypha/apply/funds/management/commands/migrate_proposals.py +++ b/hypha/apply/funds/management/commands/migrate_proposals.py @@ -55,7 +55,7 @@ class Command(MigrateCommand): "postal_code": "postalcode", "thoroughfare": "thoroughfare", "premise": "premise", - } + }, }, "field_proposal_summary": { "id": "a7502e97-5f2e-417f-b08c-588d367e40e5", diff --git a/hypha/apply/funds/management/commands/migrate_rr_applications.py b/hypha/apply/funds/management/commands/migrate_rr_applications.py index cc43c194b7..d05a3754de 100644 --- a/hypha/apply/funds/management/commands/migrate_rr_applications.py +++ b/hypha/apply/funds/management/commands/migrate_rr_applications.py @@ -159,7 +159,7 @@ class Command(MigrateCommand): "postal_code": "postalcode", "thoroughfare": "thoroughfare", "premise": "premise", - } + }, }, "field_application_questions": { "id": "1889de86-0a0d-4abf-9916-4db87a499d35", diff --git a/hypha/apply/funds/management/commands/migration_base.py b/hypha/apply/funds/management/commands/migration_base.py index b1f0248260..7f9091bf3d 100644 --- a/hypha/apply/funds/management/commands/migration_base.py +++ b/hypha/apply/funds/management/commands/migration_base.py @@ -20,22 +20,22 @@ class MigrationStorage(S3Boto3Storage): - if hasattr(settings, 'AWS_MIGRATION_BUCKET_NAME'): + if hasattr(settings, "AWS_MIGRATION_BUCKET_NAME"): bucket_name = settings.AWS_MIGRATION_BUCKET_NAME - if hasattr(settings, 'AWS_MIGRATION_ACCESS_KEY_ID'): + if hasattr(settings, "AWS_MIGRATION_ACCESS_KEY_ID"): access_key = settings.AWS_MIGRATION_ACCESS_KEY_ID - if hasattr(settings, 'AWS_MIGRATION_SECRET_ACCESS_KEY'): + if hasattr(settings, "AWS_MIGRATION_SECRET_ACCESS_KEY"): secret_key = settings.AWS_MIGRATION_SECRET_ACCESS_KEY - bucket_acl = 'private' + bucket_acl = "private" custom_domain = False - default_acl = 'private' + default_acl = "private" encryption = True file_overwrite = False querystring_auth = True - url_protocol = 'https:' + url_protocol = "https:" migration_storage = MigrationStorage() @@ -51,17 +51,21 @@ class MigrateCommand(BaseCommand): ApplicationSubmission.status = patched_status_field def add_arguments(self, parser): - parser.add_argument('source', type=argparse.FileType('r'), help='Migration source JSON file') + parser.add_argument( + "source", type=argparse.FileType("r"), help="Migration source JSON file" + ) @transaction.atomic def handle(self, *args, **options): # Prepare the list of categories. for item in CATEGORIES: - category, _ = Category.objects.get_or_create(name=item['category']) - option, _ = Option.objects.get_or_create(value=item['name'], category=category) - self.terms[item['tid']] = option + category, _ = Category.objects.get_or_create(name=item["category"]) + option, _ = Option.objects.get_or_create( + value=item["name"], category=category + ) + self.terms[item["tid"]] = option - with options['source'] as json_data: + with options["source"] as json_data: self.data = json.load(json_data) counter = 0 @@ -75,9 +79,9 @@ def process(self, id): node = self.data[id] try: - submission = ApplicationSubmission.objects.get(drupal_id=node['nid']) + submission = ApplicationSubmission.objects.get(drupal_id=node["nid"]) except ApplicationSubmission.DoesNotExist: - submission = ApplicationSubmission(drupal_id=node['nid']) + submission = ApplicationSubmission(drupal_id=node["nid"]) # Disable auto_* on date fields so imported dates are used. for field in submission._meta.local_fields: @@ -85,8 +89,10 @@ def process(self, id): field.auto_now_add = False # TODO timezone? - submission.submit_time = datetime.fromtimestamp(int(node['created']), timezone.utc) - submission.user = self.get_user(node['uid']) + submission.submit_time = datetime.fromtimestamp( + int(node["created"]), timezone.utc + ) + submission.user = self.get_user(node["uid"]) if self.CONTENT_TYPE == "fund": FUND = FundType.objects.get(title=self.FUND_NAME) @@ -108,21 +114,25 @@ def process(self, id): submission.status = self.get_workflow_state(node) - if 'proposal_nid' in node: + if "proposal_nid" in node: try: - submission.next = ApplicationSubmission.objects.get(drupal_id=node['proposal_nid']) + submission.next = ApplicationSubmission.objects.get( + drupal_id=node["proposal_nid"] + ) except ApplicationSubmission.DoesNotExist: - self.stdout.write("No related proposal found, please import proposals before applications.") + self.stdout.write( + "No related proposal found, please import proposals before applications." + ) pass form_data = { - 'skip_account_creation_notification': True, + "skip_account_creation_notification": True, } for field in node: if field in self.STREAMFIELD_MAP: try: - id = self.STREAMFIELD_MAP[field]['id'] + id = self.STREAMFIELD_MAP[field]["id"] form_data[id] = self.get_field_value(field, node) except TypeError: pass @@ -134,7 +144,7 @@ def process(self, id): form_data["duration"] = "1" if "email" not in form_data or not form_data["email"]: - if hasattr(submission.user, 'email'): + if hasattr(submission.user, "email"): form_data["email"] = submission.user.email else: form_data["email"] = f"user+{node['uid']}@example.com" @@ -145,7 +155,9 @@ def process(self, id): submission.save() self.stdout.write(f"Processed \"{node['title']}\" ({node['nid']})") except IntegrityError: - self.stdout.write(f"*** Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError") + self.stdout.write( + f"*** Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError" + ) def get_user(self, uid): try: @@ -164,41 +176,43 @@ def get_field_value(self, field, node): field: [{value|target_id|tid: VALUE},] """ mapping = self.STREAMFIELD_MAP[field] - mapping_type = mapping['type'] - key = mapping.get('key', 'value') + mapping_type = mapping["type"] + key = mapping.get("key", "value") source_value = node[field] value = None if mapping_type == "direct": value = source_value - elif mapping_type == 'value': + elif mapping_type == "value": if key in source_value: - value = self.nl2br(source_value[key]) if source_value else '' + value = self.nl2br(source_value[key]) if source_value else "" else: - value = self.nl2br(source_value['value']) if source_value else '' - elif mapping_type == 'merge_value': + value = self.nl2br(source_value["value"]) if source_value else "" + elif mapping_type == "merge_value": values = [] i = 0 for item in source_value: - question = self.REQUEST_QUESTION_MAP[node['field_application_request']['target_id']] + question = self.REQUEST_QUESTION_MAP[ + node["field_application_request"]["target_id"] + ] values.append(f"{question[i]}{item[key]}
\n") i += 1 - merged_values = ''.join(values) - value = self.nl2br(merged_values) if source_value else '' - elif mapping_type == 'map' and 'map' in 'mapping': - value = mapping['map'].get(source_value[key]) - elif mapping_type == 'address' and 'map' in mapping: + merged_values = "".join(values) + value = self.nl2br(merged_values) if source_value else "" + elif mapping_type == "map" and "map" in "mapping": + value = mapping["map"].get(source_value[key]) + elif mapping_type == "address" and "map" in mapping: try: - value_map = mapping['map'] + value_map = mapping["map"] value = {} for item in value_map: value[value_map[item]] = source_value[item] value = json.dumps(value) except TypeError: value = {} - elif mapping_type == 'boolean': - value = source_value[key] == '1' if source_value else False - elif mapping_type == 'category': + elif mapping_type == "boolean": + value = source_value[key] == "1" if source_value else False + elif mapping_type == "category": if not source_value: value = [] else: @@ -211,7 +225,7 @@ def get_field_value(self, field, node): option = self.get_referenced_term(item[key]) if option: value.append(option) - elif mapping_type == 'file': + elif mapping_type == "file": value = self.process_file(source_value) return value @@ -241,7 +255,7 @@ def get_workflow_state(self, node): "invited_for_proposal": "accepted", "dropped_concept_note": "rejected", "dropped": "rejected", - "dropped_without_review": "rejected" + "dropped_without_review": "rejected", } states_concept = { @@ -255,7 +269,7 @@ def get_workflow_state(self, node): "invited_for_proposal": "invited_to_proposal", "dropped_concept_note": "concept_rejected", "dropped": "concept_rejected", - "dropped_without_review": "concept_rejected" + "dropped_without_review": "concept_rejected", } states_proposal = { @@ -269,22 +283,28 @@ def get_workflow_state(self, node): "invited_for_proposal": "proposal_accepted", "dropped_concept_note": "proposal_rejected", "dropped": "proposal_rejected", - "dropped_without_review": "proposal_rejected" + "dropped_without_review": "proposal_rejected", } if self.APPLICATION_TYPE == "request": - workflow_state = states_request.get(node['workbench_moderation']['current']['state'], "in_discussion") + workflow_state = states_request.get( + node["workbench_moderation"]["current"]["state"], "in_discussion" + ) elif self.APPLICATION_TYPE == "concept": - workflow_state = states_concept.get(node['workbench_moderation']['current']['state'], "in_discussion") + workflow_state = states_concept.get( + node["workbench_moderation"]["current"]["state"], "in_discussion" + ) elif self.APPLICATION_TYPE == "proposal": - workflow_state = states_proposal.get(node['workbench_moderation']['current']['state'], "draft_proposal") + workflow_state = states_proposal.get( + node["workbench_moderation"]["current"]["state"], "draft_proposal" + ) else: workflow_state = None return workflow_state def nl2br(self, value): - return value.replace('\r\n', '
\n') + return value.replace("\r\n", "
\n") def process_file(self, value): if isinstance(value, dict): @@ -293,10 +313,12 @@ def process_file(self, value): files = [] for file_data in value: - parts = urlsplit(file_data['uri']) - file_path = os.path.join('files', 'private', parts.netloc, *parts.path.split('/')) + parts = urlsplit(file_data["uri"]) + file_path = os.path.join( + "files", "private", parts.netloc, *parts.path.split("/") + ) saved_file = migration_storage.open(file_path) - saved_file.name = file_data['filename'] + saved_file.name = file_data["filename"] files.append(saved_file) return files diff --git a/hypha/apply/funds/management/commands/seed_community_lab_application.py b/hypha/apply/funds/management/commands/seed_community_lab_application.py index 116e3f9532..1bda87d07b 100644 --- a/hypha/apply/funds/management/commands/seed_community_lab_application.py +++ b/hypha/apply/funds/management/commands/seed_community_lab_application.py @@ -10,7 +10,7 @@ from hypha.apply.review.models import ReviewForm from hypha.apply.users.groups import STAFF_GROUP_NAME -CL_FUND_TITLE = 'Community lab (archive fund)' +CL_FUND_TITLE = "Community lab (archive fund)" class Command(BaseCommand): @@ -23,65 +23,399 @@ def handle(self, *args, **options): self.create_community_lab_fund_type(application_form, application_review_form) def create_community_lab_form(self): - data = [ - {"type": "text_markup", "value": "

Basic information

", "id": "353df1fa-a054-406f-855f-842a52ad2852"}, - {"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"}, - {"type": "text_markup", "value": "

More information about your product

", "id": "17bc7cbe-49d7-42cf-8f60-1bbb0c841a1a"}, - {"type": "rich_text", "value": {"field_label": "Please provide us a description of this event", "help_text": "", "required": "", "default_value": ""}, "id": "aeea7bd9-01b5-406e-bb30-1303ba0f550a"}, - {"type": "rich_text", "value": {"field_label": "Please describe the target audience(s)", "help_text": "", "required": "", "default_value": ""}, "id": "a5117396-0286-4937-91a3-be33a5944ac6"}, - {"type": "rich_text", "value": {"field_label": "What are the event’s objectives?", "help_text": "", "required": "", "default_value": ""}, "id": "d90d2cd4-831e-46f5-8f2e-82ac94913784"}, - {"type": "rich_text", "value": {"field_label": "Please describe the strategy that will allow you to achieve your goals", "help_text": "", "required": "", "default_value": ""}, "id": "fc5ddac7-c7b5-4d07-9bc3-16902e9a7afb"}, - {"type": "rich_text", "value": {"field_label": "How will this event support people living within a developing country affected by repressive censorship and/or surveillance?", "help_text": "", "required": "", "default_value": ""}, "id": "ea6ceb76-882e-4739-94da-7b055a112d1c"}, - {"type": "rich_text", "value": {"field_label": "What collaborations with other organizations, communities, or networks exist around this event, if any?", "help_text": "", "required": "", "default_value": ""}, "id": "afa7e16b-d31c-4016-af88-7939acc7b6e1"}, - {"type": "rich_text", "value": {"field_label": "How will the event ensure new and diverse voices are being represented?", "help_text": "", "required": "", "default_value": ""}, "id": "55e23c45-72a7-4ab9-9940-764d00724de8"}, - {"type": "rich_text", "value": {"field_label": "Please describe the outreach and promotion plan for the event?", "help_text": "", "required": "", "default_value": ""}, "id": "737bd894-78b1-41ef-969c-2a57c843cd5b"}, - {"type": "rich_text", "value": {"field_label": "Is there anything you need help with in regards to planning this event that is non-monetary related?", "help_text": "For example, are there any audiences you are trying to cultivate? Do you need advice on the format of the event?", "required": "", "default_value": ""}, "id": "56c84f40-f59e-4e82-80a1-2cd971717e9c"}, - {"type": "rich_text", "value": {"field_label": "Please provide a detailed budget", "help_text": "", "required": "", "default_value": ""}, "id": "6ca29ae0-780a-467a-a3e9-34195bcb0d79"}, - {"type": "checkbox", "value": {"field_label": "Do you have a code of conduct?", "help_text": "If yes, upload it in the field below.", "required": "true", "default_value": "false"}, "id": "9db8b2ca-62b6-44c4-9d3d-70cb4a28e65f"}, - {"type": "multi_file", "value": {"field_label": "Upload", "help_text": "", "required": ""}, "id": "b3af7aac-3439-45fa-9573-518f82f5cd6c"}, - {"type": "text_markup", "value": "

I acknowledge

", "id": "b4bbe32a-058d-44b0-aaea-bddc70674277"}, - {"type": "checkbox", "value": {"field_label": "My application will be dismissed if it does not fit within OTF\'s mission, values, principles statements.", "help_text": "", "default_value": ""}, "id": "1248f597-2f18-4b16-8f96-63912e5197c5"}, - {"type": "text_markup", "value": "Read our mission, values, and principles.", "id": "67b65f65-5d9f-4152-9c0b-d980d9944e3d"}, - {"type": "checkbox", "value": {"field_label": "I have read and understand OTF\'s Terms and Privacy policy.", "help_text": "", "default_value": ""}, "id": "5a676552-e189-417e-9901-05bfc973cfb5"}, - {"type": "text_markup", "value": "Read the Terms and Privacy policy.", "id": "f340a29d-56e3-4a01-be37-fc405cbafa8e"}, - {"type": "checkbox", "value": {"field_label": "I am legally able to sign contracts or represent an organization that can.", "help_text": "", "default_value": ""}, "id": "c4f54c3d-6b2a-4b32-b651-9121430aa06f"}, - {"type": "checkbox", "value": {"field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", "help_text": "", "default_value": ""}, "id": "beb4d454-466d-43d5-823e-80dbccacbbb3"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", "help_text": "", "default_value": ""}, "id": "fd6b034d-7cec-49fe-b4da-991c382283ef"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", "help_text": "", "default_value": ""}, "id": "d930a864-263d-4d0d-8ff1-553b13efda41"}, - {"type": "text_markup", "value": "

I would like to

", "id": "2b572f43-c912-4a94-93ae-cd6b64c2b95b"}, - {"type": "checkbox", "value": {"field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc).", "help_text": "", "default_value": ""}, "id": "f75fd335-be7d-460d-b96a-53d7aa9a826f"}, - {"type": "checkbox", "value": {"field_label": "Sign up for OTF\'s daily newsletter (collection of news related to global internet freedom).", "help_text": "", "default_value": ""}, "id": "a1f03bca-9267-49cf-9880-444d6806065c"} + { + "type": "text_markup", + "value": "

Basic information

", + "id": "353df1fa-a054-406f-855f-842a52ad2852", + }, + { + "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", + }, + { + "type": "text_markup", + "value": "

More information about your product

", + "id": "17bc7cbe-49d7-42cf-8f60-1bbb0c841a1a", + }, + { + "type": "rich_text", + "value": { + "field_label": "Please provide us a description of this event", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "aeea7bd9-01b5-406e-bb30-1303ba0f550a", + }, + { + "type": "rich_text", + "value": { + "field_label": "Please describe the target audience(s)", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "a5117396-0286-4937-91a3-be33a5944ac6", + }, + { + "type": "rich_text", + "value": { + "field_label": "What are the event’s objectives?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "d90d2cd4-831e-46f5-8f2e-82ac94913784", + }, + { + "type": "rich_text", + "value": { + "field_label": "Please describe the strategy that will allow you to achieve your goals", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "fc5ddac7-c7b5-4d07-9bc3-16902e9a7afb", + }, + { + "type": "rich_text", + "value": { + "field_label": "How will this event support people living within a developing country affected by repressive censorship and/or surveillance?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "ea6ceb76-882e-4739-94da-7b055a112d1c", + }, + { + "type": "rich_text", + "value": { + "field_label": "What collaborations with other organizations, communities, or networks exist around this event, if any?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "afa7e16b-d31c-4016-af88-7939acc7b6e1", + }, + { + "type": "rich_text", + "value": { + "field_label": "How will the event ensure new and diverse voices are being represented?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "55e23c45-72a7-4ab9-9940-764d00724de8", + }, + { + "type": "rich_text", + "value": { + "field_label": "Please describe the outreach and promotion plan for the event?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "737bd894-78b1-41ef-969c-2a57c843cd5b", + }, + { + "type": "rich_text", + "value": { + "field_label": "Is there anything you need help with in regards to planning this event that is non-monetary related?", + "help_text": "For example, are there any audiences you are trying to cultivate? Do you need advice on the format of the event?", + "required": "", + "default_value": "", + }, + "id": "56c84f40-f59e-4e82-80a1-2cd971717e9c", + }, + { + "type": "rich_text", + "value": { + "field_label": "Please provide a detailed budget", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "6ca29ae0-780a-467a-a3e9-34195bcb0d79", + }, + { + "type": "checkbox", + "value": { + "field_label": "Do you have a code of conduct?", + "help_text": "If yes, upload it in the field below.", + "required": "true", + "default_value": "false", + }, + "id": "9db8b2ca-62b6-44c4-9d3d-70cb4a28e65f", + }, + { + "type": "multi_file", + "value": {"field_label": "Upload", "help_text": "", "required": ""}, + "id": "b3af7aac-3439-45fa-9573-518f82f5cd6c", + }, + { + "type": "text_markup", + "value": "

I acknowledge

", + "id": "b4bbe32a-058d-44b0-aaea-bddc70674277", + }, + { + "type": "checkbox", + "value": { + "field_label": "My application will be dismissed if it does not fit within OTF's mission, values, principles statements.", + "help_text": "", + "default_value": "", + }, + "id": "1248f597-2f18-4b16-8f96-63912e5197c5", + }, + { + "type": "text_markup", + "value": 'Read our mission, values, and principles.', + "id": "67b65f65-5d9f-4152-9c0b-d980d9944e3d", + }, + { + "type": "checkbox", + "value": { + "field_label": "I have read and understand OTF's Terms and Privacy policy.", + "help_text": "", + "default_value": "", + }, + "id": "5a676552-e189-417e-9901-05bfc973cfb5", + }, + { + "type": "text_markup", + "value": 'Read the Terms and Privacy policy.', + "id": "f340a29d-56e3-4a01-be37-fc405cbafa8e", + }, + { + "type": "checkbox", + "value": { + "field_label": "I am legally able to sign contracts or represent an organization that can.", + "help_text": "", + "default_value": "", + }, + "id": "c4f54c3d-6b2a-4b32-b651-9121430aa06f", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", + "help_text": "", + "default_value": "", + }, + "id": "beb4d454-466d-43d5-823e-80dbccacbbb3", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", + "help_text": "", + "default_value": "", + }, + "id": "fd6b034d-7cec-49fe-b4da-991c382283ef", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", + "help_text": "", + "default_value": "", + }, + "id": "d930a864-263d-4d0d-8ff1-553b13efda41", + }, + { + "type": "text_markup", + "value": "

I would like to

", + "id": "2b572f43-c912-4a94-93ae-cd6b64c2b95b", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc).", + "help_text": "", + "default_value": "", + }, + "id": "f75fd335-be7d-460d-b96a-53d7aa9a826f", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up for OTF's daily newsletter (collection of news related to global internet freedom).", + "help_text": "", + "default_value": "", + }, + "id": "a1f03bca-9267-49cf-9880-444d6806065c", + }, ] - application_form, _ = ApplicationForm.objects.get_or_create(name='Community lab', defaults={'form_fields': json.dumps(data)}) + application_form, _ = ApplicationForm.objects.get_or_create( + name="Community lab", defaults={"form_fields": json.dumps(data)} + ) return application_form def create_community_lab_review_form(self): - data2 = [ - {"type": "text_markup", "value": "

Conflicts of Interest and Confidentialit

", "id": "fe01dccb-87db-4dba-8cb8-f75e6f3448e6"}, - {"type": "checkbox", "value": {"field_label": "I understand about confidentiality", "help_text": "", "required": "true", "default_value": ""}, "id": "c1c6cedc-a084-4c55-87d5-7f6baf48441e"}, - {"type": "dropdown", "value": {"field_label": "Do you have any conflicts of interest to report?", "help_text": "", "required": "", "choices": ["Yes", "No"]}, "id": "c29a7f43-009c-4341-bbe8-9582ba089d52"}, - {"type": "rich_text", "value": {"field_label": "Conflict(s) of interest disclosure", "help_text": "", "required": "", "default_value": ""}, "id": "3aab69b1-6b60-4850-8f9f-7bc1b5871dcf"}, - {"type": "recommendation", "value": {"field_label": "Do you think we should support this request?", "help_text": "", "info": None}, "id": "caa6d522-4cfc-4f96-a29b-773a2de03e31"}, - {"type": "score", "value": {"field_label": "How well do the goals and objectives fit OTF’s remit?", "help_text": "", "required": ""}, "id": "732fc004-3086-44e1-8508-e0f17c3732a8"}, - {"type": "rich_text", "value": {"field_label": "What do you like about the proposed effort?", "help_text": "", "required": "", "default_value": ""}, "id": "f3c42cf1-e5ef-4674-bf6c-8e4640ee0d58"}, - {"type": "rich_text", "value": {"field_label": "What do you not like about the proposed effort?", "help_text": "", "required": "", "default_value": ""}, "id": "e1e69628-c663-4cd2-a0ea-507ad01149de"}, - {"type": "rich_text", "value": {"field_label": "What areas, if any, would you like more information?", "help_text": "", "required": "", "default_value": ""}, "id": "3033f228-58af-4944-b884-736fe6258bd6"}, - {"type": "rich_text", "value": {"field_label": "How could they can improve collaboration or the inclusion of diverse voices?", "help_text": "", "required": "", "default_value": ""}, "id": "20ec1ed7-4e3e-433c-944a-7c20cd6245c8"}, - {"type": "rich_text", "value": {"field_label": "Are there any individuals, communities, or networks they should reach out to?", "help_text": "", "required": "", "default_value": ""}, "id": "fd361c53-a263-4572-8403-74f6736d38fc"}, - {"type": "comments", "value": {"field_label": "Other comments", "help_text": "", "info": None}, "id": "d74e398e-6e64-43ae-b799-a3b79860c80e"} + { + "type": "text_markup", + "value": "

Conflicts of Interest and Confidentialit

", + "id": "fe01dccb-87db-4dba-8cb8-f75e6f3448e6", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand about confidentiality", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "c1c6cedc-a084-4c55-87d5-7f6baf48441e", + }, + { + "type": "dropdown", + "value": { + "field_label": "Do you have any conflicts of interest to report?", + "help_text": "", + "required": "", + "choices": ["Yes", "No"], + }, + "id": "c29a7f43-009c-4341-bbe8-9582ba089d52", + }, + { + "type": "rich_text", + "value": { + "field_label": "Conflict(s) of interest disclosure", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "3aab69b1-6b60-4850-8f9f-7bc1b5871dcf", + }, + { + "type": "recommendation", + "value": { + "field_label": "Do you think we should support this request?", + "help_text": "", + "info": None, + }, + "id": "caa6d522-4cfc-4f96-a29b-773a2de03e31", + }, + { + "type": "score", + "value": { + "field_label": "How well do the goals and objectives fit OTF’s remit?", + "help_text": "", + "required": "", + }, + "id": "732fc004-3086-44e1-8508-e0f17c3732a8", + }, + { + "type": "rich_text", + "value": { + "field_label": "What do you like about the proposed effort?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "f3c42cf1-e5ef-4674-bf6c-8e4640ee0d58", + }, + { + "type": "rich_text", + "value": { + "field_label": "What do you not like about the proposed effort?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "e1e69628-c663-4cd2-a0ea-507ad01149de", + }, + { + "type": "rich_text", + "value": { + "field_label": "What areas, if any, would you like more information?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "3033f228-58af-4944-b884-736fe6258bd6", + }, + { + "type": "rich_text", + "value": { + "field_label": "How could they can improve collaboration or the inclusion of diverse voices?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "20ec1ed7-4e3e-433c-944a-7c20cd6245c8", + }, + { + "type": "rich_text", + "value": { + "field_label": "Are there any individuals, communities, or networks they should reach out to?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "fd361c53-a263-4572-8403-74f6736d38fc", + }, + { + "type": "comments", + "value": { + "field_label": "Other comments", + "help_text": "", + "info": None, + }, + "id": "d74e398e-6e64-43ae-b799-a3b79860c80e", + }, ] - community_lab_review_form, _ = ReviewForm.objects.get_or_create(name='Community lab review', defaults={'form_fields': json.dumps(data2)}) + community_lab_review_form, _ = ReviewForm.objects.get_or_create( + name="Community lab review", defaults={"form_fields": json.dumps(data2)} + ) return community_lab_review_form @@ -98,12 +432,14 @@ def create_community_lab_fund_type(self, application_form, application_review_fo except LabType.DoesNotExist: apply_home = ApplyHomePage.objects.first() - lab = LabType(title=CL_FUND_TITLE, lead=lead, workflow_name='single') + lab = LabType(title=CL_FUND_TITLE, lead=lead, workflow_name="single") apply_home.add_child(instance=lab) lab_form = LabBaseForm.objects.create(lab=lab, form=application_form) lab.forms = [lab_form] - lab_review_form = LabBaseReviewForm.objects.create(lab=lab, form=application_review_form) + lab_review_form = LabBaseReviewForm.objects.create( + lab=lab, form=application_review_form + ) lab.review_forms = [lab_review_form] lab.save() diff --git a/hypha/apply/funds/management/commands/seed_concept_note.py b/hypha/apply/funds/management/commands/seed_concept_note.py index 34ea415669..645f4a2323 100644 --- a/hypha/apply/funds/management/commands/seed_concept_note.py +++ b/hypha/apply/funds/management/commands/seed_concept_note.py @@ -15,8 +15,8 @@ from hypha.apply.review.models import ReviewForm from hypha.apply.users.groups import STAFF_GROUP_NAME -CN_ROUND_TITLE = 'Internet Freedom Fund (archive round)' -CN_FUND_TITLE = 'Internet Freedom Fund (archive fund)' +CN_ROUND_TITLE = "Internet Freedom Fund (archive round)" +CN_FUND_TITLE = "Internet Freedom Fund (archive fund)" class Command(BaseCommand): @@ -26,194 +26,1066 @@ class Command(BaseCommand): def handle(self, *args, **options): # There's an Internet Freedom Fund open round, so bail out. Avoids duplicate command runs. if Round.objects.filter(title=CN_ROUND_TITLE).count(): - self.stdout.write(self.style.WARNING('Skipping. The target Round/Fund Type and Application Form exist')) + self.stdout.write( + self.style.WARNING( + "Skipping. The target Round/Fund Type and Application Form exist" + ) + ) return application_form = self.create_concept_note_form() proposal_form = self.create_proposal_form() application_review_form = self.create_concept_review_form() proposal_review_form = self.create_proposal_review_form() - fund = self.create_concept_note_fund_type(application_form, proposal_form, application_review_form, proposal_review_form) + fund = self.create_concept_note_fund_type( + application_form, + proposal_form, + application_review_form, + proposal_review_form, + ) self.create_concept_note_round(fund) def create_concept_note_form(self): - - focus_id = Category.objects.get(name='Focus').id - objectives_id = Category.objects.get(name='Objective(s)').id - beneficiaries_id = Category.objects.get(name='Beneficiaries').id - regions_id = Category.objects.get(name='Region(s)').id - addressed_id = Category.objects.get(name='Addressed problems').id - status_id = Category.objects.get(name='Project status').id - tech_id = Category.objects.get(name='Technology attributes').id - countries_id = Category.objects.get(name='Countries').id + focus_id = Category.objects.get(name="Focus").id + objectives_id = Category.objects.get(name="Objective(s)").id + beneficiaries_id = Category.objects.get(name="Beneficiaries").id + regions_id = Category.objects.get(name="Region(s)").id + addressed_id = Category.objects.get(name="Addressed problems").id + status_id = Category.objects.get(name="Project status").id + tech_id = Category.objects.get(name="Technology attributes").id + countries_id = Category.objects.get(name="Countries").id data = [ - {"type": "text_markup", "value": "

Basic information

", "id": "25108c8b-c268-4f47-a441-99c3bc4ce43a"}, - {"type": "title", "value": {"field_label": "What is your project name?", "help_text": "", "info": None}, "id": "fd8e6437-89a4-4515-84d0-15c31be716ea"}, - {"type": "full_name", "value": {"field_label": "Your name", "help_text": "", "info": None}, "id": "825f74bf-9419-411a-97d1-631346ae7218"}, - {"type": "email", "value": {"field_label": "E-mail", "help_text": "", "info": None}, "id": "d66e3f38-48db-498a-83a5-4781ded03941"}, - {"type": "address", "value": {"field_label": "Address", "help_text": "", "info": None}, "id": "ea070127-684c-4136-8489-63c352b409c9"}, - {"type": "dropdown", "value": {"field_label": "Have you ever applied to or received funding as an OTF project?", "help_text": "", "required": "", "choices": ["Yes", "No"]}, "id": "0305a465-8763-4c1f-9197-4ca4227d452a"}, - {"type": "rich_text", "value": {"field_label": "If yes, which application and what was the outcome?", "help_text": "", "required": "", "default_value": ""}, "id": "c24691be-9861-4dbc-8be4-03b6e68c1973"}, - {"type": "text_markup", "value": "

What is your idea?

", "id": "0702b9e5-2624-40a0-9caa-42ff46797fb6"}, - {"type": "rich_text", "value": {"field_label": "Describe it", "help_text": "", "required": "", "default_value": ""}, "id": "c21c58c3-cfbe-4409-b2f2-8f56398f1731"}, - {"type": "rich_text", "value": {"field_label": "What are hoped for goals or longer term effects of the project?", "help_text": "", "required": "", "default_value": ""}, "id": "27289c14-6926-4f61-bea2-8031a653f71c"}, - {"type": "category", "value": {"field_label": "Focus", "help_text": "", "required": "", "category": focus_id, "multi": "true"}, "id": "404e2310-000b-4ccb-b772-3680946ff07d"}, - {"type": "category", "value": {"field_label": "Status", "help_text": "", "required": "", "category": status_id, "multi": "true"}, "id": "145c364f-e0bb-4652-94e8-fe08c831da2b"}, - {"type": "category", "value": {"field_label": "Technology attributes", "help_text": "", "required": "", "category": tech_id, "multi": "true"}, "id": "b4da2310-9654-4aa7-a04a-06335967ddc5"}, - {"type": "text_markup", "value": "

How will you do it?

", "id": "e5fe71f5-8ec5-4ac9-ba21-38e03cdcf73b"}, - {"type": "rich_text", "value": {"field_label": "Describe how", "help_text": "", "required": "", "default_value": ""}, "id": "418b8099-4525-437f-a55c-9b35745d0384"}, - {"type": "category", "value": {"field_label": "Objective(s)", "help_text": "", "required": "", "category": objectives_id, "multi": "true"}, "id": "390702bd-e4e1-4dc2-8c43-d51bf018b427"}, - {"type": "duration", "value": {"field_label": "How long will it take?", "help_text": "", "info": None}, "id": "b8d4f24f-c5bd-4a18-aa13-7c7358b3f99f"}, - {"type": "value", "value": {"field_label": "How much do you want?", "help_text": "", "info": None}, "id": "1e669b4d-e43f-4c7a-9730-08e25cb1592d"}, - {"type": "rich_text", "value": {"field_label": "How long have you been thinking of working on this idea? What made you first think about it?", "help_text": "", "required": "", "default_value": ""}, "id": "dfb9c307-9328-4a99-9efc-321d474b2ba7"}, - {"type": "text_markup", "value": "

Who is the project for?

", "id": "563c12f1-d856-4ee2-a449-793bbfd12296"}, - {"type": "rich_text", "value": {"field_label": "Describe them", "help_text": "", "required": "", "default_value": ""}, "id": "11f94a22-0571-4491-a93e-87c050e02a4a"}, - {"type": "rich_text", "value": {"field_label": "What community currently exists around this project?", "help_text": "", "required": "", "default_value": ""}, "id": "c272969b-d89f-4b6e-859f-4606a15b3f28"}, - {"type": "category", "value": {"field_label": "Beneficiaries", "help_text": "", "required": "", "category": beneficiaries_id, "multi": "true"}, "id": "72002c3e-aaee-47da-9377-8bb493f14c21"}, - {"type": "category", "value": {"field_label": "Region", "help_text": "", "required": "", "category": regions_id, "multi": "true"}, "id": "369b248e-f669-4aeb-b771-7cba0eadb921"}, - {"type": "category", "value": {"field_label": "Country", "help_text": "", "required": "", "category": countries_id, "multi": "true"}, "id": "57bceb33-ebda-4708-9080-fd1a5923e008"}, - {"type": "text_markup", "value": "

Why is this project needed?

", "id": "ab556178-07b5-468e-b1cf-46655859fd32"}, - {"type": "rich_text", "value": {"field_label": "Describe why", "help_text": "", "required": "", "default_value": ""}, "id": "c14ee077-c0eb-48b1-9825-fbba9b91ede5"}, - {"type": "category", "value": {"field_label": "Addressed problems", "help_text": "", "required": "", "category": addressed_id, "multi": "true"}, "id": "a83a1884-f711-4196-8d15-ae2110466acb"}, - {"type": "rich_text", "value": {"field_label": "Similar/Complementary efforts", "help_text": "", "required": "", "default_value": ""}, "id": "9ca35708-d611-4cd0-8d4a-3cc08349f45b"}, - {"type": "rich_text", "value": {"field_label": "Other information", "help_text": "", "required": "", "default_value": ""}, "id": "db7b1642-c03d-4af4-82c9-db67bf9713b0"}, - {"type": "multi_file", "value": {"field_label": "Upload", "help_text": "", "required": ""}, "id": "8a91231c-5c3d-46fe-9de6-8d5c86817626"}, - {"type": "text_markup", "value": "

I acknowledge

", "id": "2c1651a4-2cdc-4b74-8b6e-f077364ca4d8"}, - {"type": "checkbox", "value": {"field_label": "My application will be dismissed if it does not fit within OTF\'s mission, values, principles statements.", "help_text": "", "default_value": ""}, "id": "4c661a64-2614-4169-b4d2-1fd39e2e831b"}, - {"type": "text_markup", "value": "Read our mission, values, and principles.", "id": "cfdd721d-a4d6-44a8-a2d6-6576f126799b"}, - {"type": "checkbox", "value": {"field_label": "I have read and understand OTF\'s Terms and Privacy policy.", "help_text": "", "default_value": ""}, "id": "1bc4e113-1414-46ff-bba7-2dc02b2126df"}, - {"type": "text_markup", "value": "Read the Terms and Privacy policy.", "id": "d1c79c07-02cb-4f59-b5ed-719da7bdd636"}, - {"type": "checkbox", "value": {"field_label": "I am legally able to sign contracts or represent an organization that can.", "help_text": "", "default_value": ""}, "id": "42dd68a1-b699-4678-bea6-13e0f842e821"}, - {"type": "checkbox", "value": {"field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", "help_text": "", "default_value": ""}, "id": "72916731-ec97-4688-95f1-d3bf140b03c2"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", "help_text": "", "default_value": ""}, "id": "6856d26d-b169-4fdf-b598-63c3dd9278a2"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", "help_text": "", "default_value": ""}, "id": "33838399-f292-4b63-83f0-e02d344f99d4"}, - {"type": "text_markup", "value": "

I would like to

", "id": "3ff08317-92ab-4eb1-adca-08547bed96f8"}, - {"type": "checkbox", "value": {"field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc).", "help_text": "", "default_value": ""}, "id": "fc571e12-d4a2-4d53-ab34-2c57321dc6ac"}, - {"type": "checkbox", "value": {"field_label": "Sign up for OTF\'s daily newsletter (collection of news related to global internet freedom).", "help_text": "", "default_value": ""}, "id": "cd0d8a4b-e71a-4dff-964a-f547bd655e7d"} + { + "type": "text_markup", + "value": "

Basic information

", + "id": "25108c8b-c268-4f47-a441-99c3bc4ce43a", + }, + { + "type": "title", + "value": { + "field_label": "What is your project name?", + "help_text": "", + "info": None, + }, + "id": "fd8e6437-89a4-4515-84d0-15c31be716ea", + }, + { + "type": "full_name", + "value": {"field_label": "Your name", "help_text": "", "info": None}, + "id": "825f74bf-9419-411a-97d1-631346ae7218", + }, + { + "type": "email", + "value": {"field_label": "E-mail", "help_text": "", "info": None}, + "id": "d66e3f38-48db-498a-83a5-4781ded03941", + }, + { + "type": "address", + "value": {"field_label": "Address", "help_text": "", "info": None}, + "id": "ea070127-684c-4136-8489-63c352b409c9", + }, + { + "type": "dropdown", + "value": { + "field_label": "Have you ever applied to or received funding as an OTF project?", + "help_text": "", + "required": "", + "choices": ["Yes", "No"], + }, + "id": "0305a465-8763-4c1f-9197-4ca4227d452a", + }, + { + "type": "rich_text", + "value": { + "field_label": "If yes, which application and what was the outcome?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "c24691be-9861-4dbc-8be4-03b6e68c1973", + }, + { + "type": "text_markup", + "value": "

What is your idea?

", + "id": "0702b9e5-2624-40a0-9caa-42ff46797fb6", + }, + { + "type": "rich_text", + "value": { + "field_label": "Describe it", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "c21c58c3-cfbe-4409-b2f2-8f56398f1731", + }, + { + "type": "rich_text", + "value": { + "field_label": "What are hoped for goals or longer term effects of the project?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "27289c14-6926-4f61-bea2-8031a653f71c", + }, + { + "type": "category", + "value": { + "field_label": "Focus", + "help_text": "", + "required": "", + "category": focus_id, + "multi": "true", + }, + "id": "404e2310-000b-4ccb-b772-3680946ff07d", + }, + { + "type": "category", + "value": { + "field_label": "Status", + "help_text": "", + "required": "", + "category": status_id, + "multi": "true", + }, + "id": "145c364f-e0bb-4652-94e8-fe08c831da2b", + }, + { + "type": "category", + "value": { + "field_label": "Technology attributes", + "help_text": "", + "required": "", + "category": tech_id, + "multi": "true", + }, + "id": "b4da2310-9654-4aa7-a04a-06335967ddc5", + }, + { + "type": "text_markup", + "value": "

How will you do it?

", + "id": "e5fe71f5-8ec5-4ac9-ba21-38e03cdcf73b", + }, + { + "type": "rich_text", + "value": { + "field_label": "Describe how", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "418b8099-4525-437f-a55c-9b35745d0384", + }, + { + "type": "category", + "value": { + "field_label": "Objective(s)", + "help_text": "", + "required": "", + "category": objectives_id, + "multi": "true", + }, + "id": "390702bd-e4e1-4dc2-8c43-d51bf018b427", + }, + { + "type": "duration", + "value": { + "field_label": "How long will it take?", + "help_text": "", + "info": None, + }, + "id": "b8d4f24f-c5bd-4a18-aa13-7c7358b3f99f", + }, + { + "type": "value", + "value": { + "field_label": "How much do you want?", + "help_text": "", + "info": None, + }, + "id": "1e669b4d-e43f-4c7a-9730-08e25cb1592d", + }, + { + "type": "rich_text", + "value": { + "field_label": "How long have you been thinking of working on this idea? What made you first think about it?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "dfb9c307-9328-4a99-9efc-321d474b2ba7", + }, + { + "type": "text_markup", + "value": "

Who is the project for?

", + "id": "563c12f1-d856-4ee2-a449-793bbfd12296", + }, + { + "type": "rich_text", + "value": { + "field_label": "Describe them", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "11f94a22-0571-4491-a93e-87c050e02a4a", + }, + { + "type": "rich_text", + "value": { + "field_label": "What community currently exists around this project?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "c272969b-d89f-4b6e-859f-4606a15b3f28", + }, + { + "type": "category", + "value": { + "field_label": "Beneficiaries", + "help_text": "", + "required": "", + "category": beneficiaries_id, + "multi": "true", + }, + "id": "72002c3e-aaee-47da-9377-8bb493f14c21", + }, + { + "type": "category", + "value": { + "field_label": "Region", + "help_text": "", + "required": "", + "category": regions_id, + "multi": "true", + }, + "id": "369b248e-f669-4aeb-b771-7cba0eadb921", + }, + { + "type": "category", + "value": { + "field_label": "Country", + "help_text": "", + "required": "", + "category": countries_id, + "multi": "true", + }, + "id": "57bceb33-ebda-4708-9080-fd1a5923e008", + }, + { + "type": "text_markup", + "value": "

Why is this project needed?

", + "id": "ab556178-07b5-468e-b1cf-46655859fd32", + }, + { + "type": "rich_text", + "value": { + "field_label": "Describe why", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "c14ee077-c0eb-48b1-9825-fbba9b91ede5", + }, + { + "type": "category", + "value": { + "field_label": "Addressed problems", + "help_text": "", + "required": "", + "category": addressed_id, + "multi": "true", + }, + "id": "a83a1884-f711-4196-8d15-ae2110466acb", + }, + { + "type": "rich_text", + "value": { + "field_label": "Similar/Complementary efforts", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "9ca35708-d611-4cd0-8d4a-3cc08349f45b", + }, + { + "type": "rich_text", + "value": { + "field_label": "Other information", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "db7b1642-c03d-4af4-82c9-db67bf9713b0", + }, + { + "type": "multi_file", + "value": {"field_label": "Upload", "help_text": "", "required": ""}, + "id": "8a91231c-5c3d-46fe-9de6-8d5c86817626", + }, + { + "type": "text_markup", + "value": "

I acknowledge

", + "id": "2c1651a4-2cdc-4b74-8b6e-f077364ca4d8", + }, + { + "type": "checkbox", + "value": { + "field_label": "My application will be dismissed if it does not fit within OTF's mission, values, principles statements.", + "help_text": "", + "default_value": "", + }, + "id": "4c661a64-2614-4169-b4d2-1fd39e2e831b", + }, + { + "type": "text_markup", + "value": 'Read our mission, values, and principles.', + "id": "cfdd721d-a4d6-44a8-a2d6-6576f126799b", + }, + { + "type": "checkbox", + "value": { + "field_label": "I have read and understand OTF's Terms and Privacy policy.", + "help_text": "", + "default_value": "", + }, + "id": "1bc4e113-1414-46ff-bba7-2dc02b2126df", + }, + { + "type": "text_markup", + "value": 'Read the Terms and Privacy policy.', + "id": "d1c79c07-02cb-4f59-b5ed-719da7bdd636", + }, + { + "type": "checkbox", + "value": { + "field_label": "I am legally able to sign contracts or represent an organization that can.", + "help_text": "", + "default_value": "", + }, + "id": "42dd68a1-b699-4678-bea6-13e0f842e821", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", + "help_text": "", + "default_value": "", + }, + "id": "72916731-ec97-4688-95f1-d3bf140b03c2", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", + "help_text": "", + "default_value": "", + }, + "id": "6856d26d-b169-4fdf-b598-63c3dd9278a2", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", + "help_text": "", + "default_value": "", + }, + "id": "33838399-f292-4b63-83f0-e02d344f99d4", + }, + { + "type": "text_markup", + "value": "

I would like to

", + "id": "3ff08317-92ab-4eb1-adca-08547bed96f8", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc).", + "help_text": "", + "default_value": "", + }, + "id": "fc571e12-d4a2-4d53-ab34-2c57321dc6ac", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up for OTF's daily newsletter (collection of news related to global internet freedom).", + "help_text": "", + "default_value": "", + }, + "id": "cd0d8a4b-e71a-4dff-964a-f547bd655e7d", + }, ] - application_form, _ = ApplicationForm.objects.get_or_create(name='Concept note', defaults={'form_fields': json.dumps(data)}) + application_form, _ = ApplicationForm.objects.get_or_create( + name="Concept note", defaults={"form_fields": json.dumps(data)} + ) return application_form def create_proposal_form(self): - - focus_id = Category.objects.get(name='Focus').id - objectives_id = Category.objects.get(name='Objective(s)').id - beneficiaries_id = Category.objects.get(name='Beneficiaries').id - regions_id = Category.objects.get(name='Region(s)').id - addressed_id = Category.objects.get(name='Addressed problems').id - status_id = Category.objects.get(name='Project status').id - tech_id = Category.objects.get(name='Technology attributes').id - countries_id = Category.objects.get(name='Countries').id + focus_id = Category.objects.get(name="Focus").id + objectives_id = Category.objects.get(name="Objective(s)").id + beneficiaries_id = Category.objects.get(name="Beneficiaries").id + regions_id = Category.objects.get(name="Region(s)").id + addressed_id = Category.objects.get(name="Addressed problems").id + status_id = Category.objects.get(name="Project status").id + tech_id = Category.objects.get(name="Technology attributes").id + countries_id = Category.objects.get(name="Countries").id data2 = [ - {"type": "text_markup", "value": "

Proposal information

", "id": "f6bdb7e0-ec19-4b88-a2df-f0e7a512df8d"}, - {"type": "title", "value": {"field_label": "Proposal title", "help_text": "", "info": None}, "id": "6a83b04d-0909-4018-bc77-f8d72a019dd4"}, - {"type": "value", "value": {"field_label": "Requested funding", "help_text": "", "info": None}, "id": "0299f96f-3809-4f9e-a786-4af89547881b"}, - {"type": "duration", "value": {"field_label": "How long will it take?", "help_text": "", "info": None}, "id": "3ff602a1-642b-4742-a2c9-c9226af727ac"}, - {"type": "full_name", "value": {"field_label": "Your name", "help_text": "", "info": None}, "id": "739a413b-46cc-4936-82ce-e68c2dfa41ca"}, - {"type": "char", "value": {"field_label": "Legal name", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "d5cd3d89-89ea-44c2-9772-0da658c36881"}, - {"type": "char", "value": {"field_label": "Primary point of contact", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "a3c9af86-d047-4663-864a-b6dd97a60c39"}, - {"type": "email", "value": {"field_label": "E-mail", "help_text": "", "info": None}, "id": "6c95d411-bd68-4374-8c2d-1b64dc03ed68"}, - {"type": "char", "value": {"field_label": "Phone", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "40479d2a-7d53-4c81-834a-775ccd6c91c0"}, - {"type": "address", "value": {"field_label": "Address", "help_text": "", "info": None}, "id": "f7e431b1-9965-4ebe-ab30-a00ff4b972ec"}, - {"type": "text_markup", "value": "

Proposal narrative

", "id": "07f2ffb3-4eda-4f4c-8ebc-9da157e0102c"}, - {"type": "rich_text", "value": {"field_label": "Summary", "help_text": "", "required": "", "default_value": ""}, "id": "a7502e97-5f2e-417f-b08c-588d367e40e5"}, - {"type": "rich_text", "value": {"field_label": "Project description", "help_text": "", "required": "", "default_value": ""}, "id": "072f181b-90a2-4bb2-986d-55e1aaa9f348"}, - {"type": "rich_text", "value": {"field_label": "Objectives", "help_text": "", "required": "", "default_value": ""}, "id": "a7ae7375-4569-47e2-8ee7-3c3d441375a9"}, - {"type": "rich_text", "value": {"field_label": "Project deliverables/activities", "help_text": "", "required": "", "default_value": ""}, "id": "50328cc9-879d-4817-8454-2062ac47aef9"}, - {"type": "rich_text", "value": {"field_label": "Budget details", "help_text": "", "required": "", "default_value": ""}, "id": "7b0b0af4-009f-45db-b20c-5f991bce7752"}, - {"type": "rich_text", "value": {"field_label": "Similar/Complementary efforts", "help_text": "", "required": "", "default_value": ""}, "id": "ba3733f3-bee8-4fe8-bdde-36812aa4df77"}, - {"type": "rich_text", "value": {"field_label": "Monitoring and evaluation", "help_text": "", "required": "", "default_value": ""}, "id": "23028eab-92c3-4c30-9a3e-5604dec0854d"}, - {"type": "rich_text", "value": {"field_label": "Sustainability", "help_text": "", "required": "", "default_value": ""}, "id": "88d635e4-81d6-413c-8e09-52b74015e78b"}, - {"type": "rich_text", "value": {"field_label": "Other support information", "help_text": "", "required": "", "default_value": ""}, "id": "38072bb7-fcdd-4f74-9bfb-db45bfeb07a7"}, - {"type": "rich_text", "value": {"field_label": "Organization/Individual background", "help_text": "", "required": "", "default_value": ""}, "id": "f8b340d0-8c0c-41f8-acb5-662c676e2bbd"}, - {"type": "rich_text", "value": {"field_label": "References", "help_text": "", "required": "", "default_value": ""}, "id": "8b2572ce-d118-41c4-b5d7-59f4ffe44431"}, - {"type": "rich_text", "value": {"field_label": "Community interaction", "help_text": "", "required": "", "default_value": ""}, "id": "1b93fcd1-c6cd-432a-b831-a0fb680e327e"}, - {"type": "text_markup", "value": "

Descriptors

", "id": "a337e150-d3c5-40b0-9e9e-033c3a685290"}, - {"type": "category", "value": {"field_label": "Status", "help_text": "", "required": "", "category": status_id, "multi": "true"}, "id": "036fa233-c42a-4fc6-861a-ff40450efc7d"}, - {"type": "category", "value": {"field_label": "Focus", "help_text": "", "required": "", "category": focus_id, "multi": "true"}, "id": "7d69aeec-009d-4de2-8dd2-6b0aacb4578f"}, - {"type": "category", "value": {"field_label": "Objective(s)", "help_text": "", "required": "", "category": objectives_id, "multi": "true"}, "id": "328590d3-fefd-410d-b745-12f2efdd5437"}, - {"type": "category", "value": {"field_label": "Beneficiaries", "help_text": "", "required": "", "category": beneficiaries_id, "multi": "true"}, "id": "f18f0399-538b-4bf3-9cd5-4457138814a8"}, - {"type": "category", "value": {"field_label": "Addressed problems", "help_text": "", "required": "", "category": addressed_id, "multi": "true"}, "id": "a9b2b6de-fb7b-4709-aa59-f0ad987a677a"}, - {"type": "category", "value": {"field_label": "Technology attributes", "help_text": "", "required": "", "category": tech_id, "multi": "true"}, "id": "251cf41a-0a49-4725-8d5a-5e496d018647"}, - {"type": "category", "value": {"field_label": "Region", "help_text": "", "required": "", "category": regions_id, "multi": "true"}, "id": "ed6244ae-6903-4412-8b7a-c219ed25dfbb"}, - {"type": "category", "value": {"field_label": "Country", "help_text": "", "required": "", "category": countries_id, "multi": "true"}, "id": "4b79c527-bf24-47f1-87a7-39945e70caeb"}, - {"type": "text_markup", "value": "

Other

", "id": "3cb5d831-bb5d-494a-946a-b24f7867027c"}, - {"type": "multi_file", "value": {"field_label": "Upload", "help_text": "", "required": ""}, "id": "6bec61a1-3527-4e21-aa65-f26d845bbb68"}, - {"type": "rich_text", "value": {"field_label": "Comments", "help_text": "", "required": "", "default_value": ""}, "id": "c0ff8444-8d43-46ef-8498-ed1a32c09c6a"} + { + "type": "text_markup", + "value": "

Proposal information

", + "id": "f6bdb7e0-ec19-4b88-a2df-f0e7a512df8d", + }, + { + "type": "title", + "value": { + "field_label": "Proposal title", + "help_text": "", + "info": None, + }, + "id": "6a83b04d-0909-4018-bc77-f8d72a019dd4", + }, + { + "type": "value", + "value": { + "field_label": "Requested funding", + "help_text": "", + "info": None, + }, + "id": "0299f96f-3809-4f9e-a786-4af89547881b", + }, + { + "type": "duration", + "value": { + "field_label": "How long will it take?", + "help_text": "", + "info": None, + }, + "id": "3ff602a1-642b-4742-a2c9-c9226af727ac", + }, + { + "type": "full_name", + "value": {"field_label": "Your name", "help_text": "", "info": None}, + "id": "739a413b-46cc-4936-82ce-e68c2dfa41ca", + }, + { + "type": "char", + "value": { + "field_label": "Legal name", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "d5cd3d89-89ea-44c2-9772-0da658c36881", + }, + { + "type": "char", + "value": { + "field_label": "Primary point of contact", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "a3c9af86-d047-4663-864a-b6dd97a60c39", + }, + { + "type": "email", + "value": {"field_label": "E-mail", "help_text": "", "info": None}, + "id": "6c95d411-bd68-4374-8c2d-1b64dc03ed68", + }, + { + "type": "char", + "value": { + "field_label": "Phone", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "40479d2a-7d53-4c81-834a-775ccd6c91c0", + }, + { + "type": "address", + "value": {"field_label": "Address", "help_text": "", "info": None}, + "id": "f7e431b1-9965-4ebe-ab30-a00ff4b972ec", + }, + { + "type": "text_markup", + "value": "

Proposal narrative

", + "id": "07f2ffb3-4eda-4f4c-8ebc-9da157e0102c", + }, + { + "type": "rich_text", + "value": { + "field_label": "Summary", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "a7502e97-5f2e-417f-b08c-588d367e40e5", + }, + { + "type": "rich_text", + "value": { + "field_label": "Project description", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "072f181b-90a2-4bb2-986d-55e1aaa9f348", + }, + { + "type": "rich_text", + "value": { + "field_label": "Objectives", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "a7ae7375-4569-47e2-8ee7-3c3d441375a9", + }, + { + "type": "rich_text", + "value": { + "field_label": "Project deliverables/activities", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "50328cc9-879d-4817-8454-2062ac47aef9", + }, + { + "type": "rich_text", + "value": { + "field_label": "Budget details", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "7b0b0af4-009f-45db-b20c-5f991bce7752", + }, + { + "type": "rich_text", + "value": { + "field_label": "Similar/Complementary efforts", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "ba3733f3-bee8-4fe8-bdde-36812aa4df77", + }, + { + "type": "rich_text", + "value": { + "field_label": "Monitoring and evaluation", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "23028eab-92c3-4c30-9a3e-5604dec0854d", + }, + { + "type": "rich_text", + "value": { + "field_label": "Sustainability", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "88d635e4-81d6-413c-8e09-52b74015e78b", + }, + { + "type": "rich_text", + "value": { + "field_label": "Other support information", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "38072bb7-fcdd-4f74-9bfb-db45bfeb07a7", + }, + { + "type": "rich_text", + "value": { + "field_label": "Organization/Individual background", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "f8b340d0-8c0c-41f8-acb5-662c676e2bbd", + }, + { + "type": "rich_text", + "value": { + "field_label": "References", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "8b2572ce-d118-41c4-b5d7-59f4ffe44431", + }, + { + "type": "rich_text", + "value": { + "field_label": "Community interaction", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "1b93fcd1-c6cd-432a-b831-a0fb680e327e", + }, + { + "type": "text_markup", + "value": "

Descriptors

", + "id": "a337e150-d3c5-40b0-9e9e-033c3a685290", + }, + { + "type": "category", + "value": { + "field_label": "Status", + "help_text": "", + "required": "", + "category": status_id, + "multi": "true", + }, + "id": "036fa233-c42a-4fc6-861a-ff40450efc7d", + }, + { + "type": "category", + "value": { + "field_label": "Focus", + "help_text": "", + "required": "", + "category": focus_id, + "multi": "true", + }, + "id": "7d69aeec-009d-4de2-8dd2-6b0aacb4578f", + }, + { + "type": "category", + "value": { + "field_label": "Objective(s)", + "help_text": "", + "required": "", + "category": objectives_id, + "multi": "true", + }, + "id": "328590d3-fefd-410d-b745-12f2efdd5437", + }, + { + "type": "category", + "value": { + "field_label": "Beneficiaries", + "help_text": "", + "required": "", + "category": beneficiaries_id, + "multi": "true", + }, + "id": "f18f0399-538b-4bf3-9cd5-4457138814a8", + }, + { + "type": "category", + "value": { + "field_label": "Addressed problems", + "help_text": "", + "required": "", + "category": addressed_id, + "multi": "true", + }, + "id": "a9b2b6de-fb7b-4709-aa59-f0ad987a677a", + }, + { + "type": "category", + "value": { + "field_label": "Technology attributes", + "help_text": "", + "required": "", + "category": tech_id, + "multi": "true", + }, + "id": "251cf41a-0a49-4725-8d5a-5e496d018647", + }, + { + "type": "category", + "value": { + "field_label": "Region", + "help_text": "", + "required": "", + "category": regions_id, + "multi": "true", + }, + "id": "ed6244ae-6903-4412-8b7a-c219ed25dfbb", + }, + { + "type": "category", + "value": { + "field_label": "Country", + "help_text": "", + "required": "", + "category": countries_id, + "multi": "true", + }, + "id": "4b79c527-bf24-47f1-87a7-39945e70caeb", + }, + { + "type": "text_markup", + "value": "

Other

", + "id": "3cb5d831-bb5d-494a-946a-b24f7867027c", + }, + { + "type": "multi_file", + "value": {"field_label": "Upload", "help_text": "", "required": ""}, + "id": "6bec61a1-3527-4e21-aa65-f26d845bbb68", + }, + { + "type": "rich_text", + "value": { + "field_label": "Comments", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "c0ff8444-8d43-46ef-8498-ed1a32c09c6a", + }, ] - proposal_form, _ = ApplicationForm.objects.get_or_create(name='Proposal', defaults={'form_fields': json.dumps(data2)}) + proposal_form, _ = ApplicationForm.objects.get_or_create( + name="Proposal", defaults={"form_fields": json.dumps(data2)} + ) return proposal_form def create_concept_review_form(self): - data3 = [ - {"type": "recommendation", "value": {"field_label": "Do you think we should support this request?", "help_text": "", "info": None}, "id": "25d0d9b0-6e65-4fe3-906a-a1cd211def96"}, - {"type": "rich_text", "value": {"field_label": "Recommendation comments", "help_text": "", "required": "", "default_value": ""}, "id": "f16be0b3-ef02-4876-b056-8a84238b1a52"}, - {"type": "score", "value": {"field_label": "Goals and principles", "help_text": "", "required": ""}, "id": "6dd8d5d2-09a5-4681-aebc-eb9ccd00395a"}, - {"type": "score", "value": {"field_label": "Technical merit", "help_text": "", "required": ""}, "id": "52b1f53c-9656-4b0c-8b8b-a9c57869356d"}, - {"type": "score", "value": {"field_label": "Reasonable and realistic", "help_text": "", "required": ""}, "id": "aedb27e7-6044-4e04-b2c7-358065c8fe5c"}, - {"type": "rich_text", "value": {"field_label": "Request specific questions", "help_text": "", "required": "", "default_value": ""}, "id": "84405ba2-f94e-4d4d-92e1-190bd802f858"}, - {"type": "comments", "value": {"field_label": "Other comments", "help_text": "", "info": None}, "id": "5028cac1-752f-4d47-b83a-4f766f19fb2d"} + { + "type": "recommendation", + "value": { + "field_label": "Do you think we should support this request?", + "help_text": "", + "info": None, + }, + "id": "25d0d9b0-6e65-4fe3-906a-a1cd211def96", + }, + { + "type": "rich_text", + "value": { + "field_label": "Recommendation comments", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "f16be0b3-ef02-4876-b056-8a84238b1a52", + }, + { + "type": "score", + "value": { + "field_label": "Goals and principles", + "help_text": "", + "required": "", + }, + "id": "6dd8d5d2-09a5-4681-aebc-eb9ccd00395a", + }, + { + "type": "score", + "value": { + "field_label": "Technical merit", + "help_text": "", + "required": "", + }, + "id": "52b1f53c-9656-4b0c-8b8b-a9c57869356d", + }, + { + "type": "score", + "value": { + "field_label": "Reasonable and realistic", + "help_text": "", + "required": "", + }, + "id": "aedb27e7-6044-4e04-b2c7-358065c8fe5c", + }, + { + "type": "rich_text", + "value": { + "field_label": "Request specific questions", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "84405ba2-f94e-4d4d-92e1-190bd802f858", + }, + { + "type": "comments", + "value": { + "field_label": "Other comments", + "help_text": "", + "info": None, + }, + "id": "5028cac1-752f-4d47-b83a-4f766f19fb2d", + }, ] - concept_review_form, _ = ReviewForm.objects.get_or_create(name='Concept review', defaults={'form_fields': json.dumps(data3)}) + concept_review_form, _ = ReviewForm.objects.get_or_create( + name="Concept review", defaults={"form_fields": json.dumps(data3)} + ) return concept_review_form def create_proposal_review_form(self): - data4 = [ - {"type": "text_markup", "value": "

A. Conflicts of Interest and Confidentialit

", "id": "976386e1-3a66-490f-9e82-bfbe1f134cf2"}, - {"type": "checkbox", "value": {"field_label": "I understand about confidentiality", "help_text": "", "default_value": ""}, "id": "65fb2c22-a0c5-4cde-94a7-feb27072bc3d"}, - {"type": "dropdown", "value": {"field_label": "Do you have any conflicts of interest to report?", "help_text": "", "required": "", "choices": ["Yes", "No"]}, "id": "dd75ce49-e3c4-43da-b724-4cb8bb88dcf8"}, - {"type": "rich_text", "value": {"field_label": "Conflict(s) of interest disclosure", "help_text": "", "required": "", "default_value": ""}, "id": "9f7fe70b-97b5-4263-98ac-a45bf97b59d0"}, - {"type": "text_markup", "value": "

B. General thoughts

", "id": "46079135-4857-4749-9df0-7c1d0ba38e10"}, - {"type": "rich_text", "value": {"field_label": "1. Positive aspects", "help_text": "", "required": "", "default_value": ""}, "id": "e91ed603-61ad-483e-be7b-21716d05a3bd"}, - {"type": "rich_text", "value": {"field_label": "2. Concerns", "help_text": "", "required": "", "default_value": ""}, "id": "821fb071-7db7-4cc1-ac3a-34b9eee40c94"}, - {"type": "rich_text", "value": {"field_label": "3. Items that must be addressed", "help_text": "", "required": "", "default_value": ""}, "id": "021624ac-6628-430d-ba86-e68fd518c87e"}, - {"type": "text_markup", "value": "

C. Specific aspects

", "id": "64bf5170-7032-4250-b059-74d1022e1cb2"}, - {"type": "score", "value": {"field_label": "1. Project overview", "help_text": "", "required": ""}, "id": "9c5603d5-f897-42fa-8739-5935769c94bd"}, - {"type": "score", "value": {"field_label": "2. Proposal objectives", "help_text": "", "required": ""}, "id": "6b748400-fad9-4b31-bb85-e3a53c99f4df"}, - {"type": "score", "value": {"field_label": "3. Appropriate activities and strategy", "help_text": "", "required": ""}, "id": "a806a944-1d8a-4904-ace0-acfce5634a50"}, - {"type": "score", "value": {"field_label": "4. Technical feasibility (where applicable)", "help_text": "", "required": ""}, "id": "512a86a5-ec5b-4d36-9630-90648b5b43e4"}, - {"type": "score", "value": {"field_label": "5. Alternative analysis - red teaming", "help_text": "", "required": ""}, "id": "d9695d1d-3373-4acf-ada5-3b2593b3a634"}, - {"type": "score", "value": {"field_label": "6. Usability", "help_text": "", "required": ""}, "id": "e43dd4dc-d2fa-493c-9f55-5a126d0e0579"}, - {"type": "score", "value": {"field_label": "7. Sustainability", "help_text": "", "required": ""}, "id": "ee7009b8-ad18-46b5-a981-ccc52972c0a5"}, - {"type": "score", "value": {"field_label": "8. Collaboration", "help_text": "", "required": ""}, "id": "dc5dc5e0-e4d6-462f-8296-a0e58933e701"}, - {"type": "score", "value": {"field_label": "9. Cost realism", "help_text": "", "required": ""}, "id": "31e9b202-24b1-4993-80b7-9851624e2162"}, - {"type": "score", "value": {"field_label": "10. Qualifications", "help_text": "", "required": ""}, "id": "d3f5479c-68da-41d9-a266-130d383bab6b"}, - {"type": "score", "value": {"field_label": "11. Evaluation", "help_text": "", "required": ""}, "id": "2a61c71a-74f6-4963-8850-9289e852f604"}, - {"type": "text_markup", "value": "

D. Rationale and appropriateness consideration

", "id": "3fc9be9f-8cd3-42b8-acc1-542bca210d48"}, - {"type": "score", "value": {"field_label": "Rationale and appropriateness", "help_text": "", "required": ""}, "id": "0d1bf533-968c-44b9-bb30-d437ae039474"}, - {"type": "text_markup", "value": "

E. General recommendation

", "id": "ef4a3bab-2293-4021-9e2c-57e1d78f6237"}, - {"type": "recommendation", "value": {"field_label": "Recommendation", "help_text": "", "info": None}, "id": "4bf80578-1c8f-4515-9d6a-e52e87629e3e"}, - {"type": "comments", "value": {"field_label": "Recommendation comments", "help_text": "", "info": None}, "id": "a814d7ac-8291-4f3e-b733-4a9a4f1f8a49"} + { + "type": "text_markup", + "value": "

A. Conflicts of Interest and Confidentialit

", + "id": "976386e1-3a66-490f-9e82-bfbe1f134cf2", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand about confidentiality", + "help_text": "", + "default_value": "", + }, + "id": "65fb2c22-a0c5-4cde-94a7-feb27072bc3d", + }, + { + "type": "dropdown", + "value": { + "field_label": "Do you have any conflicts of interest to report?", + "help_text": "", + "required": "", + "choices": ["Yes", "No"], + }, + "id": "dd75ce49-e3c4-43da-b724-4cb8bb88dcf8", + }, + { + "type": "rich_text", + "value": { + "field_label": "Conflict(s) of interest disclosure", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "9f7fe70b-97b5-4263-98ac-a45bf97b59d0", + }, + { + "type": "text_markup", + "value": "

B. General thoughts

", + "id": "46079135-4857-4749-9df0-7c1d0ba38e10", + }, + { + "type": "rich_text", + "value": { + "field_label": "1. Positive aspects", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "e91ed603-61ad-483e-be7b-21716d05a3bd", + }, + { + "type": "rich_text", + "value": { + "field_label": "2. Concerns", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "821fb071-7db7-4cc1-ac3a-34b9eee40c94", + }, + { + "type": "rich_text", + "value": { + "field_label": "3. Items that must be addressed", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "021624ac-6628-430d-ba86-e68fd518c87e", + }, + { + "type": "text_markup", + "value": "

C. Specific aspects

", + "id": "64bf5170-7032-4250-b059-74d1022e1cb2", + }, + { + "type": "score", + "value": { + "field_label": "1. Project overview", + "help_text": "", + "required": "", + }, + "id": "9c5603d5-f897-42fa-8739-5935769c94bd", + }, + { + "type": "score", + "value": { + "field_label": "2. Proposal objectives", + "help_text": "", + "required": "", + }, + "id": "6b748400-fad9-4b31-bb85-e3a53c99f4df", + }, + { + "type": "score", + "value": { + "field_label": "3. Appropriate activities and strategy", + "help_text": "", + "required": "", + }, + "id": "a806a944-1d8a-4904-ace0-acfce5634a50", + }, + { + "type": "score", + "value": { + "field_label": "4. Technical feasibility (where applicable)", + "help_text": "", + "required": "", + }, + "id": "512a86a5-ec5b-4d36-9630-90648b5b43e4", + }, + { + "type": "score", + "value": { + "field_label": "5. Alternative analysis - red teaming", + "help_text": "", + "required": "", + }, + "id": "d9695d1d-3373-4acf-ada5-3b2593b3a634", + }, + { + "type": "score", + "value": { + "field_label": "6. Usability", + "help_text": "", + "required": "", + }, + "id": "e43dd4dc-d2fa-493c-9f55-5a126d0e0579", + }, + { + "type": "score", + "value": { + "field_label": "7. Sustainability", + "help_text": "", + "required": "", + }, + "id": "ee7009b8-ad18-46b5-a981-ccc52972c0a5", + }, + { + "type": "score", + "value": { + "field_label": "8. Collaboration", + "help_text": "", + "required": "", + }, + "id": "dc5dc5e0-e4d6-462f-8296-a0e58933e701", + }, + { + "type": "score", + "value": { + "field_label": "9. Cost realism", + "help_text": "", + "required": "", + }, + "id": "31e9b202-24b1-4993-80b7-9851624e2162", + }, + { + "type": "score", + "value": { + "field_label": "10. Qualifications", + "help_text": "", + "required": "", + }, + "id": "d3f5479c-68da-41d9-a266-130d383bab6b", + }, + { + "type": "score", + "value": { + "field_label": "11. Evaluation", + "help_text": "", + "required": "", + }, + "id": "2a61c71a-74f6-4963-8850-9289e852f604", + }, + { + "type": "text_markup", + "value": "

D. Rationale and appropriateness consideration

", + "id": "3fc9be9f-8cd3-42b8-acc1-542bca210d48", + }, + { + "type": "score", + "value": { + "field_label": "Rationale and appropriateness", + "help_text": "", + "required": "", + }, + "id": "0d1bf533-968c-44b9-bb30-d437ae039474", + }, + { + "type": "text_markup", + "value": "

E. General recommendation

", + "id": "ef4a3bab-2293-4021-9e2c-57e1d78f6237", + }, + { + "type": "recommendation", + "value": { + "field_label": "Recommendation", + "help_text": "", + "info": None, + }, + "id": "4bf80578-1c8f-4515-9d6a-e52e87629e3e", + }, + { + "type": "comments", + "value": { + "field_label": "Recommendation comments", + "help_text": "", + "info": None, + }, + "id": "a814d7ac-8291-4f3e-b733-4a9a4f1f8a49", + }, ] - proposal_review_form, _ = ReviewForm.objects.get_or_create(name='Proposal review', defaults={'form_fields': json.dumps(data4)}) + proposal_review_form, _ = ReviewForm.objects.get_or_create( + name="Proposal review", defaults={"form_fields": json.dumps(data4)} + ) return proposal_review_form - def create_concept_note_fund_type(self, application_form, proposal_form, application_review_form, proposal_review_form): + def create_concept_note_fund_type( + self, + application_form, + proposal_form, + application_review_form, + proposal_review_form, + ): try: fund = FundType.objects.get(title=CN_FUND_TITLE) except FundType.DoesNotExist: apply_home = ApplyHomePage.objects.first() - fund = FundType(title=CN_FUND_TITLE, workflow_name='double') + fund = FundType(title=CN_FUND_TITLE, workflow_name="double") apply_home.add_child(instance=fund) - fund_form = ApplicationBaseForm.objects.create(application=fund, form=application_form) - fund_form2 = ApplicationBaseForm.objects.create(application=fund, form=proposal_form) + fund_form = ApplicationBaseForm.objects.create( + application=fund, form=application_form + ) + fund_form2 = ApplicationBaseForm.objects.create( + application=fund, form=proposal_form + ) fund.forms = [fund_form, fund_form2] - fund_review_form = ApplicationBaseReviewForm.objects.create(application=fund, form=application_review_form) - fund_review_form2 = ApplicationBaseReviewForm.objects.create(application=fund, form=proposal_review_form) + fund_review_form = ApplicationBaseReviewForm.objects.create( + application=fund, form=application_review_form + ) + fund_review_form2 = ApplicationBaseReviewForm.objects.create( + application=fund, form=proposal_review_form + ) fund.review_forms = [fund_review_form, fund_review_form2] fund.save() @@ -232,7 +1104,7 @@ def create_concept_note_round(self, fund): lead=lead, # The date of the original Internet Freedom Fund request type start_date=date(2013, 1, 1), - end_date=date(2018, 8, 29) + end_date=date(2018, 8, 29), ) round.parent_page = fund fund.add_child(instance=round) diff --git a/hypha/apply/funds/management/commands/seed_fellowship.py b/hypha/apply/funds/management/commands/seed_fellowship.py index a7b1439ea5..7cb82ee9fb 100644 --- a/hypha/apply/funds/management/commands/seed_fellowship.py +++ b/hypha/apply/funds/management/commands/seed_fellowship.py @@ -15,8 +15,8 @@ from hypha.apply.review.models import ReviewForm from hypha.apply.users.groups import STAFF_GROUP_NAME -FS_ROUND_TITLE = 'Fellowship (archive round)' -FS_FUND_TITLE = 'Fellowship (archive fund)' +FS_ROUND_TITLE = "Fellowship (archive round)" +FS_FUND_TITLE = "Fellowship (archive fund)" class Command(BaseCommand): @@ -26,137 +26,635 @@ class Command(BaseCommand): def handle(self, *args, **options): # There's an Internet Freedom Fund open round, so bail out. Avoids duplicate command runs. if Round.objects.filter(title=FS_ROUND_TITLE).count(): - self.stdout.write(self.style.WARNING('Skipping. The target Round/Fund Type and Application Form exist')) + self.stdout.write( + self.style.WARNING( + "Skipping. The target Round/Fund Type and Application Form exist" + ) + ) return application_form = self.create_fellowship_application_form() proposal_form = self.create_fellowship_proposal_form() application_review_form = self.create_fellowship_application_review_form() proposal_review_form = self.create_fellowship_proposal_review_form() - fund = self.create_fellowship_fund_type(application_form, proposal_form, application_review_form, proposal_review_form) + fund = self.create_fellowship_fund_type( + application_form, + proposal_form, + application_review_form, + proposal_review_form, + ) self.create_fellowship_round(fund) def create_fellowship_application_form(self): - - focus_id = Category.objects.get(name='Focus').id - objectives_id = Category.objects.get(name='Objective(s)').id - beneficiaries_id = Category.objects.get(name='Beneficiaries').id - regions_id = Category.objects.get(name='Region(s)').id - addressed_id = Category.objects.get(name='Addressed problems').id - status_id = Category.objects.get(name='Project status').id + focus_id = Category.objects.get(name="Focus").id + objectives_id = Category.objects.get(name="Objective(s)").id + beneficiaries_id = Category.objects.get(name="Beneficiaries").id + regions_id = Category.objects.get(name="Region(s)").id + addressed_id = Category.objects.get(name="Addressed problems").id + status_id = Category.objects.get(name="Project status").id data = [ - {"type": "text_markup", "value": "

About you

", "id": "ef672ec5-f24c-4e95-9f18-522a5a1e6833"}, - {"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"}, - {"type": "dropdown", "value": {"field_label": "Have you ever applied or received funding through an OTF fellowship program?", "help_text": "", "required": "", "choices": ["Yes", "No"]}, "id": "f8efef0a-0632-4c81-b4db-7bc6a06caa7d"}, - {"type": "text_markup", "value": "

About your project

", "id": "3541d1b1-afc7-4dcd-8ed9-e9af27de5f3d"}, - {"type": "rich_text", "value": {"field_label": "What is your project idea?", "help_text": "", "required": "", "default_value": ""}, "id": "1eb8b4e3-e2bb-4810-a8ce-3fc82a3192c8"}, - {"type": "rich_text", "value": {"field_label": "How would you do it?", "help_text": "", "required": "", "default_value": ""}, "id": "177d56e8-2df1-4ead-8e3d-4916610fbed6"}, - {"type": "rich_text", "value": {"field_label": "Why are you the right person for this project?", "help_text": "", "required": "", "default_value": ""}, "id": "05ff1755-947b-4e41-8f71-aae99977c572"}, - {"type": "duration", "value": {"field_label": "How long do you want to work on this fellowship?", "help_text": "", "info": None}, "id": "3ccac109-2839-4b5d-b133-0e6cfca7c766"}, - {"type": "text_markup", "value": "

Host organization

", "id": "f4b3ae6f-a1d6-4c9d-b334-e40614167257"}, - {"type": "char", "value": {"field_label": "What is your most ideal host organization?", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "0afaf4e1-4556-4e79-aa3d-4990e33620da"}, - {"type": "char", "value": {"field_label": "What is your next best host organization?", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "a543b34f-ae6a-4b17-8ac3-ececc14573a0"}, - {"type": "text_markup", "value": "

Request specific questions

", "id": "755363fa-6a1c-422f-a03f-89db07a96e17"}, - {"type": "rich_text", "value": {"field_label": "Request specific questions", "help_text": "", "required": "", "default_value": ""}, "id": "57cc52e2-b3ff-4e9f-a5fe-42e7735e16c2"}, - {"type": "text_markup", "value": "

Descriptors

", "id": "b6ee65b3-d5cd-4cb0-9d7c-6e29d86deaaf"}, - {"type": "category", "value": {"field_label": "Status", "help_text": "", "required": "", "category": status_id, "multi": "true"}, "id": "ff4d12ff-7b88-4e87-bb5b-81543aef0e25"}, - {"type": "category", "value": {"field_label": "Objectives", "help_text": "", "required": "true", "category": objectives_id, "multi": "true"}, "id": "30c41288-a762-4003-acce-8c12e7343d90"}, - {"type": "category", "value": {"field_label": "Beneficiaries", "help_text": "", "required": "", "category": beneficiaries_id, "multi": "true"}, "id": "56833441-542b-4a06-8ad2-8e7e8fd1a334"}, - {"type": "category", "value": {"field_label": "Focus", "help_text": "", "required": "", "category": focus_id, "multi": "true"}, "id": "6b404851-ce2b-494f-b9f7-62858a937469"}, - {"type": "category", "value": {"field_label": "Addressed problems", "help_text": "", "required": "true", "category": addressed_id, "multi": "true"}, "id": "590e4b77-c4f4-4bd0-b5be-2ad2851da4f5"}, - {"type": "category", "value": {"field_label": "Region", "help_text": "", "required": "", "category": regions_id, "multi": "true"}, "id": "81c01278-8ba4-4d84-a1da-e05a07aad874"}, - {"type": "multi_file", "value": {"field_label": "Upload", "help_text": "", "required": ""}, "id": "25740b9d-0f8f-4ce1-88fa-c6ee831c6aef"}, - {"type": "text_markup", "value": "

I acknowledge

", "id": "f69d3a56-491a-4321-89b7-4d7e34d69a1d"}, - {"type": "checkbox", "value": {"field_label": "My application will be dismissed if it does not fit within OTF\'s mission, values, principles statements.", "help_text": "", "default_value": ""}, "id": "5178e15f-d442-4d36-824d-a4292ef77062"}, - {"type": "text_markup", "value": "Read our mission, values, and principles.", "id": "b0c69627-d7db-4633-b46f-0e787dddc779"}, - {"type": "checkbox", "value": {"field_label": "I have read and understand OTF\'s Terms and Privacy policy.", "help_text": "", "default_value": ""}, "id": "bd91e220-4cdb-4392-8054-7b7dfe667d46"}, - {"type": "text_markup", "value": "Read the Terms and Privacy policy.", "id": "6f6236fd-9d1d-4090-a819-72fb96205bc0"}, - {"type": "checkbox", "value": {"field_label": "I am legally able to sign contracts or represent an organization that can.", "help_text": "", "default_value": ""}, "id": "8d000129-ca8b-48cf-8dc2-4651bcbe46e8"}, - {"type": "checkbox", "value": {"field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", "help_text": "", "default_value": ""}, "id": "92f0801e-b9dc-4edc-9716-3f1709ae1c9b"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", "help_text": "", "default_value": ""}, "id": "3a3f2da3-4e32-4b86-9060-29c606927114"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", "help_text": "", "default_value": ""}, "id": "19395179-ed9f-4556-9b6b-ab5caef4f610"}, - {"type": "text_markup", "value": "

I would like to

", "id": "21c9a554-d0d2-4543-9ca5-f53e506fb7c4"}, - {"type": "checkbox", "value": {"field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc).", "help_text": "", "default_value": ""}, "id": "1345a8eb-4dcc-4170-a5ac-edda42d4dafc"}, - {"type": "checkbox", "value": {"field_label": "Sign up for OTF\'s daily newsletter (collection of news related to global internet freedom).", "help_text": "", "default_value": ""}, "id": "4ca22ebb-daba-4fb6-a4a6-b130dc6311a8"} + { + "type": "text_markup", + "value": "

About you

", + "id": "ef672ec5-f24c-4e95-9f18-522a5a1e6833", + }, + { + "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", + }, + { + "type": "dropdown", + "value": { + "field_label": "Have you ever applied or received funding through an OTF fellowship program?", + "help_text": "", + "required": "", + "choices": ["Yes", "No"], + }, + "id": "f8efef0a-0632-4c81-b4db-7bc6a06caa7d", + }, + { + "type": "text_markup", + "value": "

About your project

", + "id": "3541d1b1-afc7-4dcd-8ed9-e9af27de5f3d", + }, + { + "type": "rich_text", + "value": { + "field_label": "What is your project idea?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "1eb8b4e3-e2bb-4810-a8ce-3fc82a3192c8", + }, + { + "type": "rich_text", + "value": { + "field_label": "How would you do it?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "177d56e8-2df1-4ead-8e3d-4916610fbed6", + }, + { + "type": "rich_text", + "value": { + "field_label": "Why are you the right person for this project?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "05ff1755-947b-4e41-8f71-aae99977c572", + }, + { + "type": "duration", + "value": { + "field_label": "How long do you want to work on this fellowship?", + "help_text": "", + "info": None, + }, + "id": "3ccac109-2839-4b5d-b133-0e6cfca7c766", + }, + { + "type": "text_markup", + "value": "

Host organization

", + "id": "f4b3ae6f-a1d6-4c9d-b334-e40614167257", + }, + { + "type": "char", + "value": { + "field_label": "What is your most ideal host organization?", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "0afaf4e1-4556-4e79-aa3d-4990e33620da", + }, + { + "type": "char", + "value": { + "field_label": "What is your next best host organization?", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "a543b34f-ae6a-4b17-8ac3-ececc14573a0", + }, + { + "type": "text_markup", + "value": "

Request specific questions

", + "id": "755363fa-6a1c-422f-a03f-89db07a96e17", + }, + { + "type": "rich_text", + "value": { + "field_label": "Request specific questions", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "57cc52e2-b3ff-4e9f-a5fe-42e7735e16c2", + }, + { + "type": "text_markup", + "value": "

Descriptors

", + "id": "b6ee65b3-d5cd-4cb0-9d7c-6e29d86deaaf", + }, + { + "type": "category", + "value": { + "field_label": "Status", + "help_text": "", + "required": "", + "category": status_id, + "multi": "true", + }, + "id": "ff4d12ff-7b88-4e87-bb5b-81543aef0e25", + }, + { + "type": "category", + "value": { + "field_label": "Objectives", + "help_text": "", + "required": "true", + "category": objectives_id, + "multi": "true", + }, + "id": "30c41288-a762-4003-acce-8c12e7343d90", + }, + { + "type": "category", + "value": { + "field_label": "Beneficiaries", + "help_text": "", + "required": "", + "category": beneficiaries_id, + "multi": "true", + }, + "id": "56833441-542b-4a06-8ad2-8e7e8fd1a334", + }, + { + "type": "category", + "value": { + "field_label": "Focus", + "help_text": "", + "required": "", + "category": focus_id, + "multi": "true", + }, + "id": "6b404851-ce2b-494f-b9f7-62858a937469", + }, + { + "type": "category", + "value": { + "field_label": "Addressed problems", + "help_text": "", + "required": "true", + "category": addressed_id, + "multi": "true", + }, + "id": "590e4b77-c4f4-4bd0-b5be-2ad2851da4f5", + }, + { + "type": "category", + "value": { + "field_label": "Region", + "help_text": "", + "required": "", + "category": regions_id, + "multi": "true", + }, + "id": "81c01278-8ba4-4d84-a1da-e05a07aad874", + }, + { + "type": "multi_file", + "value": {"field_label": "Upload", "help_text": "", "required": ""}, + "id": "25740b9d-0f8f-4ce1-88fa-c6ee831c6aef", + }, + { + "type": "text_markup", + "value": "

I acknowledge

", + "id": "f69d3a56-491a-4321-89b7-4d7e34d69a1d", + }, + { + "type": "checkbox", + "value": { + "field_label": "My application will be dismissed if it does not fit within OTF's mission, values, principles statements.", + "help_text": "", + "default_value": "", + }, + "id": "5178e15f-d442-4d36-824d-a4292ef77062", + }, + { + "type": "text_markup", + "value": 'Read our mission, values, and principles.', + "id": "b0c69627-d7db-4633-b46f-0e787dddc779", + }, + { + "type": "checkbox", + "value": { + "field_label": "I have read and understand OTF's Terms and Privacy policy.", + "help_text": "", + "default_value": "", + }, + "id": "bd91e220-4cdb-4392-8054-7b7dfe667d46", + }, + { + "type": "text_markup", + "value": 'Read the Terms and Privacy policy.', + "id": "6f6236fd-9d1d-4090-a819-72fb96205bc0", + }, + { + "type": "checkbox", + "value": { + "field_label": "I am legally able to sign contracts or represent an organization that can.", + "help_text": "", + "default_value": "", + }, + "id": "8d000129-ca8b-48cf-8dc2-4651bcbe46e8", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", + "help_text": "", + "default_value": "", + }, + "id": "92f0801e-b9dc-4edc-9716-3f1709ae1c9b", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", + "help_text": "", + "default_value": "", + }, + "id": "3a3f2da3-4e32-4b86-9060-29c606927114", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", + "help_text": "", + "default_value": "", + }, + "id": "19395179-ed9f-4556-9b6b-ab5caef4f610", + }, + { + "type": "text_markup", + "value": "

I would like to

", + "id": "21c9a554-d0d2-4543-9ca5-f53e506fb7c4", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc).", + "help_text": "", + "default_value": "", + }, + "id": "1345a8eb-4dcc-4170-a5ac-edda42d4dafc", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up for OTF's daily newsletter (collection of news related to global internet freedom).", + "help_text": "", + "default_value": "", + }, + "id": "4ca22ebb-daba-4fb6-a4a6-b130dc6311a8", + }, ] - application_form, _ = ApplicationForm.objects.get_or_create(name='Fellowship application', defaults={'form_fields': json.dumps(data)}) + application_form, _ = ApplicationForm.objects.get_or_create( + name="Fellowship application", defaults={"form_fields": json.dumps(data)} + ) return application_form def create_fellowship_proposal_form(self): - data2 = [ {"type": "text_markup", "value": "

Proposal information

", "id": ""}, - {"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"}, - {"type": "date", "value": {"field_label": "Start date", "help_text": "", "required": "", "default_value": ""}, "id": "672cb6f1-335c-4005-a0f1-46c414feda06"}, - {"type": "date", "value": {"field_label": "Completion date", "help_text": "", "required": "", "default_value": ""}, "id": "8262f209-f084-4a79-9dfa-2d18137119bb"}, - {"type": "rich_text", "value": {"field_label": "Objectives", "help_text": "", "required": "", "default_value": ""}, "id": "af2c5f38-7257-4295-87fa-787060e845ef"}, - {"type": "rich_text", "value": {"field_label": "Milestones and dates", "help_text": "", "required": "", "default_value": ""}, "id": "3c521847-7642-4cae-aca9-d5336ad8962d"}, - {"type": "rich_text", "value": {"field_label": "Anticipated outputs and outcomes", "help_text": "", "required": "", "default_value": ""}, "id": "fd0eb7ea-e054-4bcf-9580-eb672d44745c"}, - {"type": "text_markup", "value": "

Request specific questions

", "id": "b05a54d1-3a59-41d1-bb70-d5f0f0acd67d"}, - {"type": "rich_text", "value": {"field_label": "Request specific questions", "help_text": "", "required": "", "default_value": ""}, "id": "b6d71932-98c2-4ce8-a5e6-454a1f800d21"}, - {"type": "multi_file", "value": {"field_label": "Upload", "help_text": "", "required": ""}, "id": "30dfa46e-f656-46c9-9efc-bab9029f2008"} + { + "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", + }, + { + "type": "date", + "value": { + "field_label": "Start date", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "672cb6f1-335c-4005-a0f1-46c414feda06", + }, + { + "type": "date", + "value": { + "field_label": "Completion date", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "8262f209-f084-4a79-9dfa-2d18137119bb", + }, + { + "type": "rich_text", + "value": { + "field_label": "Objectives", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "af2c5f38-7257-4295-87fa-787060e845ef", + }, + { + "type": "rich_text", + "value": { + "field_label": "Milestones and dates", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "3c521847-7642-4cae-aca9-d5336ad8962d", + }, + { + "type": "rich_text", + "value": { + "field_label": "Anticipated outputs and outcomes", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "fd0eb7ea-e054-4bcf-9580-eb672d44745c", + }, + { + "type": "text_markup", + "value": "

Request specific questions

", + "id": "b05a54d1-3a59-41d1-bb70-d5f0f0acd67d", + }, + { + "type": "rich_text", + "value": { + "field_label": "Request specific questions", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "b6d71932-98c2-4ce8-a5e6-454a1f800d21", + }, + { + "type": "multi_file", + "value": {"field_label": "Upload", "help_text": "", "required": ""}, + "id": "30dfa46e-f656-46c9-9efc-bab9029f2008", + }, ] - proposal_form, _ = ApplicationForm.objects.get_or_create(name='Fellowship proposal', defaults={'form_fields': json.dumps(data2)}) + proposal_form, _ = ApplicationForm.objects.get_or_create( + name="Fellowship proposal", defaults={"form_fields": json.dumps(data2)} + ) return proposal_form def create_fellowship_application_review_form(self): - data3 = [ - {"type": "recommendation", "value": {"field_label": "Overall, do you think we should select this applicant and their project to be part of the fellowship program?", "help_text": "", "info": None}, "id": "56264b32-fa39-4c08-b41e-68e9c54b2712"}, - {"type": "rich_text", "value": {"field_label": "If no, please select a reason why not.", "help_text": "", "required": "", "default_value": ""}, "id": "f0533950-57f5-4bb7-81ec-2d3813490c88"}, - {"type": "rich_text", "value": {"field_label": "Request specific questions", "help_text": "", "required": "", "default_value": ""}, "id": "ba789376-e3f9-434e-8da5-330811723b30"}, - {"type": "comments", "value": {"field_label": "Other comments", "help_text": "", "info": None}, "id": "e74e2581-d06c-43b1-9c0b-911407225834"} + { + "type": "recommendation", + "value": { + "field_label": "Overall, do you think we should select this applicant and their project to be part of the fellowship program?", + "help_text": "", + "info": None, + }, + "id": "56264b32-fa39-4c08-b41e-68e9c54b2712", + }, + { + "type": "rich_text", + "value": { + "field_label": "If no, please select a reason why not.", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "f0533950-57f5-4bb7-81ec-2d3813490c88", + }, + { + "type": "rich_text", + "value": { + "field_label": "Request specific questions", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "ba789376-e3f9-434e-8da5-330811723b30", + }, + { + "type": "comments", + "value": { + "field_label": "Other comments", + "help_text": "", + "info": None, + }, + "id": "e74e2581-d06c-43b1-9c0b-911407225834", + }, ] - application_review_form, _ = ReviewForm.objects.get_or_create(name='Fellowship application review', defaults={'form_fields': json.dumps(data3)}) + application_review_form, _ = ReviewForm.objects.get_or_create( + name="Fellowship application review", + defaults={"form_fields": json.dumps(data3)}, + ) return application_review_form def create_fellowship_proposal_review_form(self): - data4 = [ - {"type": "recommendation", "value": {"field_label": "Overall, do you think we should select this applicant and their project to be part of the fellowship program?", "help_text": "", "info": None}, "id": "e1ea4f9d-64e2-4f28-a68a-851ec0f2d9ad"}, - {"type": "rich_text", "value": {"field_label": "If no, please select a reason why not.", "help_text": "", "required": "", "default_value": ""}, "id": "e68b6fe9-8b11-4cf0-8ae4-2ffed75e1e80"}, - {"type": "rich_text", "value": {"field_label": "If yes, but you believe some changes need to be made to the proposed effort, please let us know.", "help_text": "", "required": "", "default_value": ""}, "id": "a413f3a2-b486-4bf3-9e2d-c48d19626876"}, - {"type": "rich_text", "value": {"field_label": "Request specific questions", "help_text": "", "required": "", "default_value": ""}, "id": "536c963a-f183-45bc-b83f-458b46dc5542"}, - {"type": "comments", "value": {"field_label": "Anything else you'd like to give us feedback on?", "help_text": "", "info": None}, "id": "cc82ba7b-b55e-4309-85f0-f68ad6f43471"} + { + "type": "recommendation", + "value": { + "field_label": "Overall, do you think we should select this applicant and their project to be part of the fellowship program?", + "help_text": "", + "info": None, + }, + "id": "e1ea4f9d-64e2-4f28-a68a-851ec0f2d9ad", + }, + { + "type": "rich_text", + "value": { + "field_label": "If no, please select a reason why not.", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "e68b6fe9-8b11-4cf0-8ae4-2ffed75e1e80", + }, + { + "type": "rich_text", + "value": { + "field_label": "If yes, but you believe some changes need to be made to the proposed effort, please let us know.", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "a413f3a2-b486-4bf3-9e2d-c48d19626876", + }, + { + "type": "rich_text", + "value": { + "field_label": "Request specific questions", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "536c963a-f183-45bc-b83f-458b46dc5542", + }, + { + "type": "comments", + "value": { + "field_label": "Anything else you'd like to give us feedback on?", + "help_text": "", + "info": None, + }, + "id": "cc82ba7b-b55e-4309-85f0-f68ad6f43471", + }, ] - proposal_review_form, _ = ReviewForm.objects.get_or_create(name='Fellowship proposal review', defaults={'form_fields': json.dumps(data4)}) + proposal_review_form, _ = ReviewForm.objects.get_or_create( + name="Fellowship proposal review", + defaults={"form_fields": json.dumps(data4)}, + ) return proposal_review_form - def create_fellowship_fund_type(self, application_form, proposal_form, application_review_form, proposal_review_form): + def create_fellowship_fund_type( + self, + application_form, + proposal_form, + application_review_form, + proposal_review_form, + ): try: fund = FundType.objects.get(title=FS_FUND_TITLE) except FundType.DoesNotExist: apply_home = ApplyHomePage.objects.first() - fund = FundType(title=FS_FUND_TITLE, workflow_name='double') + fund = FundType(title=FS_FUND_TITLE, workflow_name="double") apply_home.add_child(instance=fund) - fund_form = ApplicationBaseForm.objects.create(application=fund, form=application_form) - fund_form2 = ApplicationBaseForm.objects.create(application=fund, form=proposal_form) + fund_form = ApplicationBaseForm.objects.create( + application=fund, form=application_form + ) + fund_form2 = ApplicationBaseForm.objects.create( + application=fund, form=proposal_form + ) fund.forms = [fund_form, fund_form2] - fund_review_form = ApplicationBaseReviewForm.objects.create(application=fund, form=application_review_form) - fund_review_form2 = ApplicationBaseReviewForm.objects.create(application=fund, form=proposal_review_form) + fund_review_form = ApplicationBaseReviewForm.objects.create( + application=fund, form=application_review_form + ) + fund_review_form2 = ApplicationBaseReviewForm.objects.create( + application=fund, form=proposal_review_form + ) fund.review_forms = [fund_review_form, fund_review_form2] fund.save() @@ -175,7 +673,7 @@ def create_fellowship_round(self, fund): lead=lead, # The date of the original Information Controls Fellowship request type start_date=date(2013, 1, 1), - end_date=date(2018, 8, 29) + end_date=date(2018, 8, 29), ) round.parent_page = fund fund.add_child(instance=round) diff --git a/hypha/apply/funds/management/commands/seed_rapid_response.py b/hypha/apply/funds/management/commands/seed_rapid_response.py index 93f56f9651..097c4f4c26 100644 --- a/hypha/apply/funds/management/commands/seed_rapid_response.py +++ b/hypha/apply/funds/management/commands/seed_rapid_response.py @@ -15,8 +15,8 @@ from hypha.apply.review.models import ReviewForm from hypha.apply.users.groups import STAFF_GROUP_NAME -RR_ROUND_TITLE = 'Rapid Response (archive round)' -RR_FUND_TITLE = 'Rapid Response (archive fund)' +RR_ROUND_TITLE = "Rapid Response (archive round)" +RR_FUND_TITLE = "Rapid Response (archive fund)" class Command(BaseCommand): @@ -26,100 +26,521 @@ class Command(BaseCommand): def handle(self, *args, **options): # There's an RR open round, so bail out. Avoids duplicate command runs. if Round.objects.filter(title=RR_ROUND_TITLE).count(): - self.stdout.write(self.style.WARNING('Skipping. The target Round/Fund Type and Application Form exist')) + self.stdout.write( + self.style.WARNING( + "Skipping. The target Round/Fund Type and Application Form exist" + ) + ) return application_form = self.create_rapid_response_form() application_review_form = self.create_rapid_response_review_form() - fund = self.create_rapid_response_fund_type(application_form, application_review_form) + fund = self.create_rapid_response_fund_type( + application_form, application_review_form + ) self.create_rapid_response_round(fund) def create_rapid_response_form(self): - - focus_id = Category.objects.get(name='Focus').id - objectives_id = Category.objects.get(name='Objective(s)').id - beneficiaries_id = Category.objects.get(name='Beneficiaries').id - regions_id = Category.objects.get(name='Region(s)').id - addressed_id = Category.objects.get(name='Addressed problems').id + focus_id = Category.objects.get(name="Focus").id + objectives_id = Category.objects.get(name="Objective(s)").id + beneficiaries_id = Category.objects.get(name="Beneficiaries").id + regions_id = Category.objects.get(name="Region(s)").id + addressed_id = Category.objects.get(name="Addressed problems").id data = [ - {"type": "text_markup", "value": "

Basic information

", "id": "a96e8d83-edfc-42d2-a02a-c4f72cb94b84"}, - {"type": "title", "value": {"field_label": "What is your project name?", "help_text": "", "info": None}, "id": "09d320bc-9c20-4795-8823-54cab9cc6eaf"}, - {"type": "full_name", "value": {"field_label": "Your name", "help_text": "", "info": None}, "id": "a3580ace-11c4-4b79-bc5d-2445414782b7"}, - {"type": "email", "value": {"field_label": "E-mail", "help_text": "", "info": None}, "id": "14cda1f7-4553-43c6-9f09-944285246fbf"}, - {"type": "dropdown", "value": {"field_label": "Have you ever applied to or received funding as an OTF project or fellow?", "help_text": "", "required": "true", "choices": ["Yes", "No"]}, "id": "49a0f5f4-e8e9-4dfc-8575-205ee9675032"}, - {"type": "text_markup", "value": "

More information about your project

", "id": "37657bd3-04b0-4dbb-af2d-63065c349f82"}, - {"type": "radios", "value": {"field_label": "What are you applying for?", "help_text": "", "required": "true", "choices": ["Direct funding", "Requesting to receive services", "Requesting to provide services"]}, "id": "c1277029-1718-40e3-8bf5-d80ece7fd343"}, - {"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": "dropdown", "value": {"field_label": "If you are requesting to receive or provide a service, what is it?", "help_text": "", "required": "", "choices": ["Audit of presumably compromised websites", "DDoS response and mitigation", "Secure web hosting", "monitoring and resiliency of websites during special events (elections, campaigns etc.)", "VPN connections", "Safe internet connections", "Forensic analysis of digital attacks", "Recovery of compromised websites", "Malware analysis", "Equipment replacements", "Finding legal representation", "Payment of legal fees"]}, "id": "ebdf9a22-58c7-4bd6-a58d-e71363357470"}, - {"type": "rich_text", "value": {"field_label": "If not listed above, what other services do you want to provide or receive?", "help_text": "", "required": "", "default_value": ""}, "id": "c8c329c7-78e4-4cbf-a3b1-77a1324e92ff"}, - {"type": "duration", "value": {"field_label": "How long will it take?", "help_text": "", "info": None}, "id": "b47f84f5-81bc-4aff-a865-5b927f504246"}, - {"type": "rich_text", "value": {"field_label": "What is the challenge you are trying to address and who will it help?", "help_text": "Please briefly provide contextual or background information regarding the problem you would like to address and the target groups/communities you are trying to help.", "required": "true", "default_value": ""}, "id": "1ec16cdc-7a68-40be-b17b-9a218def4260"}, - {"type": "rich_text", "value": {"field_label": "What are you proposing to do and how will you accomplish it?", "help_text": "In other words, please describe your project\u2019s overall goal as well as specific objectives. What activities are you going to carry out in order to achieve your objectives?", "required": "true", "default_value": ""}, "id": "4fa2ac11-d1cd-4d23-8082-93a14c8f99c8"}, - {"type": "rich_text", "value": {"field_label": "Anticipated outputs and outcomes", "help_text": "", "required": "true", "default_value": ""}, "id": "3cde39ae-b687-4c4f-b58b-849396c2fdb8"}, - {"type": "rich_text", "value": {"field_label": "Timeline", "help_text": "", "required": "true", "default_value": ""}, "id": "0b2a4653-b390-44a6-b92e-fae4647e7ec4"}, - {"type": "rich_text", "value": {"field_label": "How does this project fit into OTF\u2019s Rapid Response remit?", "help_text": "", "required": "true", "default_value": ""}, "id": "6d75e412-cf53-4833-9f1d-3e0126512fb9"}, - {"type": "text_markup", "value": "Open the Rapid Response Fund remit in a new window.", "id": "85d6c115-8d06-4a52-95cf-0e9096633bf0"}, - {"type": "rich_text", "value": {"field_label": "Why does it have to happen immediately or within the next few months?", "help_text": "", "required": "true", "default_value": ""}, "id": "1b181d1e-ef91-41af-b9c1-d096a991314b"}, - {"type": "category", "value": {"field_label": "Focus", "help_text": "", "required": "", "category": focus_id, "multi": "true"}, "id": "efd91eaf-378f-4aab-96cb-c5601155cbee"}, - {"type": "category", "value": {"field_label": "Objectives", "help_text": "", "required": "true", "category": objectives_id, "multi": "true"}, "id": "4be0c7bd-231d-4d9f-bd47-8589fc005f54"}, - {"type": "category", "value": {"field_label": "Beneficiaries", "help_text": "", "required": "true", "category": beneficiaries_id, "multi": "true"}, "id": "6e0293ee-218e-4c3b-b82d-5bf91fdb21c9"}, - {"type": "category", "value": {"field_label": "Regions", "help_text": "", "required": "true", "category": regions_id, "multi": "true"}, "id": "6ff029c6-c6d1-4c37-a49a-46181b1cd33d"}, - {"type": "category", "value": {"field_label": "Addressed problems", "help_text": "", "required": "true", "category": addressed_id, "multi": "true"}, "id": "7fb1001e-d458-414f-a5bb-006db6f89baf"}, - {"type": "rich_text", "value": {"field_label": "Budget", "help_text": "", "required": "true", "default_value": ""}, "id": "45d7d38a-9c9d-4c43-98df-bb95d4a1dd77"}, - {"type": "text_markup", "value": "

Legal information for the contract

", "id": "29432dd7-d5d8-42e7-8d54-3b45c576dd7d"}, - {"type": "char", "value": {"field_label": "Legal name", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "632065c5-860f-4751-9b31-52914d7c6448"}, - {"type": "char", "value": {"field_label": "Primary point of contact", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "13bb0d64-65f3-4340-8e7e-e5da80d706d5"}, - {"type": "char", "value": {"field_label": "Phone", "help_text": "", "required": "", "format": "", "default_value": ""}, "id": "2cb9fe4b-df45-4181-80e5-14382f853081"}, - {"type": "address", "value": {"field_label": "Address", "help_text": "", "info": None}, "id": "bd29eb88-9754-4305-9b2d-406a875ec56a"}, - {"type": "rich_text", "value": {"field_label": "Request specific questions", "help_text": "", "required": "", "default_value": ""}, "id": "1889de86-0a0d-4abf-9916-4db87a499d35"}, - {"type": "multi_file", "value": {"field_label": "Upload", "help_text": "", "required": ""}, "id": "607daeba-1f33-4ad0-b135-eda743ba8e3a"}, - {"type": "text_markup", "value": "

I acknowledge

", "id": "5688ddc7-0397-41e7-9e6b-2c0fe44f42aa"}, - {"type": "checkbox", "value": {"field_label": "My application will be dismissed if it does not fit within OTF\'s mission, values, principles statements.", "help_text": "", "required": "true", "default_value": ""}, "id": "e695f0d7-4c74-4cc6-853f-bd62ecd19d3d"}, - {"type": "text_markup", "value": "Read our mission, values, and principles.", "id": "051be067-d45a-4bc3-8016-a09dadd734f5"}, - {"type": "checkbox", "value": {"field_label": "I have read and understand OTF\'s Terms and Privacy policy.", "help_text": "", "required": "true", "default_value": ""}, "id": "f40d1acc-d802-4cc6-b0e9-fff78dc54223"}, - {"type": "text_markup", "value": "Read the Terms and Privacy policy.", "id": "bcf64886-df76-41d2-9a22-fb7e49a7718c"}, - {"type": "checkbox", "value": {"field_label": "I am legally able to sign contracts or represent an organization that can.", "help_text": "", "required": "true", "default_value": ""}, "id": "0b3c0827-38e2-439b-bca5-735835af1019"}, - {"type": "checkbox", "value": {"field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", "help_text": "", "required": "true", "default_value": ""}, "id": "bc9c960e-a6f4-4bc2-b626-efb5bc5552c6"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", "help_text": "", "required": "true", "default_value": ""}, "id": "5812b66d-630e-4ca2-8bea-819084278f55"}, - {"type": "checkbox", "value": {"field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", "help_text": "", "required": "true", "default_value": ""}, "id": "97d3746c-cf0f-449a-b3a3-7a9cdd45cc6d"}, - {"type": "text_markup", "value": "

I would like to

", "id": "e99c9dbe-f788-4eb2-813d-1787c0871210"}, - {"type": "checkbox", "value": {"field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc)", "help_text": "", "required": "true", "default_value": ""}, "id": "fc3d2a87-1151-418b-b1cd-9289f00bde35"}, - {"type": "checkbox", "value": {"field_label": "Sign up for OTF\'s daily newsletter (collection of news related to global internet freedom).", "help_text": "", "required": "true", "default_value": ""}, "id": "83ecc69a-f47c-495e-bc8f-326e55aed67a"} + { + "type": "text_markup", + "value": "

Basic information

", + "id": "a96e8d83-edfc-42d2-a02a-c4f72cb94b84", + }, + { + "type": "title", + "value": { + "field_label": "What is your project name?", + "help_text": "", + "info": None, + }, + "id": "09d320bc-9c20-4795-8823-54cab9cc6eaf", + }, + { + "type": "full_name", + "value": {"field_label": "Your name", "help_text": "", "info": None}, + "id": "a3580ace-11c4-4b79-bc5d-2445414782b7", + }, + { + "type": "email", + "value": {"field_label": "E-mail", "help_text": "", "info": None}, + "id": "14cda1f7-4553-43c6-9f09-944285246fbf", + }, + { + "type": "dropdown", + "value": { + "field_label": "Have you ever applied to or received funding as an OTF project or fellow?", + "help_text": "", + "required": "true", + "choices": ["Yes", "No"], + }, + "id": "49a0f5f4-e8e9-4dfc-8575-205ee9675032", + }, + { + "type": "text_markup", + "value": "

More information about your project

", + "id": "37657bd3-04b0-4dbb-af2d-63065c349f82", + }, + { + "type": "radios", + "value": { + "field_label": "What are you applying for?", + "help_text": "", + "required": "true", + "choices": [ + "Direct funding", + "Requesting to receive services", + "Requesting to provide services", + ], + }, + "id": "c1277029-1718-40e3-8bf5-d80ece7fd343", + }, + { + "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": "dropdown", + "value": { + "field_label": "If you are requesting to receive or provide a service, what is it?", + "help_text": "", + "required": "", + "choices": [ + "Audit of presumably compromised websites", + "DDoS response and mitigation", + "Secure web hosting", + "monitoring and resiliency of websites during special events (elections, campaigns etc.)", + "VPN connections", + "Safe internet connections", + "Forensic analysis of digital attacks", + "Recovery of compromised websites", + "Malware analysis", + "Equipment replacements", + "Finding legal representation", + "Payment of legal fees", + ], + }, + "id": "ebdf9a22-58c7-4bd6-a58d-e71363357470", + }, + { + "type": "rich_text", + "value": { + "field_label": "If not listed above, what other services do you want to provide or receive?", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "c8c329c7-78e4-4cbf-a3b1-77a1324e92ff", + }, + { + "type": "duration", + "value": { + "field_label": "How long will it take?", + "help_text": "", + "info": None, + }, + "id": "b47f84f5-81bc-4aff-a865-5b927f504246", + }, + { + "type": "rich_text", + "value": { + "field_label": "What is the challenge you are trying to address and who will it help?", + "help_text": "Please briefly provide contextual or background information regarding the problem you would like to address and the target groups/communities you are trying to help.", + "required": "true", + "default_value": "", + }, + "id": "1ec16cdc-7a68-40be-b17b-9a218def4260", + }, + { + "type": "rich_text", + "value": { + "field_label": "What are you proposing to do and how will you accomplish it?", + "help_text": "In other words, please describe your project\u2019s overall goal as well as specific objectives. What activities are you going to carry out in order to achieve your objectives?", + "required": "true", + "default_value": "", + }, + "id": "4fa2ac11-d1cd-4d23-8082-93a14c8f99c8", + }, + { + "type": "rich_text", + "value": { + "field_label": "Anticipated outputs and outcomes", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "3cde39ae-b687-4c4f-b58b-849396c2fdb8", + }, + { + "type": "rich_text", + "value": { + "field_label": "Timeline", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "0b2a4653-b390-44a6-b92e-fae4647e7ec4", + }, + { + "type": "rich_text", + "value": { + "field_label": "How does this project fit into OTF\u2019s Rapid Response remit?", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "6d75e412-cf53-4833-9f1d-3e0126512fb9", + }, + { + "type": "text_markup", + "value": 'Open the Rapid Response Fund remit in a new window.', + "id": "85d6c115-8d06-4a52-95cf-0e9096633bf0", + }, + { + "type": "rich_text", + "value": { + "field_label": "Why does it have to happen immediately or within the next few months?", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "1b181d1e-ef91-41af-b9c1-d096a991314b", + }, + { + "type": "category", + "value": { + "field_label": "Focus", + "help_text": "", + "required": "", + "category": focus_id, + "multi": "true", + }, + "id": "efd91eaf-378f-4aab-96cb-c5601155cbee", + }, + { + "type": "category", + "value": { + "field_label": "Objectives", + "help_text": "", + "required": "true", + "category": objectives_id, + "multi": "true", + }, + "id": "4be0c7bd-231d-4d9f-bd47-8589fc005f54", + }, + { + "type": "category", + "value": { + "field_label": "Beneficiaries", + "help_text": "", + "required": "true", + "category": beneficiaries_id, + "multi": "true", + }, + "id": "6e0293ee-218e-4c3b-b82d-5bf91fdb21c9", + }, + { + "type": "category", + "value": { + "field_label": "Regions", + "help_text": "", + "required": "true", + "category": regions_id, + "multi": "true", + }, + "id": "6ff029c6-c6d1-4c37-a49a-46181b1cd33d", + }, + { + "type": "category", + "value": { + "field_label": "Addressed problems", + "help_text": "", + "required": "true", + "category": addressed_id, + "multi": "true", + }, + "id": "7fb1001e-d458-414f-a5bb-006db6f89baf", + }, + { + "type": "rich_text", + "value": { + "field_label": "Budget", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "45d7d38a-9c9d-4c43-98df-bb95d4a1dd77", + }, + { + "type": "text_markup", + "value": "

Legal information for the contract

", + "id": "29432dd7-d5d8-42e7-8d54-3b45c576dd7d", + }, + { + "type": "char", + "value": { + "field_label": "Legal name", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "632065c5-860f-4751-9b31-52914d7c6448", + }, + { + "type": "char", + "value": { + "field_label": "Primary point of contact", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "13bb0d64-65f3-4340-8e7e-e5da80d706d5", + }, + { + "type": "char", + "value": { + "field_label": "Phone", + "help_text": "", + "required": "", + "format": "", + "default_value": "", + }, + "id": "2cb9fe4b-df45-4181-80e5-14382f853081", + }, + { + "type": "address", + "value": {"field_label": "Address", "help_text": "", "info": None}, + "id": "bd29eb88-9754-4305-9b2d-406a875ec56a", + }, + { + "type": "rich_text", + "value": { + "field_label": "Request specific questions", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "1889de86-0a0d-4abf-9916-4db87a499d35", + }, + { + "type": "multi_file", + "value": {"field_label": "Upload", "help_text": "", "required": ""}, + "id": "607daeba-1f33-4ad0-b135-eda743ba8e3a", + }, + { + "type": "text_markup", + "value": "

I acknowledge

", + "id": "5688ddc7-0397-41e7-9e6b-2c0fe44f42aa", + }, + { + "type": "checkbox", + "value": { + "field_label": "My application will be dismissed if it does not fit within OTF's mission, values, principles statements.", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "e695f0d7-4c74-4cc6-853f-bd62ecd19d3d", + }, + { + "type": "text_markup", + "value": 'Read our mission, values, and principles.', + "id": "051be067-d45a-4bc3-8016-a09dadd734f5", + }, + { + "type": "checkbox", + "value": { + "field_label": "I have read and understand OTF's Terms and Privacy policy.", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "f40d1acc-d802-4cc6-b0e9-fff78dc54223", + }, + { + "type": "text_markup", + "value": 'Read the Terms and Privacy policy.', + "id": "bcf64886-df76-41d2-9a22-fb7e49a7718c", + }, + { + "type": "checkbox", + "value": { + "field_label": "I am legally able to sign contracts or represent an organization that can.", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "0b3c0827-38e2-439b-bca5-735835af1019", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that all intellectual property created with support for this application must be openly licensed.", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "bc9c960e-a6f4-4bc2-b626-efb5bc5552c6", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is incomplete in any way, it will be dismissed.", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "5812b66d-630e-4ca2-8bea-819084278f55", + }, + { + "type": "checkbox", + "value": { + "field_label": "I understand that if my application is after a deadline, it will not be reviewed until after the next deadline.", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "97d3746c-cf0f-449a-b3a3-7a9cdd45cc6d", + }, + { + "type": "text_markup", + "value": "

I would like to

", + "id": "e99c9dbe-f788-4eb2-813d-1787c0871210", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up to the OTF-Announce list, low traffic (funding opportunities, major alerts, etc)", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "fc3d2a87-1151-418b-b1cd-9289f00bde35", + }, + { + "type": "checkbox", + "value": { + "field_label": "Sign up for OTF's daily newsletter (collection of news related to global internet freedom).", + "help_text": "", + "required": "true", + "default_value": "", + }, + "id": "83ecc69a-f47c-495e-bc8f-326e55aed67a", + }, ] - application_form, _ = ApplicationForm.objects.get_or_create(name='Rapid response', defaults={'form_fields': json.dumps(data)}) + application_form, _ = ApplicationForm.objects.get_or_create( + name="Rapid response", defaults={"form_fields": json.dumps(data)} + ) return application_form def create_rapid_response_review_form(self): - data2 = [ - {"type": "recommendation", "value": {"field_label": "Do you think we should support this request?", "help_text": "", "info": None}, "id": "d350fbf9-e332-4d7f-b238-7f545cff927a"}, - {"type": "rich_text", "value": {"field_label": "Things that you liked", "help_text": "", "required": "", "default_value": ""}, "id": "cec815a0-fab1-4142-9fc6-71319b054b2a"}, - {"type": "rich_text", "value": {"field_label": "Things that concern you", "help_text": "", "required": "", "default_value": ""}, "id": "6915acf0-9a19-4e73-8d2b-d96e39e3b00e"}, - {"type": "score", "value": {"field_label": "How appropriate are the proposed objectives for rapid response support?", "help_text": "", "required": ""}, "id": "71bfe95d-89c5-401b-ae7a-778e91d5c8c5"}, - {"type": "score", "value": {"field_label": "How would you rate the applicant's capacity and knowledge to carry out this project?", "help_text": "", "required": ""}, "id": "3aa164c1-4386-4046-997a-a2778e1d894e"}, - {"type": "score", "value": {"field_label": "Does the applicant provide sufficient justification for the amount of funding requested (is this cost effective)?", "help_text": "", "required": ""}, "id": "7cc12bb6-4c12-48aa-a269-1fd6d725abfe"}, - {"type": "comments", "value": {"field_label": "Other comments", "help_text": "", "info": None}, "id": "d94e51d3-026c-443f-a98a-a66b1f6c968c"} + { + "type": "recommendation", + "value": { + "field_label": "Do you think we should support this request?", + "help_text": "", + "info": None, + }, + "id": "d350fbf9-e332-4d7f-b238-7f545cff927a", + }, + { + "type": "rich_text", + "value": { + "field_label": "Things that you liked", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "cec815a0-fab1-4142-9fc6-71319b054b2a", + }, + { + "type": "rich_text", + "value": { + "field_label": "Things that concern you", + "help_text": "", + "required": "", + "default_value": "", + }, + "id": "6915acf0-9a19-4e73-8d2b-d96e39e3b00e", + }, + { + "type": "score", + "value": { + "field_label": "How appropriate are the proposed objectives for rapid response support?", + "help_text": "", + "required": "", + }, + "id": "71bfe95d-89c5-401b-ae7a-778e91d5c8c5", + }, + { + "type": "score", + "value": { + "field_label": "How would you rate the applicant's capacity and knowledge to carry out this project?", + "help_text": "", + "required": "", + }, + "id": "3aa164c1-4386-4046-997a-a2778e1d894e", + }, + { + "type": "score", + "value": { + "field_label": "Does the applicant provide sufficient justification for the amount of funding requested (is this cost effective)?", + "help_text": "", + "required": "", + }, + "id": "7cc12bb6-4c12-48aa-a269-1fd6d725abfe", + }, + { + "type": "comments", + "value": { + "field_label": "Other comments", + "help_text": "", + "info": None, + }, + "id": "d94e51d3-026c-443f-a98a-a66b1f6c968c", + }, ] - rapid_response_review_form, _ = ReviewForm.objects.get_or_create(name='Rapid response review', defaults={'form_fields': json.dumps(data2)}) + rapid_response_review_form, _ = ReviewForm.objects.get_or_create( + name="Rapid response review", defaults={"form_fields": json.dumps(data2)} + ) return rapid_response_review_form - def create_rapid_response_fund_type(self, application_form, application_review_form): + def create_rapid_response_fund_type( + self, application_form, application_review_form + ): try: fund = FundType.objects.get(title=RR_FUND_TITLE) except FundType.DoesNotExist: apply_home = ApplyHomePage.objects.first() - fund = FundType(title=RR_FUND_TITLE, workflow_name='single') + fund = FundType(title=RR_FUND_TITLE, workflow_name="single") apply_home.add_child(instance=fund) - fund_form = ApplicationBaseForm.objects.create(application=fund, form=application_form) + fund_form = ApplicationBaseForm.objects.create( + application=fund, form=application_form + ) fund.forms = [fund_form] - fund_review_form = ApplicationBaseReviewForm.objects.create(application=fund, form=application_review_form) + fund_review_form = ApplicationBaseReviewForm.objects.create( + application=fund, form=application_review_form + ) fund.review_forms = [fund_review_form] fund.save() @@ -138,7 +559,7 @@ def create_rapid_response_round(self, fund): lead=lead, # The date of the original RR request type start_date=date(2013, 1, 1), - end_date=date(2018, 8, 29) + end_date=date(2018, 8, 29), ) round.parent_page = fund fund.add_child(instance=round) diff --git a/hypha/apply/funds/management/commands/send_reminders.py b/hypha/apply/funds/management/commands/send_reminders.py index 9309339cd8..18f793b07e 100644 --- a/hypha/apply/funds/management/commands/send_reminders.py +++ b/hypha/apply/funds/management/commands/send_reminders.py @@ -11,18 +11,18 @@ class Command(BaseCommand): - help = 'Send reminders' + help = "Send reminders" def handle(self, *args, **options): site = ApplyHomePage.objects.first().get_site() - set_urlconf('hypha.apply.urls') + set_urlconf("hypha.apply.urls") # Mock a HTTPRequest in order to pass the site settings into the # templates request = HttpRequest() - request.META['SERVER_NAME'] = site.hostname - request.META['SERVER_PORT'] = site.port - request.META[settings.SECURE_PROXY_SSL_HEADER] = 'https' + request.META["SERVER_NAME"] = site.hostname + request.META["SERVER_PORT"] = site.port + request.META[settings.SECURE_PROXY_SSL_HEADER] = "https" request.session = {} request._messages = FallbackStorage(request) @@ -34,8 +34,6 @@ def handle(self, *args, **options): source=reminder.submission, related=reminder, ) - self.stdout.write( - self.style.SUCCESS(f'Reminder sent: {reminder.id}') - ) + self.stdout.write(self.style.SUCCESS(f"Reminder sent: {reminder.id}")) reminder.sent = True reminder.save() diff --git a/hypha/apply/funds/migrations/0001_initial.py b/hypha/apply/funds/migrations/0001_initial.py index b148de45cb..392a586312 100644 --- a/hypha/apply/funds/migrations/0001_initial.py +++ b/hypha/apply/funds/migrations/0001_initial.py @@ -7,23 +7,32 @@ class Migration(migrations.Migration): - initial = True dependencies = [ - ('images', '0001_initial'), - ('wagtailcore', '0040_page_draft_title'), + ("images", "0001_initial"), + ("wagtailcore", "0040_page_draft_title"), ] operations = [ migrations.CreateModel( - name='FundType', + name="FundType", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.Page", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('wagtailcore.page',), + bases=("wagtailcore.page",), ), ] diff --git a/hypha/apply/funds/migrations/0002_fundpage_workflow.py b/hypha/apply/funds/migrations/0002_fundpage_workflow.py index 40f23159dd..fa8c2b309f 100644 --- a/hypha/apply/funds/migrations/0002_fundpage_workflow.py +++ b/hypha/apply/funds/migrations/0002_fundpage_workflow.py @@ -6,15 +6,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0001_initial'), + ("funds", "0001_initial"), ] operations = [ migrations.AddField( - model_name='fundtype', - name='workflow', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100), + model_name="fundtype", + name="workflow", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + ), ), ] diff --git a/hypha/apply/funds/migrations/0003_applicationform_category_fundpageform_option.py b/hypha/apply/funds/migrations/0003_applicationform_category_fundpageform_option.py index 2db3f8327a..3fddd57096 100644 --- a/hypha/apply/funds/migrations/0003_applicationform_category_fundpageform_option.py +++ b/hypha/apply/funds/migrations/0003_applicationform_category_fundpageform_option.py @@ -11,32 +11,459 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0002_fundpage_workflow'), - ('categories', '0001_initial'), + ("funds", "0002_fundpage_workflow"), + ("categories", "0001_initial"), ] operations = [ migrations.CreateModel( - name='ApplicationForm', + name="ApplicationForm", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('form_fields', wagtail.fields.StreamField((('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom'))))) + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), + ( + "form_fields", + wagtail.fields.StreamField( + ( + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Checkbox" + ) + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock( + required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Other", label="Paragraph" + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ) + ), + ), ], ), migrations.CreateModel( - name='FundForm', + name="FundForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationForm')), - ('fund', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='forms', to='funds.FundType')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationForm", + ), + ), + ( + "fund", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="forms", + to="funds.FundType", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0004_categoryblock_add_required_option.py b/hypha/apply/funds/migrations/0004_categoryblock_add_required_option.py index ec33fa882d..ae330c77d5 100644 --- a/hypha/apply/funds/migrations/0004_categoryblock_add_required_option.py +++ b/hypha/apply/funds/migrations/0004_categoryblock_add_required_option.py @@ -9,15 +9,404 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0003_applicationform_category_fundpageform_option'), + ("funds", "0003_applicationform_category_fundpageform_option"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Custom')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Custom", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0005_applicationsubmission.py b/hypha/apply/funds/migrations/0005_applicationsubmission.py index ac820aae9e..41e5de12ac 100644 --- a/hypha/apply/funds/migrations/0005_applicationsubmission.py +++ b/hypha/apply/funds/migrations/0005_applicationsubmission.py @@ -8,24 +8,40 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('funds', '0004_categoryblock_add_required_option'), + ("wagtailcore", "0040_page_draft_title"), + ("funds", "0004_categoryblock_add_required_option"), ] operations = [ migrations.CreateModel( - name='ApplicationSubmission', + name="ApplicationSubmission", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('form_data', django.contrib.postgres.fields.jsonb.JSONField()), - ('submit_time', models.DateTimeField(auto_now_add=True, verbose_name='submit time')), - ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Page')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("form_data", django.contrib.postgres.fields.jsonb.JSONField()), + ( + "submit_time", + models.DateTimeField(auto_now_add=True, verbose_name="submit time"), + ), + ( + "page", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Page", + ), + ), ], options={ - 'verbose_name': 'form submission', - 'abstract': False, + "verbose_name": "form submission", + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0006_update_block_definitions.py b/hypha/apply/funds/migrations/0006_update_block_definitions.py index bddaf622db..1facaa93ba 100644 --- a/hypha/apply/funds/migrations/0006_update_block_definitions.py +++ b/hypha/apply/funds/migrations/0006_update_block_definitions.py @@ -9,15 +9,442 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0005_applicationsubmission'), + ("funds", "0005_applicationsubmission"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.StaticBlock())), group='Required')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0007_round.py b/hypha/apply/funds/migrations/0007_round.py index 14ed8c2dbd..9d3347bc80 100644 --- a/hypha/apply/funds/migrations/0007_round.py +++ b/hypha/apply/funds/migrations/0007_round.py @@ -7,21 +7,30 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('funds', '0006_update_block_definitions'), + ("wagtailcore", "0040_page_draft_title"), + ("funds", "0006_update_block_definitions"), ] operations = [ migrations.CreateModel( - name='Round', + name="Round", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.Page", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('wagtailcore.page',), + bases=("wagtailcore.page",), ), ] diff --git a/hypha/apply/funds/migrations/0008_add_date_to_round.py b/hypha/apply/funds/migrations/0008_add_date_to_round.py index b57db907c9..03cd677aa0 100644 --- a/hypha/apply/funds/migrations/0008_add_date_to_round.py +++ b/hypha/apply/funds/migrations/0008_add_date_to_round.py @@ -7,20 +7,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0007_round'), + ("funds", "0007_round"), ] operations = [ migrations.AddField( - model_name='round', - name='end_date', + model_name="round", + name="end_date", field=models.DateField(blank=True, default=datetime.date.today), ), migrations.AddField( - model_name='round', - name='start_date', + model_name="round", + name="start_date", field=models.DateField(blank=True, default=datetime.date.today), ), ] diff --git a/hypha/apply/funds/migrations/0009_update_date_fields.py b/hypha/apply/funds/migrations/0009_update_date_fields.py index ed7261b0f1..38177f0c9e 100644 --- a/hypha/apply/funds/migrations/0009_update_date_fields.py +++ b/hypha/apply/funds/migrations/0009_update_date_fields.py @@ -7,20 +7,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0008_add_date_to_round'), + ("funds", "0008_add_date_to_round"), ] operations = [ migrations.AlterField( - model_name='round', - name='end_date', - field=models.DateField(blank=True, default=datetime.date.today, help_text='When no end date is provided the round will remain open indefinitely.', null=True), + model_name="round", + name="end_date", + field=models.DateField( + blank=True, + default=datetime.date.today, + help_text="When no end date is provided the round will remain open indefinitely.", + null=True, + ), ), migrations.AlterField( - model_name='round', - name='start_date', + model_name="round", + name="start_date", field=models.DateField(default=datetime.date.today), ), ] diff --git a/hypha/apply/funds/migrations/0010_update_for_rich_text_block.py b/hypha/apply/funds/migrations/0010_update_for_rich_text_block.py index d7ef5b05ff..8a685aad8e 100644 --- a/hypha/apply/funds/migrations/0010_update_for_rich_text_block.py +++ b/hypha/apply/funds/migrations/0010_update_for_rich_text_block.py @@ -10,15 +10,472 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0009_update_date_fields'), + ("funds", "0009_update_date_fields"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0011_update_encoder_add_round_to_submission.py b/hypha/apply/funds/migrations/0011_update_encoder_add_round_to_submission.py index 99eec0fd5b..cc6657f2f4 100644 --- a/hypha/apply/funds/migrations/0011_update_encoder_add_round_to_submission.py +++ b/hypha/apply/funds/migrations/0011_update_encoder_add_round_to_submission.py @@ -9,22 +9,28 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('funds', '0010_update_for_rich_text_block'), + ("wagtailcore", "0040_page_draft_title"), + ("funds", "0010_update_for_rich_text_block"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='round', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to='wagtailcore.Page'), + model_name="applicationsubmission", + name="round", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="submissions", + to="wagtailcore.Page", + ), preserve_default=False, ), migrations.AlterField( - model_name='applicationsubmission', - name='form_data', - field=django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder), + model_name="applicationsubmission", + name="form_data", + field=django.contrib.postgres.fields.jsonb.JSONField( + encoder=django.core.serializers.json.DjangoJSONEncoder + ), ), ] diff --git a/hypha/apply/funds/migrations/0012_create_lab_models.py b/hypha/apply/funds/migrations/0012_create_lab_models.py index 53dde0dca3..0c26c8a496 100644 --- a/hypha/apply/funds/migrations/0012_create_lab_models.py +++ b/hypha/apply/funds/migrations/0012_create_lab_models.py @@ -8,39 +8,76 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('funds', '0011_update_encoder_add_round_to_submission'), + ("wagtailcore", "0040_page_draft_title"), + ("funds", "0011_update_encoder_add_round_to_submission"), ] operations = [ migrations.CreateModel( - name='LabForm', + name="LabForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationForm')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationForm", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='LabType', + name="LabType", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), - ('workflow', models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100)), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.Page", + ), + ), + ( + "workflow", + models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('wagtailcore.page',), + bases=("wagtailcore.page",), ), migrations.AddField( - model_name='labform', - name='lab', - field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='forms', to='funds.LabType'), + model_name="labform", + name="lab", + field=modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="forms", + to="funds.LabType", + ), ), ] diff --git a/hypha/apply/funds/migrations/0013_allow_nullable_round_on_submission.py b/hypha/apply/funds/migrations/0013_allow_nullable_round_on_submission.py index b449dd383a..17e838928b 100644 --- a/hypha/apply/funds/migrations/0013_allow_nullable_round_on_submission.py +++ b/hypha/apply/funds/migrations/0013_allow_nullable_round_on_submission.py @@ -7,15 +7,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0012_create_lab_models'), + ("funds", "0012_create_lab_models"), ] operations = [ migrations.AlterField( - model_name='applicationsubmission', - name='round', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to='wagtailcore.Page'), + model_name="applicationsubmission", + name="round", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="submissions", + to="wagtailcore.Page", + ), ), ] diff --git a/hypha/apply/funds/migrations/0014_add_meta_names.py b/hypha/apply/funds/migrations/0014_add_meta_names.py index be76a2f73a..cd42551eea 100644 --- a/hypha/apply/funds/migrations/0014_add_meta_names.py +++ b/hypha/apply/funds/migrations/0014_add_meta_names.py @@ -6,18 +6,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0013_allow_nullable_round_on_submission'), + ("funds", "0013_allow_nullable_round_on_submission"), ] operations = [ migrations.AlterModelOptions( - name='fundtype', - options={'verbose_name': 'Fund'}, + name="fundtype", + options={"verbose_name": "Fund"}, ), migrations.AlterModelOptions( - name='labtype', - options={'verbose_name': 'Lab'}, + name="labtype", + options={"verbose_name": "Lab"}, ), ] diff --git a/hypha/apply/funds/migrations/0015_link_user_to_application.py b/hypha/apply/funds/migrations/0015_link_user_to_application.py index e5b1424f3f..e0d879ef3c 100644 --- a/hypha/apply/funds/migrations/0015_link_user_to_application.py +++ b/hypha/apply/funds/migrations/0015_link_user_to_application.py @@ -12,61 +12,580 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0014_add_meta_names'), + ("funds", "0014_add_meta_names"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='fundtype', - name='confirmation_text_extra', - field=models.TextField(blank=True, help_text='Additional text for the application confirmation message.'), + model_name="fundtype", + name="confirmation_text_extra", + field=models.TextField( + blank=True, + help_text="Additional text for the application confirmation message.", + ), ), migrations.AddField( - model_name='fundtype', - name='from_address', - field=models.CharField(blank=True, max_length=255, verbose_name='from address'), + model_name="fundtype", + name="from_address", + field=models.CharField( + blank=True, max_length=255, verbose_name="from address" + ), ), migrations.AddField( - model_name='fundtype', - name='subject', - field=models.CharField(blank=True, max_length=255, verbose_name='subject'), + model_name="fundtype", + name="subject", + field=models.CharField(blank=True, max_length=255, verbose_name="subject"), ), migrations.AddField( - model_name='fundtype', - name='to_address', - field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address'), + model_name="fundtype", + name="to_address", + field=models.CharField( + blank=True, + help_text="Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.", + max_length=255, + verbose_name="to address", + ), ), migrations.AddField( - model_name='labtype', - name='confirmation_text_extra', - field=models.TextField(blank=True, help_text='Additional text for the application confirmation message.'), + model_name="labtype", + name="confirmation_text_extra", + field=models.TextField( + blank=True, + help_text="Additional text for the application confirmation message.", + ), ), migrations.AddField( - model_name='labtype', - name='from_address', - field=models.CharField(blank=True, max_length=255, verbose_name='from address'), + model_name="labtype", + name="from_address", + field=models.CharField( + blank=True, max_length=255, verbose_name="from address" + ), ), migrations.AddField( - model_name='labtype', - name='subject', - field=models.CharField(blank=True, max_length=255, verbose_name='subject'), + model_name="labtype", + name="subject", + field=models.CharField(blank=True, max_length=255, verbose_name="subject"), ), migrations.AddField( - model_name='labtype', - name='to_address', - field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address'), + model_name="labtype", + name="to_address", + field=models.CharField( + blank=True, + help_text="Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.", + max_length=255, + verbose_name="to address", + ), ), migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0016_roundform.py b/hypha/apply/funds/migrations/0016_roundform.py index 038fd490c1..51e7502667 100644 --- a/hypha/apply/funds/migrations/0016_roundform.py +++ b/hypha/apply/funds/migrations/0016_roundform.py @@ -8,23 +8,46 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0015_link_user_to_application'), + ("funds", "0015_link_user_to_application"), ] operations = [ migrations.CreateModel( - name='RoundForm', + name="RoundForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationForm')), - ('round', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='forms', to='funds.Round')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationForm", + ), + ), + ( + "round", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="forms", + to="funds.Round", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0017_round_workflow.py b/hypha/apply/funds/migrations/0017_round_workflow.py index 852c68af50..5b7e7e24d6 100644 --- a/hypha/apply/funds/migrations/0017_round_workflow.py +++ b/hypha/apply/funds/migrations/0017_round_workflow.py @@ -6,15 +6,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0016_roundform'), + ("funds", "0016_roundform"), ] operations = [ migrations.AddField( - model_name='round', - name='workflow', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100), + model_name="round", + name="workflow", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + ), ), ] diff --git a/hypha/apply/funds/migrations/0018_add_addressfield.py b/hypha/apply/funds/migrations/0018_add_addressfield.py index c5e5f8cd9e..e1c2c00b52 100644 --- a/hypha/apply/funds/migrations/0018_add_addressfield.py +++ b/hypha/apply/funds/migrations/0018_add_addressfield.py @@ -10,15 +10,529 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0017_round_workflow'), + ("funds", "0017_round_workflow"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('address', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0019_protect_submission.py b/hypha/apply/funds/migrations/0019_protect_submission.py index d9669d25aa..8d48b23c01 100644 --- a/hypha/apply/funds/migrations/0019_protect_submission.py +++ b/hypha/apply/funds/migrations/0019_protect_submission.py @@ -7,20 +7,26 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0018_add_addressfield'), + ("funds", "0018_add_addressfield"), ] operations = [ migrations.AlterField( - model_name='applicationsubmission', - name='page', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='wagtailcore.Page'), + model_name="applicationsubmission", + name="page", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to="wagtailcore.Page" + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='round', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='submissions', to='wagtailcore.Page'), + model_name="applicationsubmission", + name="round", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="submissions", + to="wagtailcore.Page", + ), ), ] diff --git a/hypha/apply/funds/migrations/0020_add_workflow_and_status_to_submission.py b/hypha/apply/funds/migrations/0020_add_workflow_and_status_to_submission.py index 9d64d2adf2..e6fc14c782 100644 --- a/hypha/apply/funds/migrations/0020_add_workflow_and_status_to_submission.py +++ b/hypha/apply/funds/migrations/0020_add_workflow_and_status_to_submission.py @@ -6,25 +6,28 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0019_protect_submission'), + ("funds", "0019_protect_submission"), ] operations = [ migrations.AlterModelOptions( - name='applicationsubmission', + name="applicationsubmission", options={}, ), migrations.AddField( - model_name='applicationsubmission', - name='status', - field=models.CharField(default='', max_length=254), + model_name="applicationsubmission", + name="status", + field=models.CharField(default="", max_length=254), preserve_default=False, ), migrations.AddField( - model_name='applicationsubmission', - name='workflow', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100), + model_name="applicationsubmission", + name="workflow", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + ), ), ] diff --git a/hypha/apply/funds/migrations/0021_rename_workflow_field.py b/hypha/apply/funds/migrations/0021_rename_workflow_field.py index ea9dbb49fe..b24682ab7b 100644 --- a/hypha/apply/funds/migrations/0021_rename_workflow_field.py +++ b/hypha/apply/funds/migrations/0021_rename_workflow_field.py @@ -6,50 +6,69 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0020_add_workflow_and_status_to_submission'), + ("funds", "0020_add_workflow_and_status_to_submission"), ] operations = [ migrations.RenameField( - model_name='applicationsubmission', - old_name='workflow', - new_name='workflow_name', + model_name="applicationsubmission", + old_name="workflow", + new_name="workflow_name", ), migrations.RenameField( - model_name='fundtype', - old_name='workflow', - new_name='workflow_name', + model_name="fundtype", + old_name="workflow", + new_name="workflow_name", ), migrations.RenameField( - model_name='labtype', - old_name='workflow', - new_name='workflow_name', + model_name="labtype", + old_name="workflow", + new_name="workflow_name", ), migrations.RenameField( - model_name='round', - old_name='workflow', - new_name='workflow_name', + model_name="round", + old_name="workflow", + new_name="workflow_name", ), migrations.AlterField( - model_name='applicationsubmission', - name='workflow_name', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100, verbose_name='Workflow'), + model_name="applicationsubmission", + name="workflow_name", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='fundtype', - name='workflow_name', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100, verbose_name='Workflow'), + model_name="fundtype", + name="workflow_name", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='labtype', - name='workflow_name', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100, verbose_name='Workflow'), + model_name="labtype", + name="workflow_name", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='round', - name='workflow_name', - field=models.CharField(choices=[('single', 'Single Stage'), ('double', 'Two Stage')], default='single', max_length=100, verbose_name='Workflow'), + model_name="round", + name="workflow_name", + field=models.CharField( + choices=[("single", "Single Stage"), ("double", "Two Stage")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), ] diff --git a/hypha/apply/funds/migrations/0022_applicationsubmission_form_fields.py b/hypha/apply/funds/migrations/0022_applicationsubmission_form_fields.py index f7d62d15ee..c7b3429881 100644 --- a/hypha/apply/funds/migrations/0022_applicationsubmission_form_fields.py +++ b/hypha/apply/funds/migrations/0022_applicationsubmission_form_fields.py @@ -10,16 +10,531 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0021_rename_workflow_field'), + ("funds", "0021_rename_workflow_field"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('address', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required'))), default=[]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ), + default=[], + ), preserve_default=False, ), ] diff --git a/hypha/apply/funds/migrations/0023_round_lead.py b/hypha/apply/funds/migrations/0023_round_lead.py index df3a73882a..4ae2cde0b3 100644 --- a/hypha/apply/funds/migrations/0023_round_lead.py +++ b/hypha/apply/funds/migrations/0023_round_lead.py @@ -8,17 +8,20 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0022_applicationsubmission_form_fields'), + ("funds", "0022_applicationsubmission_form_fields"), ] operations = [ migrations.AddField( - model_name='round', - name='lead', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + model_name="round", + name="lead", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), preserve_default=False, ), ] diff --git a/hypha/apply/funds/migrations/0024_applicationsubmission_search_data.py b/hypha/apply/funds/migrations/0024_applicationsubmission_search_data.py index 97dc908a30..1cfb3a6121 100644 --- a/hypha/apply/funds/migrations/0024_applicationsubmission_search_data.py +++ b/hypha/apply/funds/migrations/0024_applicationsubmission_search_data.py @@ -6,16 +6,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0023_round_lead'), + ("funds", "0023_round_lead"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='search_data', - field=models.TextField(default=''), + model_name="applicationsubmission", + name="search_data", + field=models.TextField(default=""), preserve_default=False, ), ] diff --git a/hypha/apply/funds/migrations/0025_update_with_file_blocks.py b/hypha/apply/funds/migrations/0025_update_with_file_blocks.py index 4e876da96c..41dcbc945d 100644 --- a/hypha/apply/funds/migrations/0025_update_with_file_blocks.py +++ b/hypha/apply/funds/migrations/0025_update_with_file_blocks.py @@ -10,20 +10,1097 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0024_applicationsubmission_search_data'), + ("funds", "0024_applicationsubmission_search_data"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('multi_file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('address', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('multi_file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('address', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0026_add_leads_to_submission_and_lab.py b/hypha/apply/funds/migrations/0026_add_leads_to_submission_and_lab.py index 8d68ac6179..fa727a7f55 100644 --- a/hypha/apply/funds/migrations/0026_add_leads_to_submission_and_lab.py +++ b/hypha/apply/funds/migrations/0026_add_leads_to_submission_and_lab.py @@ -8,23 +8,32 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0025_update_with_file_blocks'), + ("funds", "0025_update_with_file_blocks"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='lead', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='submission_lead', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="lead", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="submission_lead", + to=settings.AUTH_USER_MODEL, + ), preserve_default=False, ), migrations.AddField( - model_name='labtype', - name='lead', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='lab_lead', to=settings.AUTH_USER_MODEL), + model_name="labtype", + name="lead", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="lab_lead", + to=settings.AUTH_USER_MODEL, + ), preserve_default=False, ), ] diff --git a/hypha/apply/funds/migrations/0027_applicationsubmission_drupal_id.py b/hypha/apply/funds/migrations/0027_applicationsubmission_drupal_id.py index fe885fc83a..80df4764ea 100644 --- a/hypha/apply/funds/migrations/0027_applicationsubmission_drupal_id.py +++ b/hypha/apply/funds/migrations/0027_applicationsubmission_drupal_id.py @@ -6,15 +6,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0026_add_leads_to_submission_and_lab'), + ("funds", "0026_add_leads_to_submission_and_lab"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='drupal_id', + model_name="applicationsubmission", + name="drupal_id", field=models.IntegerField(blank=True, editable=False, null=True), ), ] diff --git a/hypha/apply/funds/migrations/0028_update_on_delete_django2.py b/hypha/apply/funds/migrations/0028_update_on_delete_django2.py index 1f3f45b75a..3b62f67153 100644 --- a/hypha/apply/funds/migrations/0028_update_on_delete_django2.py +++ b/hypha/apply/funds/migrations/0028_update_on_delete_django2.py @@ -6,40 +6,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0027_applicationsubmission_drupal_id'), + ("funds", "0027_applicationsubmission_drupal_id"), ] operations = [ migrations.AlterField( - model_name='applicationsubmission', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff'}, on_delete=django.db.models.deletion.PROTECT, related_name='submission_lead', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff"}, + on_delete=django.db.models.deletion.PROTECT, + related_name="submission_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='fundform', - name='form', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='funds.ApplicationForm'), + model_name="fundform", + name="form", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to="funds.ApplicationForm" + ), ), migrations.AlterField( - model_name='labform', - name='form', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='funds.ApplicationForm'), + model_name="labform", + name="form", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to="funds.ApplicationForm" + ), ), migrations.AlterField( - model_name='labtype', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff'}, on_delete=django.db.models.deletion.PROTECT, related_name='lab_lead', to=settings.AUTH_USER_MODEL), + model_name="labtype", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff"}, + on_delete=django.db.models.deletion.PROTECT, + related_name="lab_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='round', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff'}, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + model_name="round", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff"}, + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundform', - name='form', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='funds.ApplicationForm'), + model_name="roundform", + name="form", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to="funds.ApplicationForm" + ), ), ] diff --git a/hypha/apply/funds/migrations/0029_applicationsubmission_next.py b/hypha/apply/funds/migrations/0029_applicationsubmission_next.py index 0f3baa7869..ead0771682 100644 --- a/hypha/apply/funds/migrations/0029_applicationsubmission_next.py +++ b/hypha/apply/funds/migrations/0029_applicationsubmission_next.py @@ -5,15 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0028_update_on_delete_django2'), + ("funds", "0028_update_on_delete_django2"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='next', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='previous', to='funds.ApplicationSubmission'), + model_name="applicationsubmission", + name="next", + field=models.OneToOneField( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="previous", + to="funds.ApplicationSubmission", + ), ), ] diff --git a/hypha/apply/funds/migrations/0030_add_reviewers.py b/hypha/apply/funds/migrations/0030_add_reviewers.py index 3640165854..11e64b2490 100644 --- a/hypha/apply/funds/migrations/0030_add_reviewers.py +++ b/hypha/apply/funds/migrations/0030_add_reviewers.py @@ -7,31 +7,47 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0029_applicationsubmission_next'), + ("funds", "0029_applicationsubmission_next"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='reviewers', - field=models.ManyToManyField(limit_choices_to={'groups__name__in': ['Staff', 'Reviewer']}, related_name='submissions_reviewer', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="reviewers", + field=models.ManyToManyField( + limit_choices_to={"groups__name__in": ["Staff", "Reviewer"]}, + related_name="submissions_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='fundtype', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(limit_choices_to={'groups__name': 'Reviewer'}, related_name='fund_reviewers', to=settings.AUTH_USER_MODEL), + model_name="fundtype", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + limit_choices_to={"groups__name": "Reviewer"}, + related_name="fund_reviewers", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='round', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(limit_choices_to={'groups__name': 'Reviewer'}, related_name='rounds_reviewer', to=settings.AUTH_USER_MODEL), + model_name="round", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + limit_choices_to={"groups__name": "Reviewer"}, + related_name="rounds_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='round', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff'}, on_delete=django.db.models.deletion.PROTECT, related_name='round_lead', to=settings.AUTH_USER_MODEL), + model_name="round", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff"}, + on_delete=django.db.models.deletion.PROTECT, + related_name="round_lead", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/funds/migrations/0031_labtype_reviewers.py b/hypha/apply/funds/migrations/0031_labtype_reviewers.py index 5c126c7a69..160b028045 100644 --- a/hypha/apply/funds/migrations/0031_labtype_reviewers.py +++ b/hypha/apply/funds/migrations/0031_labtype_reviewers.py @@ -6,16 +6,19 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0030_add_reviewers'), + ("funds", "0030_add_reviewers"), ] operations = [ migrations.AddField( - model_name='labtype', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(limit_choices_to={'groups__name': 'Reviewer'}, related_name='labs_reviewer', to=settings.AUTH_USER_MODEL), + model_name="labtype", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + limit_choices_to={"groups__name": "Reviewer"}, + related_name="labs_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/funds/migrations/0032_make_reviewers_optional_in_all_instances.py b/hypha/apply/funds/migrations/0032_make_reviewers_optional_in_all_instances.py index 5e70883579..6ee2a9b302 100644 --- a/hypha/apply/funds/migrations/0032_make_reviewers_optional_in_all_instances.py +++ b/hypha/apply/funds/migrations/0032_make_reviewers_optional_in_all_instances.py @@ -6,30 +6,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0031_labtype_reviewers'), + ("funds", "0031_labtype_reviewers"), ] operations = [ migrations.AlterField( - model_name='applicationsubmission', - name='reviewers', - field=models.ManyToManyField(blank=True, limit_choices_to={'groups__name__in': ['Staff', 'Reviewer']}, related_name='submissions_reviewer', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="reviewers", + field=models.ManyToManyField( + blank=True, + limit_choices_to={"groups__name__in": ["Staff", "Reviewer"]}, + related_name="submissions_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='fundtype', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer'}, related_name='fund_reviewers', to=settings.AUTH_USER_MODEL), + model_name="fundtype", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer"}, + related_name="fund_reviewers", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='labtype', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer'}, related_name='labs_reviewer', to=settings.AUTH_USER_MODEL), + model_name="labtype", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer"}, + related_name="labs_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='round', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer'}, related_name='rounds_reviewer', to=settings.AUTH_USER_MODEL), + model_name="round", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer"}, + related_name="rounds_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/funds/migrations/0033_use_django_fsm.py b/hypha/apply/funds/migrations/0033_use_django_fsm.py index b27a4eb6d8..c5f0210448 100644 --- a/hypha/apply/funds/migrations/0033_use_django_fsm.py +++ b/hypha/apply/funds/migrations/0033_use_django_fsm.py @@ -5,35 +5,56 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0032_make_reviewers_optional_in_all_instances'), + ("funds", "0032_make_reviewers_optional_in_all_instances"), ] operations = [ migrations.AlterField( - model_name='applicationsubmission', - name='status', - field=django_fsm.FSMField(default='in_discussion', max_length=50, protected=True), + model_name="applicationsubmission", + name="status", + field=django_fsm.FSMField( + default="in_discussion", max_length=50, protected=True + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="applicationsubmission", + name="workflow_name", + field=models.CharField( + choices=[("single", "Request"), ("double", "Concept & Proposal")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='fundtype', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="fundtype", + name="workflow_name", + field=models.CharField( + choices=[("single", "Request"), ("double", "Concept & Proposal")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='labtype', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="labtype", + name="workflow_name", + field=models.CharField( + choices=[("single", "Request"), ("double", "Concept & Proposal")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='round', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="round", + name="workflow_name", + field=models.CharField( + choices=[("single", "Request"), ("double", "Concept & Proposal")], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), ] diff --git a/hypha/apply/funds/migrations/0034_create_revisions_model.py b/hypha/apply/funds/migrations/0034_create_revisions_model.py index e75812d775..bb2867cdb5 100644 --- a/hypha/apply/funds/migrations/0034_create_revisions_model.py +++ b/hypha/apply/funds/migrations/0034_create_revisions_model.py @@ -7,28 +7,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0033_use_django_fsm'), + ("funds", "0033_use_django_fsm"), ] operations = [ migrations.CreateModel( - name='ApplicationRevision', + name="ApplicationRevision", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('form_data', django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder)), - ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='funds.ApplicationSubmission')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "form_data", + django.contrib.postgres.fields.jsonb.JSONField( + encoder=django.core.serializers.json.DjangoJSONEncoder + ), + ), + ( + "submission", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="revisions", + to="funds.ApplicationSubmission", + ), + ), ], ), migrations.AddField( - model_name='applicationsubmission', - name='draft_revision', - field=models.OneToOneField(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='draft', to='funds.ApplicationRevision'), + model_name="applicationsubmission", + name="draft_revision", + field=models.OneToOneField( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="draft", + to="funds.ApplicationRevision", + ), ), migrations.AddField( - model_name='applicationsubmission', - name='live_revision', - field=models.OneToOneField(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='live', to='funds.ApplicationRevision'), + model_name="applicationsubmission", + name="live_revision", + field=models.OneToOneField( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="live", + to="funds.ApplicationRevision", + ), ), ] diff --git a/hypha/apply/funds/migrations/0035_author_timestamp_revision.py b/hypha/apply/funds/migrations/0035_author_timestamp_revision.py index 19e85350d3..1fae46c6c0 100644 --- a/hypha/apply/funds/migrations/0035_author_timestamp_revision.py +++ b/hypha/apply/funds/migrations/0035_author_timestamp_revision.py @@ -6,25 +6,28 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0034_create_revisions_model'), + ("funds", "0034_create_revisions_model"), ] operations = [ migrations.AddField( - model_name='applicationrevision', - name='author', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + model_name="applicationrevision", + name="author", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='applicationrevision', - name='timestamp', + model_name="applicationrevision", + name="timestamp", field=models.DateTimeField(auto_now=True), ), migrations.AlterModelOptions( - name='applicationrevision', - options={'ordering': ['-timestamp']}, + name="applicationrevision", + options={"ordering": ["-timestamp"]}, ), ] diff --git a/hypha/apply/funds/migrations/0036_fundreviewform_labreviewform.py b/hypha/apply/funds/migrations/0036_fundreviewform_labreviewform.py index e6ed3c3905..98c121c3b5 100644 --- a/hypha/apply/funds/migrations/0036_fundreviewform_labreviewform.py +++ b/hypha/apply/funds/migrations/0036_fundreviewform_labreviewform.py @@ -6,37 +6,84 @@ class Migration(migrations.Migration): - dependencies = [ - ('review', '0005_streamform'), - ('funds', '0035_author_timestamp_revision'), + ("review", "0005_streamform"), + ("funds", "0035_author_timestamp_revision"), ] operations = [ migrations.CreateModel( - name='FundReviewForm', + name="FundReviewForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='review.ReviewForm')), - ('fund', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='review_forms', to='funds.FundType')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="review.ReviewForm", + ), + ), + ( + "fund", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="review_forms", + to="funds.FundType", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='LabReviewForm', + name="LabReviewForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='review.ReviewForm')), - ('lab', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='review_forms', to='funds.LabType')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="review.ReviewForm", + ), + ), + ( + "lab", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="review_forms", + to="funds.LabType", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0037_refactor_funds_models.py b/hypha/apply/funds/migrations/0037_refactor_funds_models.py index ce9fc3d027..4db661ac80 100644 --- a/hypha/apply/funds/migrations/0037_refactor_funds_models.py +++ b/hypha/apply/funds/migrations/0037_refactor_funds_models.py @@ -7,119 +7,157 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), + ("wagtailcore", "0040_page_draft_title"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('review', '0006_remove_review_review'), - ('funds', '0036_fundreviewform_labreviewform'), + ("review", "0006_remove_review_review"), + ("funds", "0036_fundreviewform_labreviewform"), ] operations = [ # Rename all the existing models as required migrations.RenameModel( - old_name='FundType', - new_name='ApplicationBase', + old_name="FundType", + new_name="ApplicationBase", ), migrations.RenameModel( - old_name='Round', - new_name='RoundBase', + old_name="Round", + new_name="RoundBase", ), migrations.RenameModel( - old_name='LabType', - new_name='LabBase', + old_name="LabType", + new_name="LabBase", ), migrations.RenameModel( - old_name='FundForm', - new_name='ApplicationBaseForm', + old_name="FundForm", + new_name="ApplicationBaseForm", ), migrations.RenameModel( - old_name='FundReviewForm', - new_name='ApplicationBaseReviewForm', + old_name="FundReviewForm", + new_name="ApplicationBaseReviewForm", ), migrations.RenameModel( - old_name='LabForm', - new_name='LabBaseForm', + old_name="LabForm", + new_name="LabBaseForm", ), migrations.RenameModel( - old_name='LabReviewForm', - new_name='LabBaseReviewForm', + old_name="LabReviewForm", + new_name="LabBaseReviewForm", ), migrations.RenameModel( - old_name='RoundForm', - new_name='RoundBaseForm', + old_name="RoundForm", + new_name="RoundBaseForm", ), - # Add all the new models migrations.CreateModel( - name='FundType', + name="FundType", fields=[ - ('applicationbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='funds.ApplicationBase')), + ( + "applicationbase_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="funds.ApplicationBase", + ), + ), ], options={ - 'verbose_name': 'Fund', + "verbose_name": "Fund", }, - bases=('funds.applicationbase',), + bases=("funds.applicationbase",), ), migrations.CreateModel( - name='LabType', + name="LabType", fields=[ - ('labbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='funds.LabBase')), + ( + "labbase_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="funds.LabBase", + ), + ), ], options={ - 'verbose_name': 'Lab', + "verbose_name": "Lab", }, - bases=('funds.labbase',), + bases=("funds.labbase",), ), migrations.CreateModel( - name='Round', + name="Round", fields=[ - ('roundbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='funds.RoundBase')), + ( + "roundbase_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="funds.RoundBase", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('funds.roundbase',), + bases=("funds.roundbase",), ), - - # Remove options - django migrations.AlterModelOptions( - name='applicationbase', + name="applicationbase", options={}, ), migrations.AlterModelOptions( - name='labbase', + name="labbase", options={}, ), - # Rename fields as required - non essential migrations.RenameField( - model_name='applicationbaseform', - old_name='fund', - new_name='application', + model_name="applicationbaseform", + old_name="fund", + new_name="application", ), migrations.RenameField( - model_name='applicationbasereviewform', - old_name='fund', - new_name='application', + model_name="applicationbasereviewform", + old_name="fund", + new_name="application", ), - # Alter related name based on the classname - non essential just being tidy migrations.AlterField( - model_name='applicationbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer'}, related_name='applicationbase_reviewers', to=settings.AUTH_USER_MODEL), + model_name="applicationbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer"}, + related_name="applicationbase_reviewers", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundbase', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff'}, on_delete=django.db.models.deletion.PROTECT, related_name='roundbase_lead', to=settings.AUTH_USER_MODEL), + model_name="roundbase", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff"}, + on_delete=django.db.models.deletion.PROTECT, + related_name="roundbase_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer'}, related_name='roundbase_reviewer', to=settings.AUTH_USER_MODEL), + model_name="roundbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer"}, + related_name="roundbase_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), - ] diff --git a/hypha/apply/funds/migrations/0038_recreate_objects_that_exist.py b/hypha/apply/funds/migrations/0038_recreate_objects_that_exist.py index 05f5d70909..c1bea4f00f 100644 --- a/hypha/apply/funds/migrations/0038_recreate_objects_that_exist.py +++ b/hypha/apply/funds/migrations/0038_recreate_objects_that_exist.py @@ -7,28 +7,29 @@ def recreate_objects(apps, schema_editor): # We removed the old definition of these objects, need to create # a new object with a pointer back to that object, the underlying # data structure was unaffected - ContentType = apps.get_model('contenttypes.ContentType') - + ContentType = apps.get_model("contenttypes.ContentType") for model_name, new_model_name in [ - ('FundType', 'ApplicationBase'), - ('LabType', 'LabBase'), - ('Round', 'RoundBase'), + ("FundType", "ApplicationBase"), + ("LabType", "LabBase"), + ("Round", "RoundBase"), ]: - content_type, _ = ContentType.objects.get_or_create(model=model_name.lower(), app_label='funds') + content_type, _ = ContentType.objects.get_or_create( + model=model_name.lower(), app_label="funds" + ) - model = apps.get_model('funds', model_name) - new_model = apps.get_model('funds', new_model_name) + model = apps.get_model("funds", model_name) + new_model = apps.get_model("funds", new_model_name) for obj in new_model.objects.all(): field_values = {} for field in obj._meta.fields: - if field.name not in ['page_ptr']: + if field.name not in ["page_ptr"]: field_values[field.name] = getattr(obj, field.name) kwargs = { - f'{new_model_name.lower()}_ptr': obj, - 'draft_title': obj.draft_title, - 'content_type': content_type, + f"{new_model_name.lower()}_ptr": obj, + "draft_title": obj.draft_title, + "content_type": content_type, } field_values.update(**kwargs) new_obj = model(**field_values) @@ -36,9 +37,8 @@ def recreate_objects(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('funds', '0037_refactor_funds_models'), + ("funds", "0037_refactor_funds_models"), ] operations = [ diff --git a/hypha/apply/funds/migrations/0039_add_rfps_and_sealed_rounds.py b/hypha/apply/funds/migrations/0039_add_rfps_and_sealed_rounds.py index a44a1ef553..0bd14403ea 100644 --- a/hypha/apply/funds/migrations/0039_add_rfps_and_sealed_rounds.py +++ b/hypha/apply/funds/migrations/0039_add_rfps_and_sealed_rounds.py @@ -5,35 +5,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0038_recreate_objects_that_exist'), + ("funds", "0038_recreate_objects_that_exist"), ] operations = [ migrations.CreateModel( - name='RequestForPartners', + name="RequestForPartners", fields=[ - ('applicationbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='funds.ApplicationBase')), + ( + "applicationbase_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="funds.ApplicationBase", + ), + ), ], options={ - 'verbose_name': 'RFP', + "verbose_name": "RFP", }, - bases=('funds.applicationbase',), + bases=("funds.applicationbase",), ), migrations.CreateModel( - name='SealedRound', + name="SealedRound", fields=[ - ('roundbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='funds.RoundBase')), + ( + "roundbase_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="funds.RoundBase", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('funds.roundbase',), + bases=("funds.roundbase",), ), migrations.AddField( - model_name='roundbase', - name='sealed', + model_name="roundbase", + name="sealed", field=models.BooleanField(default=False), ), ] diff --git a/hypha/apply/funds/migrations/0040_add_duration_stream_to_streamfield_definition.py b/hypha/apply/funds/migrations/0040_add_duration_stream_to_streamfield_definition.py index 675b0da88a..6628cbfb98 100644 --- a/hypha/apply/funds/migrations/0040_add_duration_stream_to_streamfield_definition.py +++ b/hypha/apply/funds/migrations/0040_add_duration_stream_to_streamfield_definition.py @@ -8,20 +8,1135 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0039_add_rfps_and_sealed_rounds'), + ("funds", "0039_add_rfps_and_sealed_rounds"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('multi_file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('address', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('duration', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField((('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('number', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))), group='Fields')), ('checkbox', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))), group='Fields')), ('radios', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('dropdown', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))), group='Fields')), ('checkboxes', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))), group='Fields')), ('date', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))), group='Fields')), ('time', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))), group='Fields')), ('datetime', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))), group='Fields')), ('image', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('multi_file', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))), group='Fields')), ('rich_text', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))), group='Fields')), ('category', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))), group='Custom')), ('title', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('value', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('email', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('address', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('full_name', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')), ('duration', wagtail.blocks.StructBlock((('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())), group='Required')))), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + ( + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ), + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ), + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ), + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ), + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ), + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + ( + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ), + group="Required", + ), + ), + ) + ), ), ] diff --git a/hypha/apply/funds/migrations/0041_roundbasereviewform.py b/hypha/apply/funds/migrations/0041_roundbasereviewform.py index 3e8f52c0aa..e8987e4623 100644 --- a/hypha/apply/funds/migrations/0041_roundbasereviewform.py +++ b/hypha/apply/funds/migrations/0041_roundbasereviewform.py @@ -6,24 +6,47 @@ class Migration(migrations.Migration): - dependencies = [ - ('review', '0006_remove_review_review'), - ('funds', '0040_add_duration_stream_to_streamfield_definition'), + ("review", "0006_remove_review_review"), + ("funds", "0040_add_duration_stream_to_streamfield_definition"), ] operations = [ migrations.CreateModel( - name='RoundBaseReviewForm', + name="RoundBaseReviewForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='review.ReviewForm')), - ('round', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='review_forms', to='funds.RoundBase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="review.ReviewForm", + ), + ), + ( + "round", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="review_forms", + to="funds.RoundBase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0042_update_json_encoder.py b/hypha/apply/funds/migrations/0042_update_json_encoder.py index d64451728d..a22ab1b39e 100644 --- a/hypha/apply/funds/migrations/0042_update_json_encoder.py +++ b/hypha/apply/funds/migrations/0042_update_json_encoder.py @@ -6,20 +6,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0041_roundbasereviewform'), + ("funds", "0041_roundbasereviewform"), ] operations = [ migrations.AlterField( - model_name='applicationrevision', - name='form_data', - field=django.contrib.postgres.fields.jsonb.JSONField(encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder), + model_name="applicationrevision", + name="form_data", + field=django.contrib.postgres.fields.jsonb.JSONField( + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_data', - field=django.contrib.postgres.fields.jsonb.JSONField(encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder), + model_name="applicationsubmission", + name="form_data", + field=django.contrib.postgres.fields.jsonb.JSONField( + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder + ), ), ] diff --git a/hypha/apply/funds/migrations/0043_auto_20180926_0948.py b/hypha/apply/funds/migrations/0043_auto_20180926_0948.py index e667902340..1008172011 100644 --- a/hypha/apply/funds/migrations/0043_auto_20180926_0948.py +++ b/hypha/apply/funds/migrations/0043_auto_20180926_0948.py @@ -8,20 +8,1147 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0042_update_json_encoder'), + ("funds", "0042_update_json_encoder"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0044_add_named_blocks.py b/hypha/apply/funds/migrations/0044_add_named_blocks.py index 42b29bbb93..ebdbb9619a 100644 --- a/hypha/apply/funds/migrations/0044_add_named_blocks.py +++ b/hypha/apply/funds/migrations/0044_add_named_blocks.py @@ -8,20 +8,1171 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0043_auto_20180926_0948'), + ("funds", "0043_auto_20180926_0948"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Other', label='Paragraph')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Other", label="Paragraph"), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0045_new_workflow.py b/hypha/apply/funds/migrations/0045_new_workflow.py index 21dab3f122..b3918fb3b1 100644 --- a/hypha/apply/funds/migrations/0045_new_workflow.py +++ b/hypha/apply/funds/migrations/0045_new_workflow.py @@ -4,30 +4,65 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0044_add_named_blocks'), + ("funds", "0044_add_named_blocks"), ] operations = [ migrations.AlterField( - model_name='applicationbase', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="applicationbase", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="applicationsubmission", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='labbase', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="labbase", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='roundbase', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="roundbase", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), ] diff --git a/hypha/apply/funds/migrations/0046_rename_fields.py b/hypha/apply/funds/migrations/0046_rename_fields.py index 939ed2b2a9..749994a77f 100644 --- a/hypha/apply/funds/migrations/0046_rename_fields.py +++ b/hypha/apply/funds/migrations/0046_rename_fields.py @@ -8,20 +8,1175 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0045_new_workflow'), + ("funds", "0045_new_workflow"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0047_add_markdown.py b/hypha/apply/funds/migrations/0047_add_markdown.py index 7ff965c11a..edf54adacc 100644 --- a/hypha/apply/funds/migrations/0047_add_markdown.py +++ b/hypha/apply/funds/migrations/0047_add_markdown.py @@ -8,20 +8,1235 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0046_rename_fields'), + ("funds", "0046_rename_fields"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0048_add_field_slack_channel.py b/hypha/apply/funds/migrations/0048_add_field_slack_channel.py index 328a04eed0..ddd51d7c70 100644 --- a/hypha/apply/funds/migrations/0048_add_field_slack_channel.py +++ b/hypha/apply/funds/migrations/0048_add_field_slack_channel.py @@ -4,20 +4,27 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0047_add_markdown'), + ("funds", "0047_add_markdown"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='slack_channel', - field=models.CharField(blank=True, help_text='The slack #channel for notifications.', max_length=128), + model_name="applicationbase", + name="slack_channel", + field=models.CharField( + blank=True, + help_text="The slack #channel for notifications.", + max_length=128, + ), ), migrations.AddField( - model_name='labbase', - name='slack_channel', - field=models.CharField(blank=True, help_text='The slack #channel for notifications.', max_length=128), + model_name="labbase", + name="slack_channel", + field=models.CharField( + blank=True, + help_text="The slack #channel for notifications.", + max_length=128, + ), ), ] diff --git a/hypha/apply/funds/migrations/0049_screening_status.py b/hypha/apply/funds/migrations/0049_screening_status.py index ad1fb85306..7f5df07ea6 100644 --- a/hypha/apply/funds/migrations/0049_screening_status.py +++ b/hypha/apply/funds/migrations/0049_screening_status.py @@ -5,25 +5,38 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0048_add_field_slack_channel'), + ("funds", "0048_add_field_slack_channel"), ] operations = [ migrations.CreateModel( - name='ScreeningStatus', + name="ScreeningStatus", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=128)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=128)), ], options={ - 'verbose_name_plural': 'screening statuses', + "verbose_name_plural": "screening statuses", }, ), migrations.AddField( - model_name='applicationsubmission', - name='screening_status', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='funds.ScreeningStatus', verbose_name='screening status'), + model_name="applicationsubmission", + name="screening_status", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="funds.ScreeningStatus", + verbose_name="screening status", + ), ), ] diff --git a/hypha/apply/funds/migrations/0050_roundsandlabs.py b/hypha/apply/funds/migrations/0050_roundsandlabs.py index c1f65610ca..8b04203930 100644 --- a/hypha/apply/funds/migrations/0050_roundsandlabs.py +++ b/hypha/apply/funds/migrations/0050_roundsandlabs.py @@ -4,21 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('funds', '0049_screening_status'), + ("wagtailcore", "0040_page_draft_title"), + ("funds", "0049_screening_status"), ] operations = [ migrations.CreateModel( - name='RoundsAndLabs', - fields=[ - ], + name="RoundsAndLabs", + fields=[], options={ - 'proxy': True, - 'indexes': [], + "proxy": True, + "indexes": [], }, - bases=('wagtailcore.page',), + bases=("wagtailcore.page",), ), ] diff --git a/hypha/apply/funds/migrations/0051_applicationsubmission_partners.py b/hypha/apply/funds/migrations/0051_applicationsubmission_partners.py index b50d68de3a..9f72f539d3 100644 --- a/hypha/apply/funds/migrations/0051_applicationsubmission_partners.py +++ b/hypha/apply/funds/migrations/0051_applicationsubmission_partners.py @@ -5,16 +5,20 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0050_roundsandlabs'), + ("funds", "0050_roundsandlabs"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='partners', - field=models.ManyToManyField(blank=True, limit_choices_to={'groups__name': 'Partner'}, related_name='submissions_partner', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="partners", + field=models.ManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Partner"}, + related_name="submissions_partner", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/funds/migrations/0052_reviewerrole.py b/hypha/apply/funds/migrations/0052_reviewerrole.py index b1d11e1774..9f87d91cbc 100644 --- a/hypha/apply/funds/migrations/0052_reviewerrole.py +++ b/hypha/apply/funds/migrations/0052_reviewerrole.py @@ -5,20 +5,43 @@ class Migration(migrations.Migration): - dependencies = [ - ('images', '0003_customimage_drupal_id'), - ('funds', '0051_applicationsubmission_partners'), + ("images", "0003_customimage_drupal_id"), + ("funds", "0051_applicationsubmission_partners"), ] operations = [ migrations.CreateModel( - name='ReviewerRole', + name="ReviewerRole", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=128)), - ('order', models.IntegerField(blank=True, help_text='The order this role should appear in the Update Reviewers form.', null=True)), - ('icon', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='images.CustomImage')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=128)), + ( + "order", + models.IntegerField( + blank=True, + help_text="The order this role should appear in the Update Reviewers form.", + null=True, + ), + ), + ( + "icon", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="images.CustomImage", + ), + ), ], ), ] diff --git a/hypha/apply/funds/migrations/0053_assigned_reviewers_pre.py b/hypha/apply/funds/migrations/0053_assigned_reviewers_pre.py index 6ffb8a9196..165c50dcac 100644 --- a/hypha/apply/funds/migrations/0053_assigned_reviewers_pre.py +++ b/hypha/apply/funds/migrations/0053_assigned_reviewers_pre.py @@ -6,38 +6,74 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0052_reviewerrole'), + ("funds", "0052_reviewerrole"), ] operations = [ migrations.CreateModel( - name='AssignedReviewers', + name="AssignedReviewers", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('reviewer', models.ForeignKey(limit_choices_to={'groups__name__in': ['Staff', 'Reviewer']}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ('role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='funds.ReviewerRole')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "reviewer", + models.ForeignKey( + limit_choices_to={"groups__name__in": ["Staff", "Reviewer"]}, + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "role", + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="funds.ReviewerRole", + ), + ), ], ), migrations.AlterField( - model_name='applicationsubmission', - name='reviewers', - field=models.ManyToManyField(blank=True, limit_choices_to={'groups__name__in': ['Staff', 'Reviewer']}, related_name='submissions_reviewer_OLD', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="reviewers", + field=models.ManyToManyField( + blank=True, + limit_choices_to={"groups__name__in": ["Staff", "Reviewer"]}, + related_name="submissions_reviewer_OLD", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddField( - model_name='assignedreviewers', - name='submission', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assigned', to='funds.ApplicationSubmission'), + model_name="assignedreviewers", + name="submission", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="assigned", + to="funds.ApplicationSubmission", + ), ), migrations.AddField( - model_name='applicationsubmission', - name='reviewers_new', - field=models.ManyToManyField(blank=True, related_name='submissions_reviewer', through='funds.AssignedReviewers', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="reviewers_new", + field=models.ManyToManyField( + blank=True, + related_name="submissions_reviewer", + through="funds.AssignedReviewers", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterUniqueTogether( - name='assignedreviewers', - unique_together={('submission', 'role')}, + name="assignedreviewers", + unique_together={("submission", "role")}, ), ] diff --git a/hypha/apply/funds/migrations/0054_move_reviewer_data.py b/hypha/apply/funds/migrations/0054_move_reviewer_data.py index ff09ad0e6c..9f15d26da5 100644 --- a/hypha/apply/funds/migrations/0054_move_reviewer_data.py +++ b/hypha/apply/funds/migrations/0054_move_reviewer_data.py @@ -6,24 +6,26 @@ def move_reviewer_data(apps, schema_editor): # We need to move data to the new `reviewers_new` field which will be renamed to `reviewers` in the next migration # This data migration is necessary because you cannot add a through model to an existing M2M field - ApplicationSubmission = apps.get_model('funds', 'ApplicationSubmission') - AssignedReviewers = apps.get_model('funds', 'AssignedReviewers') + ApplicationSubmission = apps.get_model("funds", "ApplicationSubmission") + AssignedReviewers = apps.get_model("funds", "AssignedReviewers") for submission in ApplicationSubmission.objects.all(): AssignedReviewers.objects.bulk_create( AssignedReviewers( submission=submission, reviewer=reviewer, role=None, - ) for reviewer in submission.reviewers.all() + ) + for reviewer in submission.reviewers.all() ) class Migration(migrations.Migration): - dependencies = [ - ('funds', '0053_assigned_reviewers_pre'), + ("funds", "0053_assigned_reviewers_pre"), ] operations = [ - migrations.RunPython(move_reviewer_data, reverse_code=migrations.RunPython.noop), + migrations.RunPython( + move_reviewer_data, reverse_code=migrations.RunPython.noop + ), ] diff --git a/hypha/apply/funds/migrations/0055_remove_applicationsubmission_reviewers.py b/hypha/apply/funds/migrations/0055_remove_applicationsubmission_reviewers.py index 394dbb5e3b..b435c098f9 100644 --- a/hypha/apply/funds/migrations/0055_remove_applicationsubmission_reviewers.py +++ b/hypha/apply/funds/migrations/0055_remove_applicationsubmission_reviewers.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0054_move_reviewer_data'), + ("funds", "0054_move_reviewer_data"), ] operations = [ migrations.RemoveField( - model_name='applicationsubmission', - name='reviewers', + model_name="applicationsubmission", + name="reviewers", ), ] diff --git a/hypha/apply/funds/migrations/0056_reviewers_rename.py b/hypha/apply/funds/migrations/0056_reviewers_rename.py index ff88498a72..3ab18af9e3 100644 --- a/hypha/apply/funds/migrations/0056_reviewers_rename.py +++ b/hypha/apply/funds/migrations/0056_reviewers_rename.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0055_remove_applicationsubmission_reviewers'), + ("funds", "0055_remove_applicationsubmission_reviewers"), ] operations = [ migrations.RenameField( - model_name='applicationsubmission', - old_name='reviewers_new', - new_name='reviewers', + model_name="applicationsubmission", + old_name="reviewers_new", + new_name="reviewers", ), ] diff --git a/hypha/apply/funds/migrations/0057_start_date_blank_null_roundbase.py b/hypha/apply/funds/migrations/0057_start_date_blank_null_roundbase.py index 4de6a79112..63c0f7c876 100644 --- a/hypha/apply/funds/migrations/0057_start_date_blank_null_roundbase.py +++ b/hypha/apply/funds/migrations/0057_start_date_blank_null_roundbase.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0056_reviewers_rename'), + ("funds", "0056_reviewers_rename"), ] operations = [ migrations.AlterField( - model_name='roundbase', - name='start_date', + model_name="roundbase", + name="start_date", field=models.DateField(blank=True, default=datetime.date.today, null=True), ), ] diff --git a/hypha/apply/funds/migrations/0058_add_group_toggle.py b/hypha/apply/funds/migrations/0058_add_group_toggle.py index 6f3459e530..a15acdec02 100644 --- a/hypha/apply/funds/migrations/0058_add_group_toggle.py +++ b/hypha/apply/funds/migrations/0058_add_group_toggle.py @@ -8,20 +8,1297 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0057_start_date_blank_null_roundbase'), + ("funds", "0057_start_date_blank_null_roundbase"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0059_add_community_review_workflow.py b/hypha/apply/funds/migrations/0059_add_community_review_workflow.py index 81aaae5d56..a2a4e0e01d 100644 --- a/hypha/apply/funds/migrations/0059_add_community_review_workflow.py +++ b/hypha/apply/funds/migrations/0059_add_community_review_workflow.py @@ -4,30 +4,69 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0058_add_group_toggle'), + ("funds", "0058_add_group_toggle"), ] operations = [ migrations.AlterField( - model_name='applicationbase', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('single_com', 'Request with community review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="applicationbase", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("single_com", "Request with community review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('single_com', 'Request with community review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="applicationsubmission", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("single_com", "Request with community review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='labbase', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('single_com', 'Request with community review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="labbase", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("single_com", "Request with community review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), migrations.AlterField( - model_name='roundbase', - name='workflow_name', - field=models.CharField(choices=[('single', 'Request'), ('single_ext', 'Request with external review'), ('single_com', 'Request with community review'), ('double', 'Concept & Proposal')], default='single', max_length=100, verbose_name='Workflow'), + model_name="roundbase", + name="workflow_name", + field=models.CharField( + choices=[ + ("single", "Request"), + ("single_ext", "Request with external review"), + ("single_com", "Request with community review"), + ("double", "Concept & Proposal"), + ], + default="single", + max_length=100, + verbose_name="Workflow", + ), ), ] diff --git a/hypha/apply/funds/migrations/0060_add_duration_type_in_duration_block.py b/hypha/apply/funds/migrations/0060_add_duration_type_in_duration_block.py index ff2d87470b..b3c0106e57 100644 --- a/hypha/apply/funds/migrations/0060_add_duration_type_in_duration_block.py +++ b/hypha/apply/funds/migrations/0060_add_duration_type_in_duration_block.py @@ -8,20 +8,1317 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0059_add_community_review_workflow'), + ("funds", "0059_add_community_review_workflow"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0061_prepare_assigned_reviewers_for_data_migration.py b/hypha/apply/funds/migrations/0061_prepare_assigned_reviewers_for_data_migration.py index 9b6685ae6b..69fb75a52b 100644 --- a/hypha/apply/funds/migrations/0061_prepare_assigned_reviewers_for_data_migration.py +++ b/hypha/apply/funds/migrations/0061_prepare_assigned_reviewers_for_data_migration.py @@ -6,26 +6,38 @@ class Migration(migrations.Migration): - dependencies = [ - ('auth', '0009_alter_user_last_name_max_length'), + ("auth", "0009_alter_user_last_name_max_length"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0060_add_duration_type_in_duration_block'), + ("funds", "0060_add_duration_type_in_duration_block"), ] operations = [ migrations.AddField( - model_name='assignedreviewers', - name='type', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='auth.Group'), + model_name="assignedreviewers", + name="type", + field=models.ForeignKey( + null=True, on_delete=django.db.models.deletion.PROTECT, to="auth.Group" + ), ), migrations.AlterField( - model_name='assignedreviewers', - name='reviewer', - field=models.ForeignKey(limit_choices_to={'groups__name__in': ['Staff', 'Reviewer', 'Community reviewer', 'Partner']}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + model_name="assignedreviewers", + name="reviewer", + field=models.ForeignKey( + limit_choices_to={ + "groups__name__in": [ + "Staff", + "Reviewer", + "Community reviewer", + "Partner", + ] + }, + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterUniqueTogether( - name='assignedreviewers', - unique_together={('submission', 'role'), ('submission', 'reviewer')}, + name="assignedreviewers", + unique_together={("submission", "role"), ("submission", "reviewer")}, ), ] diff --git a/hypha/apply/funds/migrations/0062_data_migrate_type_for_assigned_reviewers.py b/hypha/apply/funds/migrations/0062_data_migrate_type_for_assigned_reviewers.py index a1a00be538..3c4bcb89e9 100644 --- a/hypha/apply/funds/migrations/0062_data_migrate_type_for_assigned_reviewers.py +++ b/hypha/apply/funds/migrations/0062_data_migrate_type_for_assigned_reviewers.py @@ -6,24 +6,32 @@ # importing and creating a future dependency. Changes to Group names should # be handled in another migration -STAFF_GROUP_NAME = 'Staff' -REVIEWER_GROUP_NAME = 'Reviewer' -PARTNER_GROUP_NAME = 'Partner' -COMMUNITY_REVIEWER_GROUP_NAME = 'Community reviewer' +STAFF_GROUP_NAME = "Staff" +REVIEWER_GROUP_NAME = "Reviewer" +PARTNER_GROUP_NAME = "Partner" +COMMUNITY_REVIEWER_GROUP_NAME = "Community reviewer" -REVIEWER_GROUPS = {STAFF_GROUP_NAME, +REVIEWER_GROUPS = { + STAFF_GROUP_NAME, REVIEWER_GROUP_NAME, COMMUNITY_REVIEWER_GROUP_NAME, - PARTNER_GROUP_NAME,} + PARTNER_GROUP_NAME, +} def add_reviewer_type(apps, schema_editor): - AssignedReviewer = apps.get_model('funds', 'AssignedReviewers') - Group = apps.get_model('auth', 'Group') - for assigned in AssignedReviewer.objects.prefetch_related('reviewer__groups'): - groups = set(assigned.reviewer.groups.values_list('name', flat=True)) & REVIEWER_GROUPS + AssignedReviewer = apps.get_model("funds", "AssignedReviewers") + Group = apps.get_model("auth", "Group") + for assigned in AssignedReviewer.objects.prefetch_related("reviewer__groups"): + groups = ( + set(assigned.reviewer.groups.values_list("name", flat=True)) + & REVIEWER_GROUPS + ) if len(groups) > 1: - if PARTNER_GROUP_NAME in groups and assigned.reviewer in assigned.submission.partners.all(): + if ( + PARTNER_GROUP_NAME in groups + and assigned.reviewer in assigned.submission.partners.all() + ): groups = {PARTNER_GROUP_NAME} elif COMMUNITY_REVIEWER_GROUP_NAME in groups: groups = {COMMUNITY_REVIEWER_GROUP_NAME} @@ -43,9 +51,8 @@ def add_reviewer_type(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('funds', '0061_prepare_assigned_reviewers_for_data_migration'), + ("funds", "0061_prepare_assigned_reviewers_for_data_migration"), ] operations = [ diff --git a/hypha/apply/funds/migrations/0063_make_reviewer_type_required.py b/hypha/apply/funds/migrations/0063_make_reviewer_type_required.py index b094dfd8c4..aba3c16c85 100644 --- a/hypha/apply/funds/migrations/0063_make_reviewer_type_required.py +++ b/hypha/apply/funds/migrations/0063_make_reviewer_type_required.py @@ -5,15 +5,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0062_data_migrate_type_for_assigned_reviewers'), + ("funds", "0062_data_migrate_type_for_assigned_reviewers"), ] operations = [ migrations.AlterField( - model_name='assignedreviewers', - name='type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='auth.Group'), + model_name="assignedreviewers", + name="type", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to="auth.Group" + ), ), ] diff --git a/hypha/apply/funds/migrations/0064_group_toggle_end_block.py b/hypha/apply/funds/migrations/0064_group_toggle_end_block.py index d4dfaee7ac..62977787ab 100644 --- a/hypha/apply/funds/migrations/0064_group_toggle_end_block.py +++ b/hypha/apply/funds/migrations/0064_group_toggle_end_block.py @@ -9,20 +9,1329 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0063_make_reviewer_type_required'), + ("funds", "0063_make_reviewer_type_required"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0065_applicationsubmission_meta_categories.py b/hypha/apply/funds/migrations/0065_applicationsubmission_meta_categories.py index 55c4507a8c..97907e8cee 100644 --- a/hypha/apply/funds/migrations/0065_applicationsubmission_meta_categories.py +++ b/hypha/apply/funds/migrations/0065_applicationsubmission_meta_categories.py @@ -4,16 +4,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0002_metacategory'), - ('funds', '0064_group_toggle_end_block'), + ("categories", "0002_metacategory"), + ("funds", "0064_group_toggle_end_block"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='meta_categories', - field=models.ManyToManyField(blank=True, related_name='submissions', to='categories.MetaCategory'), + model_name="applicationsubmission", + name="meta_categories", + field=models.ManyToManyField( + blank=True, related_name="submissions", to="categories.MetaCategory" + ), ), ] diff --git a/hypha/apply/funds/migrations/0066_add_stage_to_selected_forms.py b/hypha/apply/funds/migrations/0066_add_stage_to_selected_forms.py index 4a9e9ae107..ff52fa83d8 100644 --- a/hypha/apply/funds/migrations/0066_add_stage_to_selected_forms.py +++ b/hypha/apply/funds/migrations/0066_add_stage_to_selected_forms.py @@ -4,28 +4,33 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0065_applicationsubmission_meta_categories'), + ("funds", "0065_applicationsubmission_meta_categories"), ] operations = [ migrations.AddField( - model_name='applicationbaseform', - name='stage', - field=models.PositiveSmallIntegerField(choices=[(1, '1st Stage'), (2, '2nd Stage')], default=1), + model_name="applicationbaseform", + name="stage", + field=models.PositiveSmallIntegerField( + choices=[(1, "1st Stage"), (2, "2nd Stage")], default=1 + ), preserve_default=False, ), migrations.AddField( - model_name='labbaseform', - name='stage', - field=models.PositiveSmallIntegerField(choices=[(1, '1st Stage'), (2, '2nd Stage')], default=1), + model_name="labbaseform", + name="stage", + field=models.PositiveSmallIntegerField( + choices=[(1, "1st Stage"), (2, "2nd Stage")], default=1 + ), preserve_default=False, ), migrations.AddField( - model_name='roundbaseform', - name='stage', - field=models.PositiveSmallIntegerField(choices=[(1, '1st Stage'), (2, '2nd Stage')], default=1), + model_name="roundbaseform", + name="stage", + field=models.PositiveSmallIntegerField( + choices=[(1, "1st Stage"), (2, "2nd Stage")], default=1 + ), preserve_default=False, ), ] diff --git a/hypha/apply/funds/migrations/0067_data_migration_for_one_form_per_stage.py b/hypha/apply/funds/migrations/0067_data_migration_for_one_form_per_stage.py index 4fc31985f1..2b48086ba4 100644 --- a/hypha/apply/funds/migrations/0067_data_migration_for_one_form_per_stage.py +++ b/hypha/apply/funds/migrations/0067_data_migration_for_one_form_per_stage.py @@ -10,15 +10,15 @@ def increment_stage_in_forms(forms): """ for index, form in enumerate(forms.all(), 1): form.stage = index - form.save(update_fields=['stage']) + form.save(update_fields=["stage"]) def one_application_form_per_stage(apps, schema_editor): - Fund = apps.get_model('funds', 'FundType') - RequestForPartners = apps.get_model('funds', 'RequestForPartners') - Round = apps.get_model('funds', 'Round') - SealedRound = apps.get_model('funds', 'SealedRound') - LabType = apps.get_model('funds', 'LabType') + Fund = apps.get_model("funds", "FundType") + RequestForPartners = apps.get_model("funds", "RequestForPartners") + Round = apps.get_model("funds", "Round") + SealedRound = apps.get_model("funds", "SealedRound") + LabType = apps.get_model("funds", "LabType") for fund in Fund.objects.all(): if fund.forms.count() > 1: @@ -42,9 +42,8 @@ def one_application_form_per_stage(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('funds', '0066_add_stage_to_selected_forms'), + ("funds", "0066_add_stage_to_selected_forms"), ] operations = [ diff --git a/hypha/apply/funds/migrations/0068_add_help_link_field.py b/hypha/apply/funds/migrations/0068_add_help_link_field.py index 1c686e48f4..605f8a85f0 100644 --- a/hypha/apply/funds/migrations/0068_add_help_link_field.py +++ b/hypha/apply/funds/migrations/0068_add_help_link_field.py @@ -9,20 +9,1605 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0067_data_migration_for_one_form_per_stage'), + ("funds", "0067_data_migration_for_one_form_per_stage"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0068_link_funds_and_labs_to_paf.py b/hypha/apply/funds/migrations/0068_link_funds_and_labs_to_paf.py index d82e486bc9..7239c8b4a9 100644 --- a/hypha/apply/funds/migrations/0068_link_funds_and_labs_to_paf.py +++ b/hypha/apply/funds/migrations/0068_link_funds_and_labs_to_paf.py @@ -5,21 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0018_projectapprovalform'), - ('funds', '0067_data_migration_for_one_form_per_stage'), + ("application_projects", "0018_projectapprovalform"), + ("funds", "0067_data_migration_for_one_form_per_stage"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='approval_form', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='funds', to='application_projects.ProjectApprovalForm'), + model_name="applicationbase", + name="approval_form", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="funds", + to="application_projects.ProjectApprovalForm", + ), ), migrations.AddField( - model_name='labbase', - name='approval_form', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='labs', to='application_projects.ProjectApprovalForm'), + model_name="labbase", + name="approval_form", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="labs", + to="application_projects.ProjectApprovalForm", + ), ), ] diff --git a/hypha/apply/funds/migrations/0069_merge_20190905_0403.py b/hypha/apply/funds/migrations/0069_merge_20190905_0403.py index 8e20eaf23c..53ad13c737 100644 --- a/hypha/apply/funds/migrations/0069_merge_20190905_0403.py +++ b/hypha/apply/funds/migrations/0069_merge_20190905_0403.py @@ -4,11 +4,9 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0068_link_funds_and_labs_to_paf'), - ('funds', '0068_add_help_link_field'), + ("funds", "0068_link_funds_and_labs_to_paf"), + ("funds", "0068_add_help_link_field"), ] - operations = [ - ] + operations = [] diff --git a/hypha/apply/funds/migrations/0070_rename_meta_categories_to_meta_terms.py b/hypha/apply/funds/migrations/0070_rename_meta_categories_to_meta_terms.py index 44e7746dc8..16bd2dcdb9 100644 --- a/hypha/apply/funds/migrations/0070_rename_meta_categories_to_meta_terms.py +++ b/hypha/apply/funds/migrations/0070_rename_meta_categories_to_meta_terms.py @@ -4,20 +4,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('categories', '0003_rename_meta_categories_to_meta_terms'), - ('funds', '0069_merge_20190905_0403'), + ("categories", "0003_rename_meta_categories_to_meta_terms"), + ("funds", "0069_merge_20190905_0403"), ] operations = [ migrations.RemoveField( - model_name='applicationsubmission', - name='meta_categories', + model_name="applicationsubmission", + name="meta_categories", ), migrations.AddField( - model_name='applicationsubmission', - name='meta_terms', - field=models.ManyToManyField(blank=True, related_name='submissions', to='categories.MetaTerm'), + model_name="applicationsubmission", + name="meta_terms", + field=models.ManyToManyField( + blank=True, related_name="submissions", to="categories.MetaTerm" + ), ), ] diff --git a/hypha/apply/funds/migrations/0071_update_field_reviewer.py b/hypha/apply/funds/migrations/0071_update_field_reviewer.py index c657f46e26..3184bb3bda 100644 --- a/hypha/apply/funds/migrations/0071_update_field_reviewer.py +++ b/hypha/apply/funds/migrations/0071_update_field_reviewer.py @@ -6,15 +6,20 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0070_rename_meta_categories_to_meta_terms'), + ("funds", "0070_rename_meta_categories_to_meta_terms"), ] operations = [ migrations.AlterField( - model_name='assignedreviewers', - name='reviewer', - field=models.ForeignKey(limit_choices_to={'groups__name__in': ['Staff', 'Reviewer', 'Community reviewer']}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + model_name="assignedreviewers", + name="reviewer", + field=models.ForeignKey( + limit_choices_to={ + "groups__name__in": ["Staff", "Reviewer", "Community reviewer"] + }, + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/funds/migrations/0072_add_guide_link_field.py b/hypha/apply/funds/migrations/0072_add_guide_link_field.py index d2d47cbb59..b1c637d981 100644 --- a/hypha/apply/funds/migrations/0072_add_guide_link_field.py +++ b/hypha/apply/funds/migrations/0072_add_guide_link_field.py @@ -4,20 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0071_update_field_reviewer'), + ("funds", "0071_update_field_reviewer"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='guide_link', - field=models.URLField(blank=True, help_text='Link to the apply guide.', max_length=255), + model_name="applicationbase", + name="guide_link", + field=models.URLField( + blank=True, help_text="Link to the apply guide.", max_length=255 + ), ), migrations.AddField( - model_name='labbase', - name='guide_link', - field=models.URLField(blank=True, help_text='Link to the apply guide.', max_length=255), + model_name="labbase", + name="guide_link", + field=models.URLField( + blank=True, help_text="Link to the apply guide.", max_length=255 + ), ), ] diff --git a/hypha/apply/funds/migrations/0073_reminder.py b/hypha/apply/funds/migrations/0073_reminder.py index 247398da79..55fc86b4dd 100644 --- a/hypha/apply/funds/migrations/0073_reminder.py +++ b/hypha/apply/funds/migrations/0073_reminder.py @@ -6,25 +6,52 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0072_add_guide_link_field'), + ("funds", "0072_add_guide_link_field"), ] operations = [ migrations.CreateModel( - name='Reminder', + name="Reminder", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('time', models.DateTimeField()), - ('action', models.CharField(choices=[('reviewers_review', 'Remind reviewers to Review')], default='reviewers_review', max_length=50)), - ('sent', models.BooleanField(default=False)), - ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reminders', to='funds.ApplicationSubmission')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("time", models.DateTimeField()), + ( + "action", + models.CharField( + choices=[("reviewers_review", "Remind reviewers to Review")], + default="reviewers_review", + max_length=50, + ), + ), + ("sent", models.BooleanField(default=False)), + ( + "submission", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="reminders", + to="funds.ApplicationSubmission", + ), + ), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ - 'ordering': ['-time'], + "ordering": ["-time"], }, ), ] diff --git a/hypha/apply/funds/migrations/0074_add_word_limit_to_text_blocks.py b/hypha/apply/funds/migrations/0074_add_word_limit_to_text_blocks.py index 5890f88bca..23b0bd3282 100644 --- a/hypha/apply/funds/migrations/0074_add_word_limit_to_text_blocks.py +++ b/hypha/apply/funds/migrations/0074_add_word_limit_to_text_blocks.py @@ -9,20 +9,1641 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0073_reminder'), + ("funds", "0073_reminder"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0075_auto_20200629_1707.py b/hypha/apply/funds/migrations/0075_auto_20200629_1707.py index 96dc9feef8..2a10fcbcce 100644 --- a/hypha/apply/funds/migrations/0075_auto_20200629_1707.py +++ b/hypha/apply/funds/migrations/0075_auto_20200629_1707.py @@ -4,15 +4,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0074_add_word_limit_to_text_blocks'), + ("funds", "0074_add_word_limit_to_text_blocks"), ] operations = [ migrations.AlterField( - model_name='applicationbase', - name='slack_channel', - field=models.CharField(blank=True, help_text='The slack #channel for notifications. If left empty, notifications will go to the default channel.', max_length=128), + model_name="applicationbase", + name="slack_channel", + field=models.CharField( + blank=True, + help_text="The slack #channel for notifications. If left empty, notifications will go to the default channel.", + max_length=128, + ), ), ] diff --git a/hypha/apply/funds/migrations/0076_multi_input_char_block.py b/hypha/apply/funds/migrations/0076_multi_input_char_block.py index 0150b4103f..2d3f42986d 100644 --- a/hypha/apply/funds/migrations/0076_multi_input_char_block.py +++ b/hypha/apply/funds/migrations/0076_multi_input_char_block.py @@ -9,20 +9,1753 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0075_auto_20200629_1707'), + ("funds", "0075_auto_20200629_1707"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0077_add_determination_stream_field_forms.py b/hypha/apply/funds/migrations/0077_add_determination_stream_field_forms.py index 7c84636f35..49f1d31f3c 100644 --- a/hypha/apply/funds/migrations/0077_add_determination_stream_field_forms.py +++ b/hypha/apply/funds/migrations/0077_add_determination_stream_field_forms.py @@ -6,50 +6,121 @@ class Migration(migrations.Migration): - dependencies = [ - ('determinations', '0010_add_determination_stream_field_forms'), - ('funds', '0076_multi_input_char_block'), + ("determinations", "0010_add_determination_stream_field_forms"), + ("funds", "0076_multi_input_char_block"), ] operations = [ migrations.CreateModel( - name='RoundBaseDeterminationForm', + name="RoundBaseDeterminationForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='determinations.DeterminationForm')), - ('round', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='determination_forms', to='funds.RoundBase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="determinations.DeterminationForm", + ), + ), + ( + "round", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="determination_forms", + to="funds.RoundBase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='LabBaseDeterminationForm', + name="LabBaseDeterminationForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='determinations.DeterminationForm')), - ('lab', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='determination_forms', to='funds.LabBase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="determinations.DeterminationForm", + ), + ), + ( + "lab", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="determination_forms", + to="funds.LabBase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='ApplicationBaseDeterminationForm', + name="ApplicationBaseDeterminationForm", 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)), - ('application', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='determination_forms', to='funds.ApplicationBase')), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='determinations.DeterminationForm')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "application", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="determination_forms", + to="funds.ApplicationBase", + ), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="determinations.DeterminationForm", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0078_add_heading_block_to_form_fields_block.py b/hypha/apply/funds/migrations/0078_add_heading_block_to_form_fields_block.py index 5cfc827f99..587e34554d 100644 --- a/hypha/apply/funds/migrations/0078_add_heading_block_to_form_fields_block.py +++ b/hypha/apply/funds/migrations/0078_add_heading_block_to_form_fields_block.py @@ -9,20 +9,1803 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0077_add_determination_stream_field_forms'), + ("funds", "0077_add_determination_stream_field_forms"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0079_add_reviewer_settings_for_submission_access.py b/hypha/apply/funds/migrations/0079_add_reviewer_settings_for_submission_access.py index 2b4a822bce..804f99abba 100644 --- a/hypha/apply/funds/migrations/0079_add_reviewer_settings_for_submission_access.py +++ b/hypha/apply/funds/migrations/0079_add_reviewer_settings_for_submission_access.py @@ -5,26 +5,85 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0045_assign_unlock_grouppagepermission'), - ('funds', '0078_add_heading_block_to_form_fields_block'), + ("wagtailcore", "0045_assign_unlock_grouppagepermission"), + ("funds", "0078_add_heading_block_to_form_fields_block"), ] operations = [ migrations.CreateModel( - name='ReviewerSettings', + name="ReviewerSettings", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('submission', models.CharField(choices=[('all', 'All Submissions'), ('reviewed', 'Only reviewed Submissions')], default='all', help_text='Submissions for which reviewers should have access to', max_length=10)), - ('state', models.CharField(choices=[('all', 'All States'), ('ext_state_or_higher', 'Only External review and higher')], default='all', help_text='Submissions states for which reviewers should have access to', max_length=20)), - ('outcome', models.CharField(choices=[('all', 'All Outcomes'), ('accepted', 'Only Accepted')], default='all', help_text='Submissions outcomes for which reviewers should have access to', max_length=10)), - ('assigned', models.BooleanField(default=False, help_text='Submissions for which reviewer is assigned to')), - ('use_settings', models.BooleanField(default=False, help_text='Use the above configured variables to filter out submissions')), - ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "submission", + models.CharField( + choices=[ + ("all", "All Submissions"), + ("reviewed", "Only reviewed Submissions"), + ], + default="all", + help_text="Submissions for which reviewers should have access to", + max_length=10, + ), + ), + ( + "state", + models.CharField( + choices=[ + ("all", "All States"), + ("ext_state_or_higher", "Only External review and higher"), + ], + default="all", + help_text="Submissions states for which reviewers should have access to", + max_length=20, + ), + ), + ( + "outcome", + models.CharField( + choices=[ + ("all", "All Outcomes"), + ("accepted", "Only Accepted"), + ], + default="all", + help_text="Submissions outcomes for which reviewers should have access to", + max_length=10, + ), + ), + ( + "assigned", + models.BooleanField( + default=False, + help_text="Submissions for which reviewer is assigned to", + ), + ), + ( + "use_settings", + models.BooleanField( + default=False, + help_text="Use the above configured variables to filter out submissions", + ), + ), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Site", + ), + ), ], options={ - 'verbose_name': 'Reviewer Settings', + "verbose_name": "Reviewer Settings", }, ), ] diff --git a/hypha/apply/funds/migrations/0080_add_yes_and_default_fields_to_screening_status.py b/hypha/apply/funds/migrations/0080_add_yes_and_default_fields_to_screening_status.py index c44ee4cc1d..8a8d24cc69 100644 --- a/hypha/apply/funds/migrations/0080_add_yes_and_default_fields_to_screening_status.py +++ b/hypha/apply/funds/migrations/0080_add_yes_and_default_fields_to_screening_status.py @@ -4,20 +4,27 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0079_add_reviewer_settings_for_submission_access'), + ("funds", "0079_add_reviewer_settings_for_submission_access"), ] operations = [ migrations.AddField( - model_name='screeningstatus', - name='default', - field=models.BooleanField(default=False, help_text='Only one Yes and No screening status can be set as default.', verbose_name='Default Yes/No'), + model_name="screeningstatus", + name="default", + field=models.BooleanField( + default=False, + help_text="Only one Yes and No screening status can be set as default.", + verbose_name="Default Yes/No", + ), ), migrations.AddField( - model_name='screeningstatus', - name='yes', - field=models.BooleanField(default=False, help_text='Tick mark for Yes otherwise No.', verbose_name='Yes/No'), + model_name="screeningstatus", + name="yes", + field=models.BooleanField( + default=False, + help_text="Tick mark for Yes otherwise No.", + verbose_name="Yes/No", + ), ), ] diff --git a/hypha/apply/funds/migrations/0081_add_screening_statuses_field.py b/hypha/apply/funds/migrations/0081_add_screening_statuses_field.py index 61bc366e80..c966c615e7 100644 --- a/hypha/apply/funds/migrations/0081_add_screening_statuses_field.py +++ b/hypha/apply/funds/migrations/0081_add_screening_statuses_field.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0080_add_yes_and_default_fields_to_screening_status'), + ("funds", "0080_add_yes_and_default_fields_to_screening_status"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='screening_statuses', - field=models.ManyToManyField(blank=True, related_name='submissions', to='funds.ScreeningStatus'), + model_name="applicationsubmission", + name="screening_statuses", + field=models.ManyToManyField( + blank=True, related_name="submissions", to="funds.ScreeningStatus" + ), ), ] diff --git a/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py b/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py index 0f2d35214b..39fea40d3e 100644 --- a/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py +++ b/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py @@ -5,28 +5,29 @@ def make_many_screening_statuses(apps, schema_editor): """ - Adds the ScreeningStatus object in ApplicationSubmission.screening_status - to the many-to-many relationship in ApplicationSubmission.screening_statuses + Adds the ScreeningStatus object in ApplicationSubmission.screening_status + to the many-to-many relationship in ApplicationSubmission.screening_statuses """ - ApplicationSubmission = apps.get_model('funds', 'ApplicationSubmission') + ApplicationSubmission = apps.get_model("funds", "ApplicationSubmission") - for submission in ApplicationSubmission.objects.filter(screening_status__isnull=False): + for submission in ApplicationSubmission.objects.filter( + screening_status__isnull=False + ): if submission.screening_status: submission.screening_statuses.add(submission.screening_status) - ScreeningStatus = apps.get_model('funds', 'ScreeningStatus') + ScreeningStatus = apps.get_model("funds", "ScreeningStatus") if not ScreeningStatus.objects.filter(yes=True).exists(): - ScreeningStatus.objects.create(title='Accept', yes=True, default=True) + ScreeningStatus.objects.create(title="Accept", yes=True, default=True) if not ScreeningStatus.objects.filter(yes=False).exists(): - ScreeningStatus.objects.create(title='Dismiss', yes=False, default=True) + ScreeningStatus.objects.create(title="Dismiss", yes=False, default=True) class Migration(migrations.Migration): - dependencies = [ - ('funds', '0081_add_screening_statuses_field'), + ("funds", "0081_add_screening_statuses_field"), ] operations = [ diff --git a/hypha/apply/funds/migrations/0083_remove_screening_status_field.py b/hypha/apply/funds/migrations/0083_remove_screening_status_field.py index 2ebe21d055..bc7c07388b 100644 --- a/hypha/apply/funds/migrations/0083_remove_screening_status_field.py +++ b/hypha/apply/funds/migrations/0083_remove_screening_status_field.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0082_migrate_screening_status_to_screening_statuses'), + ("funds", "0082_migrate_screening_status_to_screening_statuses"), ] operations = [ migrations.RemoveField( - model_name='applicationsubmission', - name='screening_status', + model_name="applicationsubmission", + name="screening_status", ), ] diff --git a/hypha/apply/funds/migrations/0084_add_all_except_dismissed_outcome_reviewersettings.py b/hypha/apply/funds/migrations/0084_add_all_except_dismissed_outcome_reviewersettings.py index 4560254962..054d2d6def 100644 --- a/hypha/apply/funds/migrations/0084_add_all_except_dismissed_outcome_reviewersettings.py +++ b/hypha/apply/funds/migrations/0084_add_all_except_dismissed_outcome_reviewersettings.py @@ -4,15 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0083_remove_screening_status_field'), + ("funds", "0083_remove_screening_status_field"), ] operations = [ migrations.AlterField( - model_name='reviewersettings', - name='outcome', - field=models.CharField(choices=[('all', 'All Outcomes'), ('all_except_dismissed', 'All Outcomes Except Dismissed'), ('accepted', 'Only Accepted')], default='all', help_text='Submissions outcomes for which reviewers should have access to', max_length=20), + model_name="reviewersettings", + name="outcome", + field=models.CharField( + choices=[ + ("all", "All Outcomes"), + ("all_except_dismissed", "All Outcomes Except Dismissed"), + ("accepted", "Only Accepted"), + ], + default="all", + help_text="Submissions outcomes for which reviewers should have access to", + max_length=20, + ), ), ] diff --git a/hypha/apply/funds/migrations/0085_add_days_to_duration_block.py b/hypha/apply/funds/migrations/0085_add_days_to_duration_block.py index 76dee25664..1656941b9a 100644 --- a/hypha/apply/funds/migrations/0085_add_days_to_duration_block.py +++ b/hypha/apply/funds/migrations/0085_add_days_to_duration_block.py @@ -9,20 +9,1805 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0084_add_all_except_dismissed_outcome_reviewersettings'), + ("funds", "0084_add_all_except_dismissed_outcome_reviewersettings"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(label='Leave blank to use the default Category help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Leave blank to use the default Category help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0086_applicationsubmission_summary.py b/hypha/apply/funds/migrations/0086_applicationsubmission_summary.py index e6e7ed3bc9..b344d9de86 100644 --- a/hypha/apply/funds/migrations/0086_applicationsubmission_summary.py +++ b/hypha/apply/funds/migrations/0086_applicationsubmission_summary.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0085_add_days_to_duration_block'), + ("funds", "0085_add_days_to_duration_block"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='summary', - field=models.TextField(blank=True, default='', null=True), + model_name="applicationsubmission", + name="summary", + field=models.TextField(blank=True, default="", null=True), ), ] diff --git a/hypha/apply/funds/migrations/0087_applicationsettings.py b/hypha/apply/funds/migrations/0087_applicationsettings.py index f813578d9e..2531f35670 100644 --- a/hypha/apply/funds/migrations/0087_applicationsettings.py +++ b/hypha/apply/funds/migrations/0087_applicationsettings.py @@ -6,23 +6,37 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0059_apply_collection_ordering'), - ('funds', '0086_applicationsubmission_summary'), + ("wagtailcore", "0059_apply_collection_ordering"), + ("funds", "0086_applicationsubmission_summary"), ] operations = [ migrations.CreateModel( - name='ApplicationSettings', + name="ApplicationSettings", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('extra_text_round', wagtail.fields.RichTextField(blank=True)), - ('extra_text_lab', wagtail.fields.RichTextField(blank=True)), - ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("extra_text_round", wagtail.fields.RichTextField(blank=True)), + ("extra_text_lab", wagtail.fields.RichTextField(blank=True)), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Site", + ), + ), ], options={ - 'verbose_name': 'application settings', + "verbose_name": "application settings", }, ), ] diff --git a/hypha/apply/funds/migrations/0088_auto_20210423_1257.py b/hypha/apply/funds/migrations/0088_auto_20210423_1257.py index d3e96f8dc8..9525bc6115 100644 --- a/hypha/apply/funds/migrations/0088_auto_20210423_1257.py +++ b/hypha/apply/funds/migrations/0088_auto_20210423_1257.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0087_applicationsettings'), + ("funds", "0087_applicationsettings"), ] operations = [ migrations.AddField( - model_name='reminder', - name='description', + model_name="reminder", + name="description", field=models.TextField(blank=True), ), migrations.AddField( - model_name='reminder', - name='title', - field=models.CharField(default='', max_length=60), + model_name="reminder", + name="title", + field=models.CharField(default="", max_length=60), ), ] diff --git a/hypha/apply/funds/migrations/0089_remove_project_approval_form_refrences.py b/hypha/apply/funds/migrations/0089_remove_project_approval_form_refrences.py index 9e867993b4..319147337d 100644 --- a/hypha/apply/funds/migrations/0089_remove_project_approval_form_refrences.py +++ b/hypha/apply/funds/migrations/0089_remove_project_approval_form_refrences.py @@ -4,22 +4,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0088_auto_20210423_1257'), + ("funds", "0088_auto_20210423_1257"), ] run_before = [ - ('application_projects', '0043_remove_project_approval_form'), + ("application_projects", "0043_remove_project_approval_form"), ] operations = [ migrations.RemoveField( - model_name='applicationbase', - name='approval_form', + model_name="applicationbase", + name="approval_form", ), migrations.RemoveField( - model_name='labbase', - name='approval_form', + model_name="labbase", + name="approval_form", ), ] diff --git a/hypha/apply/funds/migrations/0090_auto_20220111_1314.py b/hypha/apply/funds/migrations/0090_auto_20220111_1314.py index 6fc3de56c3..f433c27938 100644 --- a/hypha/apply/funds/migrations/0090_auto_20220111_1314.py +++ b/hypha/apply/funds/migrations/0090_auto_20220111_1314.py @@ -5,20 +5,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0089_remove_project_approval_form_refrences'), + ("funds", "0089_remove_project_approval_form_refrences"), ] operations = [ migrations.AlterField( - model_name='applicationrevision', - name='form_data', - field=models.JSONField(encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder), + model_name="applicationrevision", + name="form_data", + field=models.JSONField( + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_data', - field=models.JSONField(encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder), + model_name="applicationsubmission", + name="form_data", + field=models.JSONField( + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder + ), ), ] diff --git a/hypha/apply/funds/migrations/0091_category_block_label.py b/hypha/apply/funds/migrations/0091_category_block_label.py index 2af60c71e8..4b99259217 100644 --- a/hypha/apply/funds/migrations/0091_category_block_label.py +++ b/hypha/apply/funds/migrations/0091_category_block_label.py @@ -9,20 +9,1807 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0090_auto_20220111_1314'), + ("funds", "0090_auto_20220111_1314"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0092_auto_20220308_0827.py b/hypha/apply/funds/migrations/0092_auto_20220308_0827.py index f8d15f1a5d..6ada720512 100644 --- a/hypha/apply/funds/migrations/0092_auto_20220308_0827.py +++ b/hypha/apply/funds/migrations/0092_auto_20220308_0827.py @@ -9,20 +9,1819 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0091_category_block_label'), + ("funds", "0091_category_block_label"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0093_set_duration_false.py b/hypha/apply/funds/migrations/0093_set_duration_false.py index 64c23343f2..5cad22e7a6 100644 --- a/hypha/apply/funds/migrations/0093_set_duration_false.py +++ b/hypha/apply/funds/migrations/0093_set_duration_false.py @@ -4,21 +4,21 @@ def set_duration_required_false(apps, schema_editor): - ApplicationSubmission = apps.get_model('funds', 'ApplicationSubmission') + ApplicationSubmission = apps.get_model("funds", "ApplicationSubmission") for submission in ApplicationSubmission.objects.all(): for id, struct_child in enumerate(submission.form_fields): struct_value = struct_child.value - if struct_child.block_type == 'duration' and struct_value['required'] is None: - submission.form_fields[id].value['required'] = False + if ( + struct_child.block_type == "duration" + and struct_value["required"] is None + ): + submission.form_fields[id].value["required"] = False submission.save() class Migration(migrations.Migration): - dependencies = [ - ('funds', '0092_auto_20220308_0827'), + ("funds", "0092_auto_20220308_0827"), ] - operations = [ - migrations.RunPython(set_duration_required_false) - ] + operations = [migrations.RunPython(set_duration_required_false)] diff --git a/hypha/apply/funds/migrations/0094_auto_20220406_0800.py b/hypha/apply/funds/migrations/0094_auto_20220406_0800.py index 24866274d2..489402719d 100644 --- a/hypha/apply/funds/migrations/0094_auto_20220406_0800.py +++ b/hypha/apply/funds/migrations/0094_auto_20220406_0800.py @@ -9,20 +9,1847 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0093_set_duration_false'), + ("funds", "0093_set_duration_false"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0095_only_external_review_option.py b/hypha/apply/funds/migrations/0095_only_external_review_option.py index 04f995f420..c01cdd7f0d 100644 --- a/hypha/apply/funds/migrations/0095_only_external_review_option.py +++ b/hypha/apply/funds/migrations/0095_only_external_review_option.py @@ -4,15 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0094_auto_20220406_0800'), + ("funds", "0094_auto_20220406_0800"), ] operations = [ migrations.AlterField( - model_name='reviewersettings', - name='state', - field=models.CharField(choices=[('all', 'All States'), ('ext_state_or_higher', 'Only External review and higher'), ('ext_state_only', 'Only External review')], default='all', help_text='Submissions states for which reviewers should have access to', max_length=20), + model_name="reviewersettings", + name="state", + field=models.CharField( + choices=[ + ("all", "All States"), + ("ext_state_or_higher", "Only External review and higher"), + ("ext_state_only", "Only External review"), + ], + default="all", + help_text="Submissions states for which reviewers should have access to", + max_length=20, + ), ), ] diff --git a/hypha/apply/funds/migrations/0096_only_active_users.py b/hypha/apply/funds/migrations/0096_only_active_users.py index 0f0f2267e7..c42cfcb928 100644 --- a/hypha/apply/funds/migrations/0096_only_active_users.py +++ b/hypha/apply/funds/migrations/0096_only_active_users.py @@ -7,51 +7,92 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0095_only_external_review_option'), + ("funds", "0095_only_external_review_option"), ] operations = [ migrations.AlterField( - model_name='applicationbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer', 'is_active': True}, related_name='applicationbase_reviewers', to=settings.AUTH_USER_MODEL), + model_name="applicationbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer", "is_active": True}, + related_name="applicationbase_reviewers", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff', 'is_active': True}, on_delete=django.db.models.deletion.PROTECT, related_name='submission_lead', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff", "is_active": True}, + on_delete=django.db.models.deletion.PROTECT, + related_name="submission_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='partners', - field=models.ManyToManyField(blank=True, limit_choices_to={'groups__name': 'Partner', 'is_active': True}, related_name='submissions_partner', to=settings.AUTH_USER_MODEL), + model_name="applicationsubmission", + name="partners", + field=models.ManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Partner", "is_active": True}, + related_name="submissions_partner", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='assignedreviewers', - name='reviewer', - field=models.ForeignKey(limit_choices_to={'groups__name__in': ['Staff', 'Reviewer', 'Community reviewer'], 'is_active': True}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + model_name="assignedreviewers", + name="reviewer", + field=models.ForeignKey( + limit_choices_to={ + "groups__name__in": ["Staff", "Reviewer", "Community reviewer"], + "is_active": True, + }, + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='labbase', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff', 'is_active': True}, on_delete=django.db.models.deletion.PROTECT, related_name='lab_lead', to=settings.AUTH_USER_MODEL), + model_name="labbase", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff", "is_active": True}, + on_delete=django.db.models.deletion.PROTECT, + related_name="lab_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='labbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer', 'is_active': True}, related_name='labs_reviewer', to=settings.AUTH_USER_MODEL), + model_name="labbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer", "is_active": True}, + related_name="labs_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundbase', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff', 'is_active': True}, on_delete=django.db.models.deletion.PROTECT, related_name='roundbase_lead', to=settings.AUTH_USER_MODEL), + model_name="roundbase", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff", "is_active": True}, + on_delete=django.db.models.deletion.PROTECT, + related_name="roundbase_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer', 'is_active': True}, related_name='roundbase_reviewer', to=settings.AUTH_USER_MODEL), + model_name="roundbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer", "is_active": True}, + related_name="roundbase_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/funds/migrations/0097_applicationbaseexternalreviewform_labbaseexternalreviewform_roundbaseexternalreviewform.py b/hypha/apply/funds/migrations/0097_applicationbaseexternalreviewform_labbaseexternalreviewform_roundbaseexternalreviewform.py index c6b322bc24..c3de8725d9 100644 --- a/hypha/apply/funds/migrations/0097_applicationbaseexternalreviewform_labbaseexternalreviewform_roundbaseexternalreviewform.py +++ b/hypha/apply/funds/migrations/0097_applicationbaseexternalreviewform_labbaseexternalreviewform_roundbaseexternalreviewform.py @@ -6,50 +6,121 @@ class Migration(migrations.Migration): - dependencies = [ - ('review', '0024_auto_20220111_1314'), - ('funds', '0096_only_active_users'), + ("review", "0024_auto_20220111_1314"), + ("funds", "0096_only_active_users"), ] operations = [ migrations.CreateModel( - name='RoundBaseExternalReviewForm', + name="RoundBaseExternalReviewForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='review.reviewform')), - ('round', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='external_review_forms', to='funds.roundbase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="review.reviewform", + ), + ), + ( + "round", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="external_review_forms", + to="funds.roundbase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='LabBaseExternalReviewForm', + name="LabBaseExternalReviewForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='review.reviewform')), - ('lab', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='external_review_forms', to='funds.labbase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="review.reviewform", + ), + ), + ( + "lab", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="external_review_forms", + to="funds.labbase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='ApplicationBaseExternalReviewForm', + name="ApplicationBaseExternalReviewForm", 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)), - ('application', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='external_review_forms', to='funds.applicationbase')), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='review.reviewform')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "application", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="external_review_forms", + to="funds.applicationbase", + ), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="review.reviewform", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0098_alter_applicationsubmission_submit_time.py b/hypha/apply/funds/migrations/0098_alter_applicationsubmission_submit_time.py index aecb8fc221..aeb8dbbe8a 100644 --- a/hypha/apply/funds/migrations/0098_alter_applicationsubmission_submit_time.py +++ b/hypha/apply/funds/migrations/0098_alter_applicationsubmission_submit_time.py @@ -4,15 +4,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0097_applicationbaseexternalreviewform_labbaseexternalreviewform_roundbaseexternalreviewform'), + ( + "funds", + "0097_applicationbaseexternalreviewform_labbaseexternalreviewform_roundbaseexternalreviewform", + ), ] operations = [ migrations.AlterField( - model_name='applicationsubmission', - name='submit_time', - field=models.DateTimeField(verbose_name='submit time'), + model_name="applicationsubmission", + name="submit_time", + field=models.DateTimeField(verbose_name="submit time"), ), ] diff --git a/hypha/apply/funds/migrations/0099_auto_20220629_1339.py b/hypha/apply/funds/migrations/0099_auto_20220629_1339.py index c2912a8a6f..be505367c4 100644 --- a/hypha/apply/funds/migrations/0099_auto_20220629_1339.py +++ b/hypha/apply/funds/migrations/0099_auto_20220629_1339.py @@ -9,20 +9,1847 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0098_alter_applicationsubmission_submit_time'), + ("funds", "0098_alter_applicationsubmission_submit_time"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))]), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ] + ), ), ] diff --git a/hypha/apply/funds/migrations/0100_alter_applicationbase_labbase_approval_form.py b/hypha/apply/funds/migrations/0100_alter_applicationbase_labbase_approval_form.py index dd958a461b..c139efeb99 100644 --- a/hypha/apply/funds/migrations/0100_alter_applicationbase_labbase_approval_form.py +++ b/hypha/apply/funds/migrations/0100_alter_applicationbase_labbase_approval_form.py @@ -5,21 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0053_projectapprovalform'), - ('funds', '0099_auto_20220629_1339'), + ("application_projects", "0053_projectapprovalform"), + ("funds", "0099_auto_20220629_1339"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='approval_form', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='funds', to='application_projects.projectapprovalform'), + model_name="applicationbase", + name="approval_form", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="funds", + to="application_projects.projectapprovalform", + ), ), migrations.AddField( - model_name='labbase', - name='approval_form', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='labs', to='application_projects.projectapprovalform'), + model_name="labbase", + name="approval_form", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="labs", + to="application_projects.projectapprovalform", + ), ), ] diff --git a/hypha/apply/funds/migrations/0101_auto_20220722_0844.py b/hypha/apply/funds/migrations/0101_auto_20220722_0844.py index 274774600d..c84ce55df1 100644 --- a/hypha/apply/funds/migrations/0101_auto_20220722_0844.py +++ b/hypha/apply/funds/migrations/0101_auto_20220722_0844.py @@ -10,40 +10,1885 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0100_alter_applicationbase_labbase_approval_form'), + ("funds", "0100_alter_applicationbase_labbase_approval_form"), ] operations = [ migrations.AlterField( - model_name='applicationbase', - name='from_address', - field=models.EmailField(blank=True, max_length=255, verbose_name='from address'), + model_name="applicationbase", + name="from_address", + field=models.EmailField( + blank=True, max_length=255, verbose_name="from address" + ), ), migrations.AlterField( - model_name='applicationbase', - name='to_address', - field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, validators=[wagtail.contrib.forms.models.validate_to_address], verbose_name='to address'), + model_name="applicationbase", + name="to_address", + field=models.CharField( + blank=True, + help_text="Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.", + max_length=255, + validators=[wagtail.contrib.forms.models.validate_to_address], + verbose_name="to address", + ), ), migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), migrations.AlterField( - model_name='labbase', - name='from_address', - field=models.EmailField(blank=True, max_length=255, verbose_name='from address'), + model_name="labbase", + name="from_address", + field=models.EmailField( + blank=True, max_length=255, verbose_name="from address" + ), ), migrations.AlterField( - model_name='labbase', - name='to_address', - field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, validators=[wagtail.contrib.forms.models.validate_to_address], verbose_name='to address'), + model_name="labbase", + name="to_address", + field=models.CharField( + blank=True, + help_text="Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.", + max_length=255, + validators=[wagtail.contrib.forms.models.validate_to_address], + verbose_name="to address", + ), ), ] diff --git a/hypha/apply/funds/migrations/0102_add_projectapprovalform_to_fundbase_labbase.py b/hypha/apply/funds/migrations/0102_add_projectapprovalform_to_fundbase_labbase.py index 882caed4c6..fc61d1b4d0 100644 --- a/hypha/apply/funds/migrations/0102_add_projectapprovalform_to_fundbase_labbase.py +++ b/hypha/apply/funds/migrations/0102_add_projectapprovalform_to_fundbase_labbase.py @@ -6,45 +6,92 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0055_alter_project_status_add_pafreviewersrole'), - ('funds', '0101_auto_20220722_0844'), + ("application_projects", "0055_alter_project_status_add_pafreviewersrole"), + ("funds", "0101_auto_20220722_0844"), ] operations = [ migrations.RemoveField( - model_name='applicationbase', - name='approval_form', + model_name="applicationbase", + name="approval_form", ), migrations.RemoveField( - model_name='labbase', - name='approval_form', + model_name="labbase", + name="approval_form", ), migrations.CreateModel( - name='LabBaseProjectApprovalForm', + name="LabBaseProjectApprovalForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='application_projects.projectapprovalform')), - ('lab', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='approval_forms', to='funds.labbase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="application_projects.projectapprovalform", + ), + ), + ( + "lab", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="approval_forms", + to="funds.labbase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='ApplicationBaseProjectApprovalForm', + name="ApplicationBaseProjectApprovalForm", 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)), - ('application', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='approval_forms', to='funds.applicationbase')), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='application_projects.projectapprovalform')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "application", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="approval_forms", + to="funds.applicationbase", + ), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="application_projects.projectapprovalform", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0103_alter_screeningstatus.py b/hypha/apply/funds/migrations/0103_alter_screeningstatus.py index 342cc719c9..d1813e3210 100644 --- a/hypha/apply/funds/migrations/0103_alter_screeningstatus.py +++ b/hypha/apply/funds/migrations/0103_alter_screeningstatus.py @@ -4,19 +4,25 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0102_add_projectapprovalform_to_fundbase_labbase'), + ("funds", "0102_add_projectapprovalform_to_fundbase_labbase"), ] operations = [ migrations.AlterModelOptions( - name='screeningstatus', - options={'verbose_name': 'Screening Decision', 'verbose_name_plural': 'screening decisions'}, + name="screeningstatus", + options={ + "verbose_name": "Screening Decision", + "verbose_name_plural": "screening decisions", + }, ), migrations.AlterField( - model_name='screeningstatus', - name='default', - field=models.BooleanField(default=False, help_text='Only one Yes and No screening decision can be set as default.', verbose_name='Default Yes/No'), + model_name="screeningstatus", + name="default", + field=models.BooleanField( + default=False, + help_text="Only one Yes and No screening decision can be set as default.", + verbose_name="Default Yes/No", + ), ), ] diff --git a/hypha/apply/funds/migrations/0104_show_deadline.py b/hypha/apply/funds/migrations/0104_show_deadline.py index 9806a74848..56bde79138 100644 --- a/hypha/apply/funds/migrations/0104_show_deadline.py +++ b/hypha/apply/funds/migrations/0104_show_deadline.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0103_alter_screeningstatus'), + ("funds", "0103_alter_screeningstatus"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='show_deadline', - field=models.BooleanField(default=True, help_text='Should the deadline date be visible for users.'), + model_name="applicationbase", + name="show_deadline", + field=models.BooleanField( + default=True, help_text="Should the deadline date be visible for users." + ), ), ] diff --git a/hypha/apply/funds/migrations/0105_applicationbase_activity_digest_recipient_emails.py b/hypha/apply/funds/migrations/0105_applicationbase_activity_digest_recipient_emails.py index 0ddd1e349f..f94c7cf6c7 100644 --- a/hypha/apply/funds/migrations/0105_applicationbase_activity_digest_recipient_emails.py +++ b/hypha/apply/funds/migrations/0105_applicationbase_activity_digest_recipient_emails.py @@ -5,30 +5,29 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0104_show_deadline'), + ("funds", "0104_show_deadline"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='activity_digest_recipient_emails', + model_name="applicationbase", + name="activity_digest_recipient_emails", field=django.contrib.postgres.fields.ArrayField( - base_field=models.EmailField(default='', max_length=254), + base_field=models.EmailField(default="", max_length=254), blank=True, - help_text='Comma separated list of emails where a summary of all the activities related to this fund will be sent.', + help_text="Comma separated list of emails where a summary of all the activities related to this fund will be sent.", null=True, size=None, ), ), migrations.AddField( - model_name='labbase', - name='activity_digest_recipient_emails', + model_name="labbase", + name="activity_digest_recipient_emails", field=django.contrib.postgres.fields.ArrayField( - base_field=models.EmailField(default='', max_length=254), + base_field=models.EmailField(default="", max_length=254), blank=True, - help_text='Comma separated list of emails where a summary of all the activities related to this lab will be sent.', + help_text="Comma separated list of emails where a summary of all the activities related to this lab will be sent.", null=True, size=None, ), diff --git a/hypha/apply/funds/migrations/0106_applicationsubmission_is_archive.py b/hypha/apply/funds/migrations/0106_applicationsubmission_is_archive.py index bc9d299bae..755dcd2c50 100644 --- a/hypha/apply/funds/migrations/0106_applicationsubmission_is_archive.py +++ b/hypha/apply/funds/migrations/0106_applicationsubmission_is_archive.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0105_applicationbase_activity_digest_recipient_emails'), + ("funds", "0105_applicationbase_activity_digest_recipient_emails"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='is_archive', + model_name="applicationsubmission", + name="is_archive", field=models.BooleanField(default=False), ), ] diff --git a/hypha/apply/funds/migrations/0107_add_additional_fields_to_funds_labs.py b/hypha/apply/funds/migrations/0107_add_additional_fields_to_funds_labs.py index 2e043c6d1c..229720beaf 100644 --- a/hypha/apply/funds/migrations/0107_add_additional_fields_to_funds_labs.py +++ b/hypha/apply/funds/migrations/0107_add_additional_fields_to_funds_labs.py @@ -6,41 +6,66 @@ class Migration(migrations.Migration): - dependencies = [ - ('images', '0004_alter_customimage_file_hash'), - ('funds', '0106_applicationsubmission_is_archive'), + ("images", "0004_alter_customimage_file_hash"), + ("funds", "0106_applicationsubmission_is_archive"), ] operations = [ migrations.AddField( - model_name='applicationbase', - name='description', + model_name="applicationbase", + name="description", field=models.TextField(blank=True, null=True), ), migrations.AddField( - model_name='applicationbase', - name='image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='images.customimage'), + model_name="applicationbase", + name="image", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="images.customimage", + ), ), migrations.AddField( - model_name='applicationbase', - name='weight', - field=models.PositiveIntegerField(blank=True, default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)]), + model_name="applicationbase", + name="weight", + field=models.PositiveIntegerField( + blank=True, + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ], + ), ), migrations.AddField( - model_name='labbase', - name='description', + model_name="labbase", + name="description", field=models.TextField(blank=True, null=True), ), migrations.AddField( - model_name='labbase', - name='image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='images.customimage'), + model_name="labbase", + name="image", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="images.customimage", + ), ), migrations.AddField( - model_name='labbase', - name='weight', - field=models.PositiveIntegerField(blank=True, default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)]), + model_name="labbase", + name="weight", + field=models.PositiveIntegerField( + blank=True, + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ], + ), ), ] diff --git a/hypha/apply/funds/migrations/0108_applicationbaseprojectsowform_labbaseprojectsowform.py b/hypha/apply/funds/migrations/0108_applicationbaseprojectsowform_labbaseprojectsowform.py index 77d3c47310..c8630fe641 100644 --- a/hypha/apply/funds/migrations/0108_applicationbaseprojectsowform_labbaseprojectsowform.py +++ b/hypha/apply/funds/migrations/0108_applicationbaseprojectsowform_labbaseprojectsowform.py @@ -6,37 +6,84 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0066_projectsowform'), - ('funds', '0107_add_additional_fields_to_funds_labs'), + ("application_projects", "0066_projectsowform"), + ("funds", "0107_add_additional_fields_to_funds_labs"), ] operations = [ migrations.CreateModel( - name='LabBaseProjectSOWForm', + name="LabBaseProjectSOWForm", 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)), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='application_projects.projectsowform')), - ('lab', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='sow_forms', to='funds.labbase')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="application_projects.projectsowform", + ), + ), + ( + "lab", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="sow_forms", + to="funds.labbase", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), migrations.CreateModel( - name='ApplicationBaseProjectSOWForm', + name="ApplicationBaseProjectSOWForm", 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)), - ('application', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='sow_forms', to='funds.applicationbase')), - ('form', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='application_projects.projectsowform')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ( + "application", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="sow_forms", + to="funds.applicationbase", + ), + ), + ( + "form", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="application_projects.projectsowform", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/funds/migrations/0109_rename_section_text_field.py b/hypha/apply/funds/migrations/0109_rename_section_text_field.py index 4ab07795d0..17c81626c9 100644 --- a/hypha/apply/funds/migrations/0109_rename_section_text_field.py +++ b/hypha/apply/funds/migrations/0109_rename_section_text_field.py @@ -9,20 +9,1845 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0108_applicationbaseprojectsowform_labbaseprojectsowform'), + ("funds", "0108_applicationbaseprojectsowform_labbaseprojectsowform"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', hypha.apply.categories.blocks.ModelChooserBlock('categories.Category')), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + hypha.apply.categories.blocks.ModelChooserBlock( + "categories.Category" + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/funds/migrations/0110_auto_20230418_0644.py b/hypha/apply/funds/migrations/0110_auto_20230418_0644.py index 802fee4670..7383a9d15c 100644 --- a/hypha/apply/funds/migrations/0110_auto_20230418_0644.py +++ b/hypha/apply/funds/migrations/0110_auto_20230418_0644.py @@ -9,20 +9,1845 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0109_rename_section_text_field'), + ("funds", "0109_rename_section_text_field"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', wagtail.blocks.ChoiceBlock(choices=hypha.apply.categories.blocks.get_categories_as_choices)), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + wagtail.blocks.ChoiceBlock( + choices=hypha.apply.categories.blocks.get_categories_as_choices + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', wagtail.blocks.ChoiceBlock(choices=hypha.apply.categories.blocks.get_categories_as_choices)), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + wagtail.blocks.ChoiceBlock( + choices=hypha.apply.categories.blocks.get_categories_as_choices + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/funds/migrations/0111_applicationsubmission_search_document_and_more.py b/hypha/apply/funds/migrations/0111_applicationsubmission_search_document_and_more.py index 285d295c44..48112994d0 100644 --- a/hypha/apply/funds/migrations/0111_applicationsubmission_search_document_and_more.py +++ b/hypha/apply/funds/migrations/0111_applicationsubmission_search_document_and_more.py @@ -9,35 +9,51 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0110_auto_20230418_0644'), + ("funds", "0110_auto_20230418_0644"), ] operations = [ migrations.AddField( - model_name='applicationsubmission', - name='search_document', + model_name="applicationsubmission", + name="search_document", field=django.contrib.postgres.search.SearchVectorField(null=True), ), migrations.AlterField( - model_name='applicationbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer', 'is_active': True}, related_name='%(class)s_reviewers', to=settings.AUTH_USER_MODEL), + model_name="applicationbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer", "is_active": True}, + related_name="%(class)s_reviewers", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundbase', - name='lead', - field=models.ForeignKey(limit_choices_to={'groups__name': 'Staff', 'is_active': True}, on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s_lead', to=settings.AUTH_USER_MODEL), + model_name="roundbase", + name="lead", + field=models.ForeignKey( + limit_choices_to={"groups__name": "Staff", "is_active": True}, + on_delete=django.db.models.deletion.PROTECT, + related_name="%(class)s_lead", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='roundbase', - name='reviewers', - field=modelcluster.fields.ParentalManyToManyField(blank=True, limit_choices_to={'groups__name': 'Reviewer', 'is_active': True}, related_name='%(class)s_reviewer', to=settings.AUTH_USER_MODEL), + model_name="roundbase", + name="reviewers", + field=modelcluster.fields.ParentalManyToManyField( + blank=True, + limit_choices_to={"groups__name": "Reviewer", "is_active": True}, + related_name="%(class)s_reviewer", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AddIndex( - model_name='applicationsubmission', - index=django.contrib.postgres.indexes.GinIndex(fields=['search_document'], name='funds_appli_search__43a072_gin'), + model_name="applicationsubmission", + index=django.contrib.postgres.indexes.GinIndex( + fields=["search_document"], name="funds_appli_search__43a072_gin" + ), ), ] diff --git a/hypha/apply/funds/migrations/0112_add_organization_name.py b/hypha/apply/funds/migrations/0112_add_organization_name.py index 555dfe8811..d6d6f406fd 100644 --- a/hypha/apply/funds/migrations/0112_add_organization_name.py +++ b/hypha/apply/funds/migrations/0112_add_organization_name.py @@ -9,20 +9,1907 @@ class Migration(migrations.Migration): - dependencies = [ - ('funds', '0111_applicationsubmission_search_document_and_more'), + ("funds", "0111_applicationsubmission_search_document_and_more"), ] operations = [ migrations.AlterField( - model_name='applicationform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', wagtail.blocks.ChoiceBlock(choices=hypha.apply.categories.blocks.get_categories_as_choices)), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('organization_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + wagtail.blocks.ChoiceBlock( + choices=hypha.apply.categories.blocks.get_categories_as_choices + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "organization_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), migrations.AlterField( - model_name='applicationsubmission', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('category', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(help_text='Leave blank to use the default Category label', label='Label', required=False)), ('help_text', wagtail.blocks.TextBlock(help_text='Leave blank to use the default Category help text', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('category', wagtail.blocks.ChoiceBlock(choices=hypha.apply.categories.blocks.get_categories_as_choices)), ('multi', wagtail.blocks.BooleanBlock(label='Multi select', required=False))], group='Custom')), ('title', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is the title of your application?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='This project name can be changed if a full proposal is requested.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('email', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What email address should we use to contact you?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this email address to communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('full_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(default='What is your name?', label='Label')), ('help_text', wagtail.blocks.TextBlock(default='We will use this name when we communicate with you about your proposal.', label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group=' Required')), ('value', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('organization_name', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('address', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom')), ('duration', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('duration_type', wagtail.blocks.ChoiceBlock(choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], help_text='Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.')), ('info', wagtail.blocks.static_block.StaticBlock())], group='Custom'))], use_json_field=True), + model_name="applicationsubmission", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "category", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + help_text="Leave blank to use the default Category label", + label="Label", + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + help_text="Leave blank to use the default Category help text", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "category", + wagtail.blocks.ChoiceBlock( + choices=hypha.apply.categories.blocks.get_categories_as_choices + ), + ), + ( + "multi", + wagtail.blocks.BooleanBlock( + label="Multi select", required=False + ), + ), + ], + group="Custom", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is the title of your application?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="This project name can be changed if a full proposal is requested.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What email address should we use to contact you?", + label="Label", + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this email address to communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "full_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock( + default="What is your name?", label="Label" + ), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + default="We will use this name when we communicate with you about your proposal.", + label="Help text", + required=False, + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group=" Required", + ), + ), + ( + "value", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "organization_name", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "address", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ( + "duration", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "duration_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("days", "Days"), + ("weeks", "Weeks"), + ("months", "Months"), + ], + help_text="Duration type is used to display duration choices in Days, Weeks or Months in application forms. Be careful, changing the duration type in the active round can result in data inconsistency.", + ), + ), + ("info", wagtail.blocks.static_block.StaticBlock()), + ], + group="Custom", + ), + ), + ], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/funds/models/__init__.py b/hypha/apply/funds/models/__init__.py index 5963711972..09afb0d643 100644 --- a/hypha/apply/funds/models/__init__.py +++ b/hypha/apply/funds/models/__init__.py @@ -16,39 +16,39 @@ from .submissions import ApplicationSubmission __all__ = [ - 'ApplicationForm', - 'ApplicationRevision', - 'ApplicationSettings', - 'ApplicationSubmission', - 'AssignedReviewers', - 'Reminder', - 'ReviewerRole', - 'ReviewerSettings', - 'RoundsAndLabs', - 'ScreeningStatus', + "ApplicationForm", + "ApplicationRevision", + "ApplicationSettings", + "ApplicationSubmission", + "AssignedReviewers", + "Reminder", + "ReviewerRole", + "ReviewerSettings", + "RoundsAndLabs", + "ScreeningStatus", ] class FundType(ApplicationBase): - subpage_types = ['funds.Round'] + subpage_types = ["funds.Round"] class Meta: verbose_name = _("Fund") class RequestForPartners(ApplicationBase): - subpage_types = ['funds.Round', 'funds.SealedRound'] + subpage_types = ["funds.Round", "funds.SealedRound"] class Meta: verbose_name = _("RFP") class Round(RoundBase): - parent_page_types = ['funds.FundType', 'funds.RequestForPartners'] + parent_page_types = ["funds.FundType", "funds.RequestForPartners"] class SealedRound(RoundBase): - parent_page_types = ['funds.RequestForPartners'] + parent_page_types = ["funds.RequestForPartners"] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/hypha/apply/funds/models/application_revisions.py b/hypha/apply/funds/models/application_revisions.py index 803e6f4fa1..14508d6f6d 100644 --- a/hypha/apply/funds/models/application_revisions.py +++ b/hypha/apply/funds/models/application_revisions.py @@ -11,34 +11,45 @@ class ApplicationRevision(BaseStreamForm, AccessFormData, models.Model): wagtail_reference_index_ignore = True - submission = models.ForeignKey('funds.ApplicationSubmission', related_name='revisions', on_delete=models.CASCADE) + submission = models.ForeignKey( + "funds.ApplicationSubmission", + related_name="revisions", + on_delete=models.CASCADE, + ) form_data = models.JSONField(encoder=StreamFieldDataEncoder) timestamp = models.DateTimeField(auto_now=True) - author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True) + author = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True + ) class Meta: - ordering = ['-timestamp'] + ordering = ["-timestamp"] def __str__(self): - return f'Revision for {self.submission.title} by {self.author} ' + return f"Revision for {self.submission.title} by {self.author} " @property def form_fields(self): return self.submission.form_fields def get_compare_url_to_latest(self): - return reverse("funds:submissions:revisions:compare", kwargs={ - 'submission_pk': self.submission.id, - 'to': self.submission.live_revision.id, - 'from': self.id, - }) + return reverse( + "funds:submissions:revisions:compare", + kwargs={ + "submission_pk": self.submission.id, + "to": self.submission.live_revision.id, + "from": self.id, + }, + ) def get_absolute_url(self): # Compares against the previous revision previous_revision = self.submission.revisions.filter(id__lt=self.id).first() - return reverse("funds:submissions:revisions:compare", kwargs={ - 'submission_pk': self.submission.id, - 'to': self.id, - 'from': previous_revision.id, - }) - + return reverse( + "funds:submissions:revisions:compare", + kwargs={ + "submission_pk": self.submission.id, + "to": self.id, + "from": previous_revision.id, + }, + ) diff --git a/hypha/apply/funds/models/applications.py b/hypha/apply/funds/models/applications.py index f4f745a3b0..b3ac973ab4 100644 --- a/hypha/apply/funds/models/applications.py +++ b/hypha/apply/funds/models/applications.py @@ -58,9 +58,13 @@ class ApplicationBaseManager(PageQuerySet): def order_by_end_date(self): # OutRef path__startswith with find all descendants of the parent # We only have children, so no issues at this time - rounds = RoundBase.objects.open().filter(path__startswith=OuterRef('path')) - qs = self.public().live().annotate(end_date=Subquery(rounds.values('end_date')[:1])) - return qs.order_by('end_date') + rounds = RoundBase.objects.open().filter(path__startswith=OuterRef("path")) + qs = ( + self.public() + .live() + .annotate(end_date=Subquery(rounds.values("end_date")[:1])) + ) + return qs.order_by("end_date") class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore @@ -71,38 +75,58 @@ class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore reviewers = ParentalManyToManyField( settings.AUTH_USER_MODEL, - related_name='%(class)s_reviewers', + related_name="%(class)s_reviewers", limit_choices_to=LIMIT_TO_REVIEWERS, blank=True, ) - image = models.ForeignKey('images.CustomImage', null=True, blank=True, on_delete=models.SET_NULL, related_name='+') + image = models.ForeignKey( + "images.CustomImage", + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name="+", + ) description = models.TextField(null=True, blank=True) # higher the weight means top priority, 100th will be on top. - weight = models.PositiveIntegerField(default=1, blank=True, validators=[MinValueValidator(1), MaxValueValidator(100)]) + weight = models.PositiveIntegerField( + default=1, blank=True, validators=[MinValueValidator(1), MaxValueValidator(100)] + ) - guide_link = models.URLField(blank=True, max_length=255, help_text=_('Link to the apply guide.')) + guide_link = models.URLField( + blank=True, max_length=255, help_text=_("Link to the apply guide.") + ) - slack_channel = models.CharField(blank=True, max_length=128, help_text=_('The slack #channel for notifications. If left empty, notifications will go to the default channel.')) + slack_channel = models.CharField( + blank=True, + max_length=128, + help_text=_( + "The slack #channel for notifications. If left empty, notifications will go to the default channel." + ), + ) activity_digest_recipient_emails = ArrayField( - models.EmailField(default=''), + models.EmailField(default=""), blank=True, null=True, - help_text=_('Comma separated list of emails where a summary of all the activities related to this fund will be sent.') + help_text=_( + "Comma separated list of emails where a summary of all the activities related to this fund will be sent." + ), ) - show_deadline = models.BooleanField(default=True, help_text=_('Should the deadline date be visible for users.')) + show_deadline = models.BooleanField( + default=True, help_text=_("Should the deadline date be visible for users.") + ) objects = PageManager.from_queryset(ApplicationBaseManager)() - parent_page_types = ['apply_home.ApplyHomePage'] + parent_page_types = ["apply_home.ApplyHomePage"] def get_template(self, request, *args, **kwargs): # We want to force children to use our base template # template attribute is ignored by children - return 'funds/application_base.html' + return "funds/application_base.html" def detail(self): # The location to find out more information @@ -122,9 +146,11 @@ def next_deadline(self): def serve(self, request): # Manually do what the login_required decorator does so that we can check settings if not request.user.is_authenticated and settings.FORCE_LOGIN_FOR_APPLICATION: - return redirect('%s?next=%s' % (settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path)) + return redirect( + "%s?next=%s" % (settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path) + ) - if hasattr(request, 'is_preview') or not self.open_round: + if hasattr(request, "is_preview") or not self.open_round: return super().serve(request) # delegate to the open_round to use the latest form instances @@ -132,29 +158,31 @@ def serve(self, request): return self.open_round.serve(request) content_panels = WorkflowStreamForm.content_panels + [ - FieldPanel('reviewers', widget=forms.CheckboxSelectMultiple), - FieldPanel('guide_link'), - FieldPanel('description'), - FieldPanel('image'), - FieldPanel('weight'), - FieldPanel('slack_channel'), - FieldPanel('activity_digest_recipient_emails'), - FieldPanel('show_deadline'), + FieldPanel("reviewers", widget=forms.CheckboxSelectMultiple), + FieldPanel("guide_link"), + FieldPanel("description"), + FieldPanel("image"), + FieldPanel("weight"), + FieldPanel("slack_channel"), + FieldPanel("activity_digest_recipient_emails"), + FieldPanel("show_deadline"), ] - edit_handler = TabbedInterface([ - ObjectList(content_panels, heading=_('Content')), - EmailForm.email_tab, - ObjectList(WorkflowStreamForm.promote_panels, heading=_('Promote')), - ]) + edit_handler = TabbedInterface( + [ + ObjectList(content_panels, heading=_("Content")), + EmailForm.email_tab, + ObjectList(WorkflowStreamForm.promote_panels, heading=_("Promote")), + ] + ) class RoundBaseManager(PageQuerySet): def open(self): rounds = self.live().public().specific() rounds = rounds.filter( - Q(start_date__lte=date.today()) & - Q(Q(end_date__isnull=True) | Q(end_date__gte=date.today())) + Q(start_date__lte=date.today()) + & Q(Q(end_date__isnull=True) | Q(end_date__gte=date.today())) ) return rounds @@ -178,12 +206,12 @@ class RoundBase(WorkflowStreamForm, SubmittableStreamForm): # type: ignore lead = models.ForeignKey( settings.AUTH_USER_MODEL, limit_choices_to=LIMIT_TO_STAFF, - related_name='%(class)s_lead', + related_name="%(class)s_lead", on_delete=models.PROTECT, ) reviewers = ParentalManyToManyField( settings.AUTH_USER_MODEL, - related_name='%(class)s_reviewer', + related_name="%(class)s_reviewer", limit_choices_to=LIMIT_TO_REVIEWERS, blank=True, ) @@ -192,63 +220,72 @@ class RoundBase(WorkflowStreamForm, SubmittableStreamForm): # type: ignore blank=True, null=True, default=date.today, - help_text=_('When no end date is provided the round will remain open indefinitely.') + help_text=_( + "When no end date is provided the round will remain open indefinitely." + ), ) sealed = models.BooleanField(default=False) content_panels = SubmittableStreamForm.content_panels + [ - FieldPanel('lead'), - MultiFieldPanel([ - FieldRowPanel([ - FieldPanel('start_date'), - FieldPanel('end_date'), - ]), - ], heading=_('Dates')), - FieldPanel('reviewers', widget=forms.CheckboxSelectMultiple), + FieldPanel("lead"), + MultiFieldPanel( + [ + FieldRowPanel( + [ + FieldPanel("start_date"), + FieldPanel("end_date"), + ] + ), + ], + heading=_("Dates"), + ), + FieldPanel("reviewers", widget=forms.CheckboxSelectMultiple), ReadOnlyPanel( - 'get_workflow_name_display', - heading=_('Workflow'), - help_text=_('Copied from the fund.'), + "get_workflow_name_display", + heading=_("Workflow"), + help_text=_("Copied from the fund."), ), # Forms comes from parental key in models/forms.py ReadOnlyInlinePanel( - 'forms', + "forms", panels=[ReadOnlyPanel("name")], - heading=_('Application forms'), - help_text=_('Copied from the fund.'), + heading=_("Application forms"), + help_text=_("Copied from the fund."), ), ReadOnlyInlinePanel( - 'review_forms', + "review_forms", panels=[ReadOnlyPanel("name")], - heading=_('Internal Review Form'), - help_text=_('Copied from the fund.'), + heading=_("Internal Review Form"), + help_text=_("Copied from the fund."), ), ReadOnlyInlinePanel( - 'external_review_forms', + "external_review_forms", panels=[ReadOnlyPanel("name")], - help_text=_('Copied from the fund.'), - heading=_('External Review Form'), + help_text=_("Copied from the fund."), + heading=_("External Review Form"), ), ReadOnlyInlinePanel( - 'determination_forms', + "determination_forms", panels=[ReadOnlyPanel("name")], - help_text=_('Copied from the fund.'), - heading=_('Determination Form'), + help_text=_("Copied from the fund."), + heading=_("Determination Form"), ), ] - edit_handler = TabbedInterface([ - ObjectList(content_panels, heading=_('Content')), - ObjectList(SubmittableStreamForm.promote_panels, heading=_('Promote')), - ]) + edit_handler = TabbedInterface( + [ + ObjectList(content_panels, heading=_("Content")), + ObjectList(SubmittableStreamForm.promote_panels, heading=_("Promote")), + ] + ) def get_template(self, request, *args, **kwargs): # Make sure all children use the shared template - return 'funds/round.html' + return "funds/round.html" def get_landing_page_template(self, request, *args, **kwargs): # Make sure all children use the shared template - return 'funds/round_landing.html' + return "funds/round_landing.html" @cached_property def fund(self): @@ -264,19 +301,19 @@ def is_open(self): def save(self, *args, **kwargs): is_new = not self.id - if is_new and hasattr(self, 'parent_page'): + if is_new and hasattr(self, "parent_page"): parent_page = self.parent_page[self.__class__][self.title] self.workflow_name = parent_page.workflow_name self.reviewers = parent_page.reviewers.all() super().save(*args, **kwargs) - if is_new and hasattr(self, 'parent_page'): + if is_new and hasattr(self, "parent_page"): # Would be nice to do this using model clusters as part of the __init__ - self._copy_forms('forms') - self._copy_forms('review_forms') - self._copy_forms('external_review_forms') - self._copy_forms('determination_forms') + self._copy_forms("forms") + self._copy_forms("review_forms") + self._copy_forms("external_review_forms") + self._copy_forms("determination_forms") def _copy_forms(self, field): for form in getattr(self.get_parent().specific, field).all(): @@ -287,9 +324,11 @@ def _copy_form(self, form, new_class): # Create a copy of the existing form object new_form = form.form new_form.id = None - new_form.name = '{} for {} ({})'.format(new_form.name, self.title, self.get_parent().title) + new_form.name = "{} for {} ({})".format( + new_form.name, self.title, self.get_parent().title + ) new_form.save() - if hasattr(form, 'stage'): + if hasattr(form, "stage"): new_class.objects.create(round=self, form=new_form, stage=form.stage) else: new_class.objects.create(round=self, form=new_form) @@ -307,47 +346,52 @@ def clean(self): conflict_query = () if self.start_date and self.end_date and self.start_date > self.end_date: - raise ValidationError({ - 'end_date': 'End date must come after the start date', - }) + raise ValidationError( + { + "end_date": "End date must come after the start date", + } + ) if self.start_date and self.end_date: conflict_query = ( - Q(start_date__range=[self.start_date, self.end_date]) | - Q(end_date__range=[self.start_date, self.end_date]) | - Q(start_date__lte=self.start_date, end_date__gte=self.end_date) + Q(start_date__range=[self.start_date, self.end_date]) + | Q(end_date__range=[self.start_date, self.end_date]) + | Q(start_date__lte=self.start_date, end_date__gte=self.end_date) ) elif self.start_date: - conflict_query = ( - Q(start_date__lte=self.start_date, end_date__isnull=True) | - Q(end_date__gte=self.start_date) - ) + conflict_query = Q( + start_date__lte=self.start_date, end_date__isnull=True + ) | Q(end_date__gte=self.start_date) - if not self.id and hasattr(self, 'parent_page'): + if not self.id and hasattr(self, "parent_page"): # Check if the create hook has added the parent page, we aren't an object yet. # Ensures we can access related objects during the clean phase instead of save. - base_query = RoundBase.objects.child_of(self.parent_page[self.__class__][self.title]) + base_query = RoundBase.objects.child_of( + self.parent_page[self.__class__][self.title] + ) else: # don't need parent page, we are an actual object now. base_query = RoundBase.objects.sibling_of(self) if conflict_query: - conflicting_rounds = base_query.filter( - conflict_query - ).exclude(id=self.id) + conflicting_rounds = base_query.filter(conflict_query).exclude(id=self.id) if conflicting_rounds.exists(): - error_message = mark_safe('Overlaps with the following rounds:
{}'.format( - '
'.join([ - f'{round.title}: {round.start_date} - {round.end_date}' - for round in conflicting_rounds] + error_message = mark_safe( + "Overlaps with the following rounds:
{}".format( + "
".join( + [ + f'{round.title}: {round.start_date} - {round.end_date}' + for round in conflicting_rounds + ] + ) ) - )) + ) error = { - 'start_date': error_message, + "start_date": error_message, } if self.end_date: - error['end_date'] = error_message + error["end_date"] = error_message raise ValidationError(error) @@ -357,11 +401,14 @@ def get_initial_data_open_call_submission(self, submission_id): try: submission_class = self.get_submission_class() submission = submission_class.objects.get(id=submission_id) - if submission.status in OPEN_CALL_PHASES and self.get_parent() == submission.page: - title_block_id = submission.named_blocks.get('title') + if ( + submission.status in OPEN_CALL_PHASES + and self.get_parent() == submission.page + ): + title_block_id = submission.named_blocks.get("title") if title_block_id: field_data = submission.data(title_block_id) - initial_values[title_block_id] = field_data + ' (please edit)' + initial_values[title_block_id] = field_data + " (please edit)" for field_id in submission.first_group_normal_text_blocks: field_data = submission.data(field_id) @@ -370,9 +417,11 @@ def get_initial_data_open_call_submission(self, submission_id): # Select first item in the Group toggle blocks for toggle_block_id, toggle_field in submission.group_toggle_blocks: try: - initial_values[toggle_block_id] = toggle_field.value['choices'][0] + initial_values[toggle_block_id] = toggle_field.value["choices"][ + 0 + ] except IndexError: - initial_values[toggle_block_id] = 'yes' + initial_values[toggle_block_id] = "yes" except KeyError: pass @@ -387,47 +436,53 @@ def get_form_parameters(self, submission_id=None): if submission_id: initial_values = self.get_initial_data_open_call_submission(submission_id) if initial_values: - form_parameters['initial'] = initial_values + form_parameters["initial"] = initial_values return form_parameters def get_form(self, *args, **kwargs): - draft = kwargs.pop('draft', False) - user = kwargs.get('user') + draft = kwargs.pop("draft", False) + user = kwargs.get("user") try: form_class = self.get_form_class(draft, args[0], user=user) except IndexError: form_class = self.get_form_class(draft, user=user) - submission_id = kwargs.pop('submission_id', None) + submission_id = kwargs.pop("submission_id", None) form_params = self.get_form_parameters(submission_id=submission_id) form_params.update(kwargs) return form_class(*args, **form_params) def serve(self, request, *args, **kwargs): - if hasattr(request, 'is_preview') or hasattr(request, 'show_round'): + if hasattr(request, "is_preview") or hasattr(request, "show_round"): # Overriding serve method to pass submission id to get_form method - copy_open_submission = request.GET.get('open_call_submission') - if request.method == 'POST': - draft = request.POST.get('draft', False) - form = self.get_form(request.POST, request.FILES, page=self, user=request.user, draft=draft) + copy_open_submission = request.GET.get("open_call_submission") + if request.method == "POST": + draft = request.POST.get("draft", False) + form = self.get_form( + request.POST, + request.FILES, + page=self, + user=request.user, + draft=draft, + ) if form.is_valid(): form_submission = self.process_form_submission(form, draft=draft) # Required for django-file-form: delete temporary files for the new files # that are uploaded. form.delete_temporary_files() - return self.render_landing_page(request, form_submission, *args, **kwargs) + return self.render_landing_page( + request, form_submission, *args, **kwargs + ) else: - form = self.get_form(page=self, user=request.user, submission_id=copy_open_submission) + form = self.get_form( + page=self, user=request.user, submission_id=copy_open_submission + ) context = self.get_context(request) - context['form'] = form - context['show_all_group_fields'] = True if copy_open_submission else False - return render( - request, - self.get_template(request), - context - ) + context["form"] = form + context["show_all_group_fields"] = True if copy_open_submission else False + return render(request, self.get_template(request), context) # We hide the round as only the open round is used which is displayed through the # fund page @@ -444,51 +499,67 @@ class LabBase(EmailForm, WorkflowStreamForm, SubmittableStreamForm): # type: ig lead = models.ForeignKey( settings.AUTH_USER_MODEL, limit_choices_to=LIMIT_TO_STAFF, - related_name='lab_lead', + related_name="lab_lead", on_delete=models.PROTECT, ) reviewers = ParentalManyToManyField( settings.AUTH_USER_MODEL, - related_name='labs_reviewer', + related_name="labs_reviewer", limit_choices_to=LIMIT_TO_REVIEWERS, blank=True, ) - image = models.ForeignKey('images.CustomImage', null=True, blank=True, on_delete=models.SET_NULL, related_name='+') + image = models.ForeignKey( + "images.CustomImage", + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name="+", + ) description = models.TextField(null=True, blank=True) # higher the weight means top priority, 100th will be on top. - weight = models.PositiveIntegerField(default=1, blank=True, validators=[MinValueValidator(1), MaxValueValidator(100)]) + weight = models.PositiveIntegerField( + default=1, blank=True, validators=[MinValueValidator(1), MaxValueValidator(100)] + ) - guide_link = models.URLField(blank=True, max_length=255, help_text=_('Link to the apply guide.')) + guide_link = models.URLField( + blank=True, max_length=255, help_text=_("Link to the apply guide.") + ) - slack_channel = models.CharField(blank=True, max_length=128, help_text=_('The slack #channel for notifications.')) + slack_channel = models.CharField( + blank=True, max_length=128, help_text=_("The slack #channel for notifications.") + ) activity_digest_recipient_emails = ArrayField( - models.EmailField(default=''), + models.EmailField(default=""), blank=True, null=True, - help_text=_('Comma separated list of emails where a summary of all the activities related to this lab will be sent.') + help_text=_( + "Comma separated list of emails where a summary of all the activities related to this lab will be sent." + ), ) - parent_page_types = ['apply_home.ApplyHomePage'] + parent_page_types = ["apply_home.ApplyHomePage"] subpage_types = [] # type: ignore content_panels = WorkflowStreamForm.content_panels + [ - FieldPanel('lead'), - FieldPanel('reviewers', widget=forms.CheckboxSelectMultiple), - FieldPanel('guide_link'), - FieldPanel('description'), - FieldPanel('image'), - FieldPanel('weight'), - FieldPanel('slack_channel'), - FieldPanel('activity_digest_recipient_emails'), + FieldPanel("lead"), + FieldPanel("reviewers", widget=forms.CheckboxSelectMultiple), + FieldPanel("guide_link"), + FieldPanel("description"), + FieldPanel("image"), + FieldPanel("weight"), + FieldPanel("slack_channel"), + FieldPanel("activity_digest_recipient_emails"), ] - edit_handler = TabbedInterface([ - ObjectList(content_panels, heading=_('Content')), - EmailForm.email_tab, - ObjectList(WorkflowStreamForm.promote_panels, heading=_('Promote')), - ]) + edit_handler = TabbedInterface( + [ + ObjectList(content_panels, heading=_("Content")), + EmailForm.email_tab, + ObjectList(WorkflowStreamForm.promote_panels, heading=_("Promote")), + ] + ) def detail(self): # The location to find out more information @@ -505,7 +576,7 @@ def open_round(self): return self.live def get_form(self, *args, **kwargs): - user = kwargs.get('user') + user = kwargs.get("user") form_class = self.get_form_class(user=user) form_params = self.get_form_parameters() form_params.update(kwargs) @@ -515,24 +586,28 @@ def get_form(self, *args, **kwargs): def serve(self, request, *args, **kwargs): # Manually do what the login_required decorator does so that we can check settings if not request.user.is_authenticated and settings.FORCE_LOGIN_FOR_APPLICATION: - return redirect('%s?next=%s' % (settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path)) + return redirect( + "%s?next=%s" % (settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path) + ) - if request.method == 'POST': - form = self.get_form(request.POST, request.FILES, page=self, user=request.user) - draft = request.POST.get('draft', False) + if request.method == "POST": + form = self.get_form( + request.POST, request.FILES, page=self, user=request.user + ) + draft = request.POST.get("draft", False) if form.is_valid(): - form_submission = SubmittableStreamForm.process_form_submission(self, form, draft=draft) - return self.render_landing_page(request, form_submission, *args, **kwargs) + form_submission = SubmittableStreamForm.process_form_submission( + self, form, draft=draft + ) + return self.render_landing_page( + request, form_submission, *args, **kwargs + ) else: form = self.get_form(page=self, user=request.user) context = self.get_context(request) - context['form'] = form - return TemplateResponse( - request, - self.get_template(request), - context - ) + context["form"] = form + return TemplateResponse(request, self.get_template(request), context) class RoundsAndLabsQueryset(PageQuerySet): @@ -540,7 +615,10 @@ def new(self): return self.filter(start_date__gt=date.today()) def open(self): - return self.filter(Q(end_date__gte=date.today(), start_date__lte=date.today()) | Q(end_date__isnull=True)) + return self.filter( + Q(end_date__gte=date.today(), start_date__lte=date.today()) + | Q(end_date__isnull=True) + ) def closed(self): return self.filter(end_date__lt=date.today()) @@ -559,49 +637,68 @@ def inactive(self): class RoundsAndLabsManager(PageManager): def get_queryset(self, base_queryset=RoundsAndLabsQueryset): - funds = ApplicationBase.objects.filter(path=OuterRef('parent_path')) - - return base_queryset(self.model, using=self._db).type(SubmittableStreamForm).annotate( - lead=Coalesce( - F('roundbase__lead__full_name'), - F('labbase__lead__full_name'), - ), - start_date=F('roundbase__start_date'), - end_date=F('roundbase__end_date'), - parent_path=Left(F('path'), Length('path') - ApplicationBase.steplen, output_field=CharField()), - fund=Subquery(funds.values('title')[:1]), - lead_pk=Coalesce( - F('roundbase__lead__pk'), - F('labbase__lead__pk'), - ), + funds = ApplicationBase.objects.filter(path=OuterRef("parent_path")) + + return ( + base_queryset(self.model, using=self._db) + .type(SubmittableStreamForm) + .annotate( + lead=Coalesce( + F("roundbase__lead__full_name"), + F("labbase__lead__full_name"), + ), + start_date=F("roundbase__start_date"), + end_date=F("roundbase__end_date"), + parent_path=Left( + F("path"), + Length("path") - ApplicationBase.steplen, + output_field=CharField(), + ), + fund=Subquery(funds.values("title")[:1]), + lead_pk=Coalesce( + F("roundbase__lead__pk"), + F("labbase__lead__pk"), + ), + ) ) def with_progress(self): - submissions = ApplicationSubmission.objects.filter(Q(round=OuterRef('pk')) | Q(page=OuterRef('pk'))).current() + submissions = ApplicationSubmission.objects.filter( + Q(round=OuterRef("pk")) | Q(page=OuterRef("pk")) + ).current() closed_submissions = submissions.inactive() - return self.get_queryset(RoundsAndLabsProgressQueryset).annotate( - total_submissions=Coalesce( - Subquery( - submissions.exclude_draft().values('round').annotate(count=Count('pk')).values('count'), - output_field=IntegerField(), + return ( + self.get_queryset(RoundsAndLabsProgressQueryset) + .annotate( + total_submissions=Coalesce( + Subquery( + submissions.exclude_draft() + .values("round") + .annotate(count=Count("pk")) + .values("count"), + output_field=IntegerField(), + ), + 0, ), - 0, - ), - closed_submissions=Coalesce( - Subquery( - closed_submissions.exclude_draft().values('round').annotate(count=Count('pk')).values('count'), - output_field=IntegerField(), + closed_submissions=Coalesce( + Subquery( + closed_submissions.exclude_draft() + .values("round") + .annotate(count=Count("pk")) + .values("count"), + output_field=IntegerField(), + ), + 0, ), - 0, - ), - ).annotate( - progress=Case( - When(total_submissions=0, then=None), - default=(F('closed_submissions') * 100) / F('total_submissions'), - output_fields=FloatField(), ) - + .annotate( + progress=Case( + When(total_submissions=0, then=None), + default=(F("closed_submissions") * 100) / F("total_submissions"), + output_fields=FloatField(), + ) + ) ) def open(self): @@ -622,6 +719,7 @@ class RoundsAndLabs(Page): This behaves as a useful way to get all the rounds and labs that are defined in the project regardless of how they are implemented (lab/round/sealed_round) """ + class Meta: proxy = True @@ -641,23 +739,25 @@ def __eq__(self, other): objects = RoundsAndLabsManager() def save(self, *args, **kwargs): - raise NotImplementedError('Do not save through this model') + raise NotImplementedError("Do not save through this model") @register_setting class ApplicationSettings(BaseSiteSetting): - wagtail_reference_index_ignore = True class Meta: - verbose_name = 'application settings' + verbose_name = "application settings" extra_text_round = RichTextField(blank=True) extra_text_lab = RichTextField(blank=True) panels = [ - MultiFieldPanel([ - FieldPanel('extra_text_round'), - FieldPanel('extra_text_lab'), - ], 'extra text on application landing page'), + MultiFieldPanel( + [ + FieldPanel("extra_text_round"), + FieldPanel("extra_text_lab"), + ], + "extra text on application landing page", + ), ] diff --git a/hypha/apply/funds/models/assigned_reviewers.py b/hypha/apply/funds/models/assigned_reviewers.py index 21e9cfac0b..8dd0900d86 100644 --- a/hypha/apply/funds/models/assigned_reviewers.py +++ b/hypha/apply/funds/models/assigned_reviewers.py @@ -26,29 +26,34 @@ def review_order(self): models.When(type__name=review_type, then=models.Value(i)) for i, review_type in enumerate(review_order) ] - return self.exclude( - # Remove people from the list who are opinionated but - # didn't submit a review, they appear elsewhere - Q(opinions__isnull=False) & - Q(Q(review__isnull=True) | Q(review__is_draft=True)) - ).annotate( - type_order=models.Case( - *ordering, - output_field=models.IntegerField(), - ), - has_review=models.Case( - models.When(review__isnull=True, then=models.Value(1)), - models.When(review__is_draft=True, then=models.Value(1)), - default=models.Value(0), - output_field=models.IntegerField(), + return ( + self.exclude( + # Remove people from the list who are opinionated but + # didn't submit a review, they appear elsewhere + Q(opinions__isnull=False) + & Q(Q(review__isnull=True) | Q(review__is_draft=True)) + ) + .annotate( + type_order=models.Case( + *ordering, + output_field=models.IntegerField(), + ), + has_review=models.Case( + models.When(review__isnull=True, then=models.Value(1)), + models.When(review__is_draft=True, then=models.Value(1)), + default=models.Value(0), + output_field=models.IntegerField(), + ), + ) + .order_by( + "type_order", + "has_review", + F("role__order").asc(nulls_last=True), + ) + .select_related( + "reviewer", + "role", ) - ).order_by( - 'type_order', - 'has_review', - F('role__order').asc(nulls_last=True), - ).select_related( - 'reviewer', - 'role', ) def with_roles(self): @@ -59,8 +64,8 @@ def without_roles(self): def reviewed(self): return self.filter( - Q(opinions__opinion=AGREE) | - Q(Q(review__isnull=False) & Q(review__is_draft=False)) + Q(opinions__opinion=AGREE) + | Q(Q(review__isnull=False) & Q(review__is_draft=False)) ).distinct() def draft_reviewed(self): @@ -85,7 +90,9 @@ def staff(self): return self.filter(type__name=STAFF_GROUP_NAME) def get_or_create_for_user(self, submission, reviewer): - groups = set(reviewer.groups.values_list('name', flat=True)) & set(REVIEW_GROUPS) + groups = set(reviewer.groups.values_list("name", flat=True)) & set( + REVIEW_GROUPS + ) if len(groups) > 1: if COMMUNITY_REVIEWER_GROUP_NAME in groups: groups = {COMMUNITY_REVIEWER_GROUP_NAME} @@ -104,7 +111,7 @@ def get_or_create_for_user(self, submission, reviewer): return self.get_or_create( submission=submission, reviewer=reviewer, - defaults={'type': group}, + defaults={"type": group}, ) def get_or_create_staff(self, submission, reviewer): @@ -123,14 +130,17 @@ def bulk_create_reviewers(self, reviewers, submission): role=None, reviewer=reviewer, type=group, - ) for reviewer in reviewers + ) + for reviewer in reviewers ], - ignore_conflicts=True + ignore_conflicts=True, ) def update_role(self, role, reviewer, *submissions): # Remove role who didn't review - self.filter(submission__in=submissions, role=role).never_tried_to_review().delete() + self.filter( + submission__in=submissions, role=role + ).never_tried_to_review().delete() # Anyone else we remove their role self.filter(submission__in=submissions, role=role).update(role=None) # Create/update the new role reviewers @@ -139,12 +149,11 @@ def update_role(self, role, reviewer, *submissions): self.update_or_create( submission=submission, reviewer=reviewer, - defaults={'role': role, 'type': group}, + defaults={"role": role, "type": group}, ) class AssignedReviewers(models.Model): - wagtail_reference_index_ignore = True reviewer = models.ForeignKey( @@ -153,17 +162,15 @@ class AssignedReviewers(models.Model): limit_choices_to=LIMIT_TO_REVIEWER_GROUPS, ) type = models.ForeignKey( - 'auth.Group', + "auth.Group", on_delete=models.PROTECT, ) submission = models.ForeignKey( - 'funds.ApplicationSubmission', - related_name='assigned', - on_delete=models.CASCADE + "funds.ApplicationSubmission", related_name="assigned", on_delete=models.CASCADE ) role = models.ForeignKey( - 'funds.ReviewerRole', - related_name='+', + "funds.ReviewerRole", + related_name="+", on_delete=models.SET_NULL, null=True, ) @@ -171,13 +178,13 @@ class AssignedReviewers(models.Model): objects = AssignedReviewersQuerySet.as_manager() class Meta: - unique_together = (('submission', 'role'), ('submission', 'reviewer')) + unique_together = (("submission", "role"), ("submission", "reviewer")) def __hash__(self): return hash(self.pk) def __str__(self): - return f'{self.reviewer}' + return f"{self.reviewer}" def __eq__(self, other): if not isinstance(other, models.Model): @@ -187,7 +194,9 @@ def __eq__(self, other): my_pk = self.pk if my_pk is None: return self is other - return all([ - self.reviewer_id == other.reviewer_id, - self.role_id == other.role_id, - ]) + return all( + [ + self.reviewer_id == other.reviewer_id, + self.role_id == other.role_id, + ] + ) diff --git a/hypha/apply/funds/models/forms.py b/hypha/apply/funds/models/forms.py index 9952020c2a..39ad01c0d6 100644 --- a/hypha/apply/funds/models/forms.py +++ b/hypha/apply/funds/models/forms.py @@ -15,8 +15,8 @@ class ApplicationForm(models.Model): form_fields = StreamField(ApplicationCustomFormFieldsBlock(), use_json_field=True) panels = [ - FieldPanel('name'), - FieldPanel('form_fields'), + FieldPanel("name"), + FieldPanel("form_fields"), ] def __str__(self): @@ -27,15 +27,15 @@ class AbstractRelatedForm(Orderable): FIRST_STAGE = 1 SECOND_STAGE = 2 STAGE_CHOICES = [ - (FIRST_STAGE, '1st Stage'), - (SECOND_STAGE, '2nd Stage'), + (FIRST_STAGE, "1st Stage"), + (SECOND_STAGE, "2nd Stage"), ] - form = models.ForeignKey('ApplicationForm', on_delete=models.PROTECT) + form = models.ForeignKey("ApplicationForm", on_delete=models.PROTECT) stage = models.PositiveSmallIntegerField(choices=STAGE_CHOICES) panels = [ - FilteredFieldPanel('form', filter_query={'roundbaseform__isnull': True}), - FieldPanel('stage'), + FilteredFieldPanel("form", filter_query={"roundbaseform__isnull": True}), + FieldPanel("stage"), ] @property @@ -49,7 +49,7 @@ def __eq__(self, other): try: if self.fields == other.fields and self.sort_order == other.sort_order: # If the objects are saved to db. pk should also be compared - if hasattr(other, 'pk') and hasattr(self, 'pk'): + if hasattr(other, "pk") and hasattr(self, "pk"): return self.pk == other.pk return True return False @@ -65,15 +65,15 @@ def __str__(self): class ApplicationBaseForm(AbstractRelatedForm): - application = ParentalKey('ApplicationBase', related_name='forms') + application = ParentalKey("ApplicationBase", related_name="forms") class RoundBaseForm(AbstractRelatedForm): - round = ParentalKey('RoundBase', related_name='forms') + round = ParentalKey("RoundBase", related_name="forms") class LabBaseForm(AbstractRelatedForm): - lab = ParentalKey('LabBase', related_name='forms') + lab = ParentalKey("LabBase", related_name="forms") class AbstractRelatedDeterminationForm(Orderable): @@ -81,13 +81,16 @@ class Meta(Orderable.Meta): abstract = True form = models.ForeignKey( - 'determinations.DeterminationForm', on_delete=models.PROTECT + "determinations.DeterminationForm", on_delete=models.PROTECT ) panels = [ - FilteredFieldPanel('form', filter_query={ - 'roundbasedeterminationform__isnull': True, - }) + FilteredFieldPanel( + "form", + filter_query={ + "roundbasedeterminationform__isnull": True, + }, + ) ] @property @@ -98,7 +101,7 @@ def __eq__(self, other): try: if self.fields == other.fields and self.sort_order == other.sort_order: # If the objects are saved to db. pk should also be compared - if hasattr(other, 'pk') and hasattr(self, 'pk'): + if hasattr(other, "pk") and hasattr(self, "pk"): return self.pk == other.pk return True return False @@ -117,12 +120,15 @@ class AbstractRelatedReviewForm(Orderable): class Meta(Orderable.Meta): abstract = True - form = models.ForeignKey('review.ReviewForm', on_delete=models.PROTECT) + form = models.ForeignKey("review.ReviewForm", on_delete=models.PROTECT) panels = [ - FilteredFieldPanel('form', filter_query={ - 'roundbasereviewform__isnull': True, - }) + FilteredFieldPanel( + "form", + filter_query={ + "roundbasereviewform__isnull": True, + }, + ) ] @property @@ -133,7 +139,7 @@ def __eq__(self, other): try: if self.fields == other.fields and self.sort_order == other.sort_order: # If the objects are saved to db. pk should also be compared - if hasattr(other, 'pk') and hasattr(self, 'pk'): + if hasattr(other, "pk") and hasattr(self, "pk"): return self.pk == other.pk return True return False @@ -149,46 +155,48 @@ def __str__(self): class ApplicationBaseReviewForm(AbstractRelatedReviewForm): - application = ParentalKey('ApplicationBase', related_name='review_forms') + application = ParentalKey("ApplicationBase", related_name="review_forms") class ApplicationBaseExternalReviewForm(AbstractRelatedReviewForm): - application = ParentalKey('ApplicationBase', related_name='external_review_forms') + application = ParentalKey("ApplicationBase", related_name="external_review_forms") class RoundBaseReviewForm(AbstractRelatedReviewForm): - round = ParentalKey('RoundBase', related_name='review_forms') + round = ParentalKey("RoundBase", related_name="review_forms") class RoundBaseExternalReviewForm(AbstractRelatedReviewForm): - round = ParentalKey('RoundBase', related_name='external_review_forms') + round = ParentalKey("RoundBase", related_name="external_review_forms") class LabBaseReviewForm(AbstractRelatedReviewForm): - lab = ParentalKey('LabBase', related_name='review_forms') + lab = ParentalKey("LabBase", related_name="review_forms") class LabBaseExternalReviewForm(AbstractRelatedReviewForm): - lab = ParentalKey('LabBase', related_name='external_review_forms') + lab = ParentalKey("LabBase", related_name="external_review_forms") class ApplicationBaseDeterminationForm(AbstractRelatedDeterminationForm): - application = ParentalKey('ApplicationBase', related_name='determination_forms') + application = ParentalKey("ApplicationBase", related_name="determination_forms") class RoundBaseDeterminationForm(AbstractRelatedDeterminationForm): - round = ParentalKey('RoundBase', related_name='determination_forms') + round = ParentalKey("RoundBase", related_name="determination_forms") class LabBaseDeterminationForm(AbstractRelatedDeterminationForm): - lab = ParentalKey('LabBase', related_name='determination_forms') + lab = ParentalKey("LabBase", related_name="determination_forms") class AbstractRelatedProjectApprovalForm(Orderable): class Meta(Orderable.Meta): abstract = True - form = models.ForeignKey('application_projects.ProjectApprovalForm', on_delete=models.PROTECT) + form = models.ForeignKey( + "application_projects.ProjectApprovalForm", on_delete=models.PROTECT + ) @property def fields(self): @@ -198,7 +206,7 @@ def __eq__(self, other): try: if self.fields == other.fields and self.sort_order == other.sort_order: # If the objects are saved to db. pk should also be compared - if hasattr(other, 'pk') and hasattr(self, 'pk'): + if hasattr(other, "pk") and hasattr(self, "pk"): return self.pk == other.pk return True return False @@ -214,11 +222,14 @@ def __str__(self): class AbstractRelatedProjectSOWForm(Orderable): - """ Abstract class for SOW Form to use it in Funds and Labs, similar to the other forms liks ReviewForms etc """ + """Abstract class for SOW Form to use it in Funds and Labs, similar to the other forms liks ReviewForms etc""" + class Meta(Orderable.Meta): abstract = True - form = models.ForeignKey('application_projects.ProjectSOWForm', on_delete=models.PROTECT) + form = models.ForeignKey( + "application_projects.ProjectSOWForm", on_delete=models.PROTECT + ) @property def fields(self): @@ -228,7 +239,7 @@ def __eq__(self, other): try: if self.fields == other.fields and self.sort_order == other.sort_order: # If the objects are saved to db. pk should also be compared - if hasattr(other, 'pk') and hasattr(self, 'pk'): + if hasattr(other, "pk") and hasattr(self, "pk"): return self.pk == other.pk return True return False @@ -244,16 +255,16 @@ def __str__(self): class ApplicationBaseProjectApprovalForm(AbstractRelatedProjectApprovalForm): - application = ParentalKey('ApplicationBase', related_name='approval_forms') + application = ParentalKey("ApplicationBase", related_name="approval_forms") class ApplicationBaseProjectSOWForm(AbstractRelatedProjectSOWForm): - application = ParentalKey('ApplicationBase', related_name='sow_forms') + application = ParentalKey("ApplicationBase", related_name="sow_forms") class LabBaseProjectApprovalForm(AbstractRelatedProjectApprovalForm): - lab = ParentalKey('LabBase', related_name='approval_forms') + lab = ParentalKey("LabBase", related_name="approval_forms") class LabBaseProjectSOWForm(AbstractRelatedProjectSOWForm): - lab = ParentalKey('LabBase', related_name='sow_forms') + lab = ParentalKey("LabBase", related_name="sow_forms") diff --git a/hypha/apply/funds/models/mixins.py b/hypha/apply/funds/models/mixins.py index 64ea1bc723..1d7aae6fee 100644 --- a/hypha/apply/funds/models/mixins.py +++ b/hypha/apply/funds/models/mixins.py @@ -16,7 +16,7 @@ from ..files import SubmissionStreamFieldFile -__all__ = ['AccessFormData'] +__all__ = ["AccessFormData"] class UnusedFieldException(Exception): @@ -30,6 +30,7 @@ class AccessFormData: - form_data > jsonfield containing the submitted data - form_fields > streamfield containing the original form fields """ + stream_file_class = SubmissionStreamFieldFile storage_class = PrivateStorage @@ -56,17 +57,33 @@ def stream_file(cls, instance, field, file): if isinstance(file, cls.stream_file_class): return file if isinstance(file, File): - return cls.stream_file_class(instance, field, file, name=file.name, storage=cls.storage_class()) + return cls.stream_file_class( + instance, field, file, name=file.name, storage=cls.storage_class() + ) if isinstance(file, PlaceholderUploadedFile): - return cls.stream_file_class(instance, field, None, name=file.file_id, filename=file.name, storage=cls.storage_class()) + return cls.stream_file_class( + instance, + field, + None, + name=file.file_id, + filename=file.name, + storage=cls.storage_class(), + ) # This fixes a backwards compatibility issue with #507 # Once every application has been re-saved it should be possible to remove it - if 'path' in file: - file['filename'] = file['name'] - file['name'] = file['path'] - return cls.stream_file_class(instance, field, None, name=file['name'], filename=file.get('filename'), storage=cls.storage_class()) + if "path" in file: + file["filename"] = file["name"] + file["name"] = file["path"] + return cls.stream_file_class( + instance, + field, + None, + name=file["name"], + filename=file.get("filename"), + storage=cls.storage_class(), + ) @classmethod def process_file(cls, instance, field, file): @@ -100,9 +117,11 @@ def extract_files(self): @classmethod def from_db(cls, db, field_names, values): instance = super().from_db(db, field_names, values) - if 'form_data' in field_names: + if "form_data" in field_names: # When the form_data is loaded from the DB deserialise it - instance.form_data = cls.deserialised_data(instance, instance.form_data, instance.form_fields) + instance.form_data = cls.deserialised_data( + instance, instance.form_data, instance.form_fields + ) return instance @classmethod @@ -113,9 +132,9 @@ def deserialised_data(cls, instance, data, form_fields): # Do not attempt to iterate over form_fields - that will fully instantiate the form_fields # including any sub queries that they do for i, field_data in enumerate(form_fields.raw_data): - block = form_fields.stream_block.child_blocks[field_data['type']] + block = form_fields.stream_block.child_blocks[field_data["type"]] if isinstance(block, UploadableMediaBlock): - field_id = field_data.get('id') + field_id = field_data.get("id") if field_id: field = form_fields[i] file = data.get(field_id, []) @@ -151,7 +170,9 @@ def question_field_ids(self): @property def file_field_ids(self): for field_id, field in self.fields.items(): - if isinstance(field.block, (FileFieldBlock, ImageFieldBlock, MultiFileFieldBlock)): + if isinstance( + field.block, (FileFieldBlock, ImageFieldBlock, MultiFileFieldBlock) + ): yield field_id @property @@ -177,10 +198,7 @@ def first_group_question_text_field_ids(self): @property def raw_fields(self): # Field ids to field class mapping - similar to raw_data - return { - field.id: field - for field in self.form_fields - } + return {field.id: field for field in self.form_fields} @property def fields(self): @@ -222,12 +240,9 @@ def first_group_normal_text_blocks(self): ] def get_serialize_multi_inputs_answer(self, field): - number_of_inputs = field.value.get('number_of_inputs') - answers = [ - self.data(field.id + '_' + str(i)) - for i in range(number_of_inputs) - ] - data = ', '.join(filter(None, answers)) + number_of_inputs = field.value.get("number_of_inputs") + answers = [self.data(field.id + "_" + str(i)) for i in range(number_of_inputs)] + data = ", ".join(filter(None, answers)) return data def serialize(self, field_id): @@ -236,33 +251,33 @@ def serialize(self, field_id): data = self.get_serialize_multi_inputs_answer(field) else: data = self.data(field_id) - return field.render(context={ - 'serialize': True, - 'data': data, - }) + return field.render( + context={ + "serialize": True, + "data": data, + } + ) def get_multi_inputs_answer(self, field, include_question=False): - number_of_inputs = field.value.get('number_of_inputs') - answers = [ - self.data(field.id + '_' + str(i)) - for i in range(number_of_inputs) - ] + number_of_inputs = field.value.get("number_of_inputs") + answers = [self.data(field.id + "_" + str(i)) for i in range(number_of_inputs)] render_data = [ field.render( context={ - 'data': answer, - 'include_question': include_question if i == 0 else False - }) + "data": answer, + "include_question": include_question if i == 0 else False, + } + ) for i, answer in enumerate(filter(None, answers)) ] - return ''.join(render_data).replace('
', '') + '' + return "".join(render_data).replace("", "") + "" def render_answer(self, field_id, include_question=False): try: field = self.field(field_id) except UnusedFieldException: - return '-' + return "-" if isinstance(field.block, MultiInputCharFieldBlock): render_data = self.get_multi_inputs_answer(field, include_question) return render_data @@ -270,8 +285,12 @@ def render_answer(self, field_id, include_question=False): data = self.data(field_id) # Some migrated content have empty address. if not data: - return field.render(context={'data': '', 'include_question': include_question}) - return field.render(context={'data': data, 'include_question': include_question}) + return field.render( + context={"data": "", "include_question": include_question} + ) + return field.render( + context={"data": data, "include_question": include_question} + ) def render_answers(self): # Returns a list of the rendered answers @@ -296,23 +315,23 @@ def render_text_blocks_answers(self): def output_answers(self): # Returns a safe string of the rendered answers - return mark_safe(''.join(self.render_answers())) + return mark_safe("".join(self.render_answers())) def output_text_answers(self): - return mark_safe(''.join(self.render_text_blocks_answers())) + return mark_safe("".join(self.render_text_blocks_answers())) def output_first_group_text_answers(self): - return mark_safe(''.join(self.render_first_group_text_answers())) + return mark_safe("".join(self.render_first_group_text_answers())) def get_answer_from_label(self, label): for field_id in self.question_text_field_ids: if field_id not in self.named_blocks: question_field = self.serialize(field_id) - if label.lower() in question_field['question'].lower(): - if isinstance(question_field['answer'], str): - answer = question_field['answer'] + if label.lower() in question_field["question"].lower(): + if isinstance(question_field["answer"], str): + answer = question_field["answer"] else: - answer = ','.join(question_field['answer']) - if answer and not answer == 'N': + answer = ",".join(question_field["answer"]) + if answer and not answer == "N": return answer return None diff --git a/hypha/apply/funds/models/reminders.py b/hypha/apply/funds/models/reminders.py index 0fc1515ecb..44057f9802 100644 --- a/hypha/apply/funds/models/reminders.py +++ b/hypha/apply/funds/models/reminders.py @@ -7,21 +7,19 @@ class Reminder(models.Model): - REVIEW = 'reviewers_review' + REVIEW = "reviewers_review" ACTIONS = { - REVIEW: 'Remind reviewers to Review', - } - EMAIL = 'email' - MEDIUM = { - REVIEW: EMAIL + REVIEW: "Remind reviewers to Review", } + EMAIL = "email" + MEDIUM = {REVIEW: EMAIL} ACTION_MESSAGE = { - f'{REVIEW}-{EMAIL}': MESSAGES.REVIEW_REMINDER, + f"{REVIEW}-{EMAIL}": MESSAGES.REVIEW_REMINDER, } submission = models.ForeignKey( - 'funds.ApplicationSubmission', + "funds.ApplicationSubmission", on_delete=models.CASCADE, - related_name='reminders' + related_name="reminders", ) user = models.ForeignKey( settings.AUTH_USER_MODEL, @@ -34,21 +32,20 @@ class Reminder(models.Model): max_length=50, ) sent = models.BooleanField(default=False) - title = models.CharField(max_length=60, blank=False, default='') + title = models.CharField(max_length=60, blank=False, default="") description = models.TextField(blank=True) def __str__(self): - return '{} at {}'.format( - self.ACTIONS[self.action], - self.time.strftime('%Y-%m-%d %I:%M %p') + return "{} at {}".format( + self.ACTIONS[self.action], self.time.strftime("%Y-%m-%d %I:%M %p") ) class Meta: - ordering = ['-time'] + ordering = ["-time"] def clean(self): - if self.title == '': - raise ValidationError('Title is Empty') + if self.title == "": + raise ValidationError("Title is Empty") @property def is_expired(self): @@ -56,7 +53,7 @@ def is_expired(self): @property def action_message(self): - return self.ACTION_MESSAGE[f'{self.action}-{self.medium}'] + return self.ACTION_MESSAGE[f"{self.action}-{self.medium}"] @property def action_type(self): diff --git a/hypha/apply/funds/models/reviewer_role.py b/hypha/apply/funds/models/reviewer_role.py index 6ce08e3066..6cddf51e55 100644 --- a/hypha/apply/funds/models/reviewer_role.py +++ b/hypha/apply/funds/models/reviewer_role.py @@ -9,22 +9,22 @@ class ReviewerRole(models.Model): name = models.CharField(max_length=128) icon = models.ForeignKey( - 'images.CustomImage', + "images.CustomImage", null=True, blank=True, - related_name='+', - on_delete=models.SET_NULL + related_name="+", + on_delete=models.SET_NULL, ) order = models.IntegerField( - help_text=_('The order this role should appear in the Update Reviewers form.'), + help_text=_("The order this role should appear in the Update Reviewers form."), null=True, blank=True, ) panels = [ - FieldPanel('name'), - FieldPanel('icon'), - FieldPanel('order'), + FieldPanel("name"), + FieldPanel("icon"), + FieldPanel("order"), ] def icon_url(self, filter_spec): @@ -39,56 +39,55 @@ def __str__(self): @register_setting class ReviewerSettings(BaseSiteSetting): SUBMISSIONS = [ - ('all', 'All Submissions'), - ('reviewed', 'Only reviewed Submissions'), + ("all", "All Submissions"), + ("reviewed", "Only reviewed Submissions"), ] STATES = [ - ('all', 'All States'), - ('ext_state_or_higher', 'Only External review and higher'), - ('ext_state_only', 'Only External review') + ("all", "All States"), + ("ext_state_or_higher", "Only External review and higher"), + ("ext_state_only", "Only External review"), ] OUTCOMES = [ - ('all', 'All Outcomes'), - ('all_except_dismissed', 'All Outcomes Except Dismissed'), - ('accepted', 'Only Accepted') + ("all", "All Outcomes"), + ("all_except_dismissed", "All Outcomes Except Dismissed"), + ("accepted", "Only Accepted"), ] class Meta: - verbose_name = 'Reviewer Settings' + verbose_name = "Reviewer Settings" submission = models.CharField( choices=SUBMISSIONS, - default='all', + default="all", max_length=10, - help_text=_('Submissions for which reviewers should have access to') + help_text=_("Submissions for which reviewers should have access to"), ) state = models.CharField( choices=STATES, - default='all', + default="all", max_length=20, - help_text=_('Submissions states for which reviewers should have access to') + help_text=_("Submissions states for which reviewers should have access to"), ) outcome = models.CharField( choices=OUTCOMES, - default='all', + default="all", max_length=20, - help_text=_('Submissions outcomes for which reviewers should have access to') + help_text=_("Submissions outcomes for which reviewers should have access to"), ) assigned = models.BooleanField( - default=False, - help_text=_('Submissions for which reviewer is assigned to') + default=False, help_text=_("Submissions for which reviewer is assigned to") ) use_settings = models.BooleanField( default=False, - help_text=_('Use the above configured variables to filter out submissions') + help_text=_("Use the above configured variables to filter out submissions"), ) panels = [ - FieldPanel('submission'), - FieldPanel('state'), - FieldPanel('outcome'), - FieldPanel('assigned'), - FieldPanel('use_settings'), + FieldPanel("submission"), + FieldPanel("state"), + FieldPanel("outcome"), + FieldPanel("assigned"), + FieldPanel("use_settings"), ] diff --git a/hypha/apply/funds/models/screening.py b/hypha/apply/funds/models/screening.py index 8f3b606771..0abc0318e5 100644 --- a/hypha/apply/funds/models/screening.py +++ b/hypha/apply/funds/models/screening.py @@ -7,12 +7,14 @@ class ScreeningStatus(models.Model): title = models.CharField(max_length=128) yes = models.BooleanField( - default=False, verbose_name=_('Yes/No'), - help_text=_('Tick mark for Yes otherwise No.') + default=False, + verbose_name=_("Yes/No"), + help_text=_("Tick mark for Yes otherwise No."), ) default = models.BooleanField( - default=False, verbose_name=_('Default Yes/No'), - help_text=_('Only one Yes and No screening decision can be set as default.') + default=False, + verbose_name=_("Default Yes/No"), + help_text=_("Only one Yes and No screening decision can be set as default."), ) base_form_class = ScreeningStatusAdminForm diff --git a/hypha/apply/funds/models/submissions.py b/hypha/apply/funds/models/submissions.py index 50e61b63bc..ae0a1f8a57 100644 --- a/hypha/apply/funds/models/submissions.py +++ b/hypha/apply/funds/models/submissions.py @@ -76,35 +76,39 @@ class JSONOrderable(models.QuerySet): - json_field = '' + json_field = "" def order_by(self, *field_names): if not self.json_field: raise ValueError( - 'json_field cannot be blank, please provide a field on which to perform the ordering' + "json_field cannot be blank, please provide a field on which to perform the ordering" ) def build_json_order_by(field): try: - if field.replace('-', '') not in NAMED_BLOCKS: + if field.replace("-", "") not in NAMED_BLOCKS: return field except AttributeError: return field - if field[0] == '-': + if field[0] == "-": descending = True field = field[1:] else: descending = False db_table = self.model._meta.db_table - return OrderBy(RawSQL(f'LOWER({db_table}.{self.json_field}->>%s)', (field,)), descending=descending, nulls_last=True) + return OrderBy( + RawSQL(f"LOWER({db_table}.{self.json_field}->>%s)", (field,)), + descending=descending, + nulls_last=True, + ) field_ordering = [build_json_order_by(field) for field in field_names] return super().order_by(*field_ordering) class ApplicationSubmissionQueryset(JSONOrderable): - json_field = 'form_data' + json_field = "form_data" def active(self): return self.filter(status__in=active_statuses, is_archive=False) @@ -116,11 +120,12 @@ def in_community_review(self, user): qs = self.filter( Q(status__in=COMMUNITY_REVIEW_PHASES), ~Q(user=user), - ~Q(reviews__author=user) | ( - Q(reviews__author=user) & Q(reviews__is_draft=True) - ) + ~Q(reviews__author=user) + | (Q(reviews__author=user) & Q(reviews__is_draft=True)), + ) + qs = qs.exclude( + reviews__opinions__opinion=AGREE, reviews__opinions__author=user ) - qs = qs.exclude(reviews__opinions__opinion=AGREE, reviews__opinions__author=user) return qs.distinct() def in_review(self): @@ -128,30 +133,32 @@ def in_review(self): def in_review_for(self, user, assigned=True): user_review_statuses = get_review_active_statuses(user) - qs = self.prefetch_related('reviews__author__reviewer') + qs = self.prefetch_related("reviews__author__reviewer") qs = qs.filter( Q(status__in=user_review_statuses), - ~Q(reviews__author__reviewer=user) | ( - Q(reviews__author__reviewer=user) & Q(reviews__is_draft=True) - ) + ~Q(reviews__author__reviewer=user) + | (Q(reviews__author__reviewer=user) & Q(reviews__is_draft=True)), ) if assigned: qs = qs.filter(reviewers=user) # If this user has agreed with a review, then they have reviewed this submission already - qs = qs.exclude(reviews__opinions__opinion=AGREE, reviews__opinions__author__reviewer=user) + qs = qs.exclude( + reviews__opinions__opinion=AGREE, + reviews__opinions__author__reviewer=user, + ) return qs.distinct() def for_reviewer_settings(self, user, reviewer_settings): qs = self - if reviewer_settings.submission == 'reviewed': + if reviewer_settings.submission == "reviewed": qs = qs.reviewed_by(user) - if reviewer_settings.state == 'ext_state_or_higher': + if reviewer_settings.state == "ext_state_or_higher": qs = qs.filter(status__in=ext_or_higher_statuses) - if reviewer_settings.state == 'ext_state_only': + if reviewer_settings.state == "ext_state_only": qs = qs.filter(status__in=ext_review_statuses) - if reviewer_settings.outcome == 'accepted': + if reviewer_settings.outcome == "accepted": qs = qs.filter(status__in=accepted_statuses) - if reviewer_settings.outcome == 'all_except_dismissed': + if reviewer_settings.outcome == "all_except_dismissed": qs = qs.exclude(status__in=dismissed_statuses) if reviewer_settings.assigned: qs = qs.filter(reviewers=user) @@ -173,7 +180,11 @@ def awaiting_determination_for(self, user): return self.filter(status__in=DETERMINATION_RESPONSE_PHASES).filter(lead=user) def undetermined(self): - determined_submissions = Determination.objects.filter(submission__in=self).final().values('submission') + determined_submissions = ( + Determination.objects.filter(submission__in=self) + .final() + .values("submission") + ) return self.exclude(pk__in=determined_submissions) def current(self): @@ -189,15 +200,17 @@ def include_archive(self): def current_accepted(self): # Applications which have the current stage active (have not been progressed) - return self.filter(status__in=PHASES_MAPPING['accepted']['statuses']).current() + return self.filter(status__in=PHASES_MAPPING["accepted"]["statuses"]).current() def value(self): return self.annotate( - value=Cast(KeyTextTransform('value', 'form_data'), output_field=FloatField()) + value=Cast( + KeyTextTransform("value", "form_data"), output_field=FloatField() + ) ).aggregate( - Count('value'), - Avg('value'), - Sum('value'), + Count("value"), + Avg("value"), + Sum("value"), ) def exclude_draft(self): @@ -205,30 +218,35 @@ def exclude_draft(self): def with_latest_update(self): activities = self.model.activities.rel.model - latest_activity = activities.objects.filter(submission=OuterRef('id')).select_related('user') + latest_activity = activities.objects.filter( + submission=OuterRef("id") + ).select_related("user") return self.annotate( - last_user_update=Subquery(latest_activity[:1].values('user__full_name')), - last_update=Subquery(latest_activity.values('timestamp')[:1]), + last_user_update=Subquery(latest_activity[:1].values("user__full_name")), + last_update=Subquery(latest_activity.values("timestamp")[:1]), ) def for_table(self, user): roles_for_review = self.model.assigned.field.model.objects.with_roles().filter( - submission=OuterRef('id'), reviewer=user) + submission=OuterRef("id"), reviewer=user + ) qs = annotate_review_recommendation_and_count(self.with_latest_update()) qs = annotate_comments_count(qs, user) - return qs.annotate( - role_icon=Subquery(roles_for_review[:1].values('role__icon')), - ).select_related( - 'page', - 'round', - 'lead', - 'user', - 'previous__page', - 'previous__round', - 'previous__lead', - ).prefetch_related( - 'screening_statuses' + return ( + qs.annotate( + role_icon=Subquery(roles_for_review[:1].values("role__icon")), + ) + .select_related( + "page", + "round", + "lead", + "user", + "previous__page", + "previous__round", + "previous__lead", + ) + .prefetch_related("screening_statuses") ) @@ -253,12 +271,13 @@ def wrapped(*args, **kwargs): # Without this using the same method for multiple transitions fails as # the fsm wrapping is overwritten return func(*args, **kwargs) + return wrapped def transition_id(target, phase): - transition_prefix = 'transition' - return '__'.join([transition_prefix, phase.stage.name.lower(), phase.name, target]) + transition_prefix = "transition" + return "__".join([transition_prefix, phase.stage.name.lower(), phase.name, target]) class AddTransitions(models.base.ModelBase): @@ -267,18 +286,22 @@ def __new__(cls, name, bases, attrs, **kwargs): for phase, data in workflow.items(): for transition_name, action in data.transitions.items(): method_name = transition_id(transition_name, data) - permission_name = method_name + '_permission' - permission_func = make_permission_check(action['permissions']) + permission_name = method_name + "_permission" + permission_func = make_permission_check(action["permissions"]) # Get the method defined on the parent or default to a NOOP - transition_state = wrap_method(attrs.get(action.get('method'), lambda *args, **kwargs: None)) + transition_state = wrap_method( + attrs.get(action.get("method"), lambda *args, **kwargs: None) + ) # Provide a neat name for graph viz display - transition_state.__name__ = slugify(action['display']) + transition_state.__name__ = slugify(action["display"]) - conditions = [attrs[condition] for condition in action.get('conditions', [])] + conditions = [ + attrs[condition] for condition in action.get("conditions", []) + ] # Wrap with transition decorator transition_func = transition( - attrs['status'], + attrs["status"], source=phase, target=transition_name, permission=permission_func, @@ -299,17 +322,21 @@ def get_transition(self, transition): # For the other workflow return None - attrs['get_transition'] = get_transition + attrs["get_transition"] = get_transition def get_actions_for_user(self, user): transitions = self.get_available_user_status_transitions(user) actions = [ - (transition.target, self.phase.transitions[transition.target]['display']) - for transition in transitions if self.get_transition(transition.target) + ( + transition.target, + self.phase.transitions[transition.target]["display"], + ) + for transition in transitions + if self.get_transition(transition.target) ] yield from actions - attrs['get_actions_for_user'] = get_actions_for_user + attrs["get_actions_for_user"] = get_actions_for_user def perform_transition(self, action, user, request=None, **kwargs): transition = self.get_transition(action) @@ -320,21 +347,23 @@ def perform_transition(self, action, user, request=None, **kwargs): raise PermissionDenied(f'You do not have permission to "{ action }"') transition(by=user, request=request, **kwargs) - self.save(update_fields=['status']) + self.save(update_fields=["status"]) self.progress_stage_when_possible(user, request, **kwargs) - attrs['perform_transition'] = perform_transition + attrs["perform_transition"] = perform_transition def progress_stage_when_possible(self, user, request, notify=None, **kwargs): # Check to see if we can progress to a new stage from the current status for stage_transition in STAGE_CHANGE_ACTIONS: try: - self.perform_transition(stage_transition, user, request=request, notify=False, **kwargs) + self.perform_transition( + stage_transition, user, request=request, notify=False, **kwargs + ) except PermissionDenied: pass - attrs['progress_stage_when_possible'] = progress_stage_when_possible + attrs["progress_stage_when_possible"] = progress_stage_when_possible return super().__new__(cls, name, bases, attrs, **kwargs) @@ -346,7 +375,7 @@ def __new__(cls, name, bases, attrs, **kwargs): # We want to access the redered display of the required fields. # Treat in similar way to django's get_FIELD_display for block_name in NAMED_BLOCKS: - partial_method_name = f'_{block_name}_method' + partial_method_name = f"_{block_name}_method" # We need to generate the partial method and the wrap it in property so # we can access the required fields like normal fields. e.g. self.title # Partial method requires __get__ to be called in order to bind it to the @@ -360,66 +389,75 @@ def __new__(cls, name, bases, attrs, **kwargs): ) setattr( cls, - f'{block_name}', + f"{block_name}", property(getattr(cls, partial_method_name)), ) setattr( cls, - f'get_{block_name}_display', + f"get_{block_name}_display", partialmethod(cls._get_REQUIRED_display, name=block_name), ) return cls class ApplicationSubmission( - WorkflowHelpers, - BaseStreamForm, - AccessFormData, - AbstractFormSubmission, - metaclass=ApplicationSubmissionMetaclass, + WorkflowHelpers, + BaseStreamForm, + AccessFormData, + AbstractFormSubmission, + metaclass=ApplicationSubmissionMetaclass, ): form_data = models.JSONField(encoder=StreamFieldDataEncoder) form_fields = StreamField(ApplicationCustomFormFieldsBlock(), use_json_field=True) - summary = models.TextField(default='', null=True, blank=True) - page = models.ForeignKey('wagtailcore.Page', on_delete=models.PROTECT) - round = models.ForeignKey('wagtailcore.Page', on_delete=models.PROTECT, related_name='submissions', null=True) + summary = models.TextField(default="", null=True, blank=True) + page = models.ForeignKey("wagtailcore.Page", on_delete=models.PROTECT) + round = models.ForeignKey( + "wagtailcore.Page", + on_delete=models.PROTECT, + related_name="submissions", + null=True, + ) lead = models.ForeignKey( settings.AUTH_USER_MODEL, limit_choices_to=LIMIT_TO_STAFF, - related_name='submission_lead', + related_name="submission_lead", on_delete=models.PROTECT, ) - next = models.OneToOneField('self', on_delete=models.CASCADE, related_name='previous', null=True) + next = models.OneToOneField( + "self", on_delete=models.CASCADE, related_name="previous", null=True + ) reviewers = models.ManyToManyField( settings.AUTH_USER_MODEL, - related_name='submissions_reviewer', + related_name="submissions_reviewer", blank=True, - through='AssignedReviewers', + through="AssignedReviewers", ) partners = models.ManyToManyField( settings.AUTH_USER_MODEL, - related_name='submissions_partner', + related_name="submissions_partner", limit_choices_to=LIMIT_TO_PARTNERS, blank=True, ) meta_terms = models.ManyToManyField( MetaTerm, - related_name='submissions', + related_name="submissions", blank=True, ) flags = GenericRelation( Flag, - content_type_field='target_content_type', - object_id_field='target_object_id', - related_query_name='submission', + content_type_field="target_content_type", + object_id_field="target_object_id", + related_query_name="submission", ) activities = GenericRelation( - 'activity.Activity', - content_type_field='source_content_type', - object_id_field='source_object_id', - related_query_name='submission', + "activity.Activity", + content_type_field="source_content_type", + object_id_field="source_object_id", + related_query_name="submission", + ) + user = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True ) - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True) search_data = models.TextField() search_document = SearchVectorField(null=True) @@ -427,26 +465,26 @@ class ApplicationSubmission( status = FSMField(default=INITIAL_STATE, protected=True) screening_statuses = models.ManyToManyField( - 'funds.ScreeningStatus', - related_name='submissions', - blank=True + "funds.ScreeningStatus", related_name="submissions", blank=True ) - submit_time = models.DateTimeField(verbose_name=_('submit time'), auto_now_add=False) + submit_time = models.DateTimeField( + verbose_name=_("submit time"), auto_now_add=False + ) _is_draft = False live_revision = models.OneToOneField( - 'ApplicationRevision', + "ApplicationRevision", on_delete=models.CASCADE, - related_name='live', + related_name="live", null=True, editable=False, ) draft_revision = models.OneToOneField( - 'ApplicationRevision', + "ApplicationRevision", on_delete=models.CASCADE, - related_name='draft', + related_name="draft", null=True, editable=False, ) @@ -463,7 +501,7 @@ class ApplicationSubmission( class Meta: indexes = [ - GinIndex(fields=['search_document']), + GinIndex(fields=["search_document"]), ] @property @@ -474,8 +512,9 @@ def not_progressed(self): return not self.next @transition( - status, source='*', - target=RETURN_VALUE(INITIAL_STATE, 'draft_proposal', 'invited_to_proposal'), + status, + source="*", + target=RETURN_VALUE(INITIAL_STATE, "draft_proposal", "invited_to_proposal"), permission=make_permission_check({UserPermissions.ADMIN}), ) def restart_stage(self, **kwargs): @@ -487,10 +526,10 @@ def restart_stage(self, **kwargs): a.restart_stage(by=u) a.save() """ - if hasattr(self, 'previous'): - return 'draft_proposal' + if hasattr(self, "previous"): + return "draft_proposal" elif self.next: - return 'invited_to_proposal' + return "invited_to_proposal" return INITIAL_STATE @property @@ -507,8 +546,8 @@ def active(self): def ensure_user_has_account(self): if self.user and self.user.is_authenticated: - self.form_data['email'] = self.user.email - self.form_data['full_name'] = self.user.get_full_name() + self.form_data["email"] = self.user.email + self.form_data["full_name"] = self.user.get_full_name() # Ensure applying user should have applicant role if not self.user.is_applicant: applicant_group = Group.objects.get(name=APPLICANT_GROUP_NAME) @@ -516,15 +555,14 @@ def ensure_user_has_account(self): self.user.save() else: # Rely on the form having the following must include fields (see blocks.py) - email = self.form_data.get('email') - full_name = self.form_data.get('full_name') + email = self.form_data.get("email") + full_name = self.form_data.get("full_name") User = get_user_model() - if 'skip_account_creation_notification' in self.form_data: - self.form_data.pop('skip_account_creation_notification', None) + if "skip_account_creation_notification" in self.form_data: + self.form_data.pop("skip_account_creation_notification", None) self.user, _ = User.objects.get_or_create( - email=email, - defaults={'full_name': full_name} + email=email, defaults={"full_name": full_name} ) # Ensure applying user should have applicant role if not self.user.is_applicant: @@ -535,12 +573,11 @@ def ensure_user_has_account(self): self.user, _ = User.objects.get_or_create_and_notify( email=email, site=self.page.get_site(), - defaults={'full_name': full_name} + defaults={"full_name": full_name}, ) def get_from_parent(self, attribute): try: - return getattr(self.round.specific, attribute) except AttributeError: # We are a lab submission @@ -557,7 +594,7 @@ def is_determination_form_attached(self): submission or we would still use the old determination forms for backward compatibility. """ - return self.get_from_parent('determination_forms').count() > 0 + return self.get_from_parent("determination_forms").count() > 0 def progress_application(self, **kwargs): target = None @@ -568,15 +605,17 @@ def progress_application(self, **kwargs): # See note in workflow.py target = dict(PHASES)[phase].stage if not target: - raise ValueError('Incorrect State for transition') + raise ValueError("Incorrect State for transition") submission_in_db = ApplicationSubmission.objects.get(id=self.id) prev_meta_terms = submission_in_db.meta_terms.all() self.id = None - proposal_form = kwargs.get('proposal_form') + proposal_form = kwargs.get("proposal_form") proposal_form = int(proposal_form) if proposal_form else 0 - self.form_fields = self.get_from_parent('get_defined_fields')(target, form_index=proposal_form) + self.form_fields = self.get_from_parent("get_defined_fields")( + target, form_index=proposal_form + ) self.live_revision = None self.draft_revision = None @@ -593,18 +632,22 @@ def new_data(self, data): def from_draft(self): self._is_draft = True - self.form_data = self.deserialised_data(self, self.draft_revision.form_data, self.form_fields) + self.form_data = self.deserialised_data( + self, self.draft_revision.form_data, self.form_fields + ) return self def create_revision(self, draft=False, force=False, by=None, **kwargs): # Will return True/False if the revision was created or not - ApplicationRevision = apps.get_model('funds', 'ApplicationRevision') + ApplicationRevision = apps.get_model("funds", "ApplicationRevision") self.clean_submission() current_submission = ApplicationSubmission.objects.get(id=self.id) current_data = current_submission.form_data if current_data != self.form_data or force: if self.live_revision == self.draft_revision: - revision = ApplicationRevision.objects.create(submission=self, form_data=self.form_data, author=by) + revision = ApplicationRevision.objects.create( + submission=self, form_data=self.form_data, author=by + ) else: revision = self.draft_revision revision.form_data = self.form_data @@ -615,7 +658,7 @@ def create_revision(self, draft=False, force=False, by=None, **kwargs): self.form_data = current_submission.form_data else: self.live_revision = revision - self.search_data = ' '.join(list(self.prepare_search_values())) + self.search_data = " ".join(list(self.prepare_search_values())) self.search_document = self.prepare_search_vector() self.draft_revision = revision @@ -641,23 +684,23 @@ def process_form_data(self): def save(self, *args, update_fields=None, skip_custom=False, **kwargs): if update_fields is None: update_fields = [] - if update_fields and 'form_data' not in update_fields: + if update_fields and "form_data" not in update_fields: # We don't want to use this approach if the user is sending data return super().save(*args, update_fields=update_fields, **kwargs) elif skip_custom: return super().save(*args, **kwargs) if self._is_draft: - raise ValueError('Cannot save with draft data') + raise ValueError("Cannot save with draft data") creating = not self.id if creating: self.submit_time = timezone.now() # We are creating the object default to first stage - self.workflow_name = self.get_from_parent('workflow_name') + self.workflow_name = self.get_from_parent("workflow_name") # Copy extra relevant information to the child - self.lead = self.get_from_parent('lead') + self.lead = self.get_from_parent("lead") # We need the submission id to correctly save the files files = self.extract_files() @@ -666,18 +709,18 @@ def save(self, *args, update_fields=None, skip_custom=False, **kwargs): # add a denormed version of the answer for searching # @TODO: remove 'search_data' in favour of 'search_document' for FTS - self.search_data = ' '.join(self.prepare_search_values()) + self.search_data = " ".join(self.prepare_search_values()) self.search_document = self.prepare_search_vector() super().save(*args, **kwargs) if creating: - AssignedReviewers = apps.get_model('funds', 'AssignedReviewers') - ApplicationRevision = apps.get_model('funds', 'ApplicationRevision') + AssignedReviewers = apps.get_model("funds", "AssignedReviewers") + ApplicationRevision = apps.get_model("funds", "ApplicationRevision") self.process_file_data(files) AssignedReviewers.objects.bulk_create_reviewers( - list(self.get_from_parent('reviewers').all()), + list(self.get_from_parent("reviewers").all()), self, ) first_revision = ApplicationRevision.objects.create( @@ -699,7 +742,7 @@ def community_review(self): @property def missing_reviewers(self): - reviewers_submitted = self.assigned.reviewed().values('reviewer') + reviewers_submitted = self.assigned.reviewed().values("reviewer") reviewers = self.reviewers.exclude(id__in=reviewers_submitted) return reviewers @@ -709,7 +752,9 @@ def staff_not_reviewed(self): @property def reviewers_not_reviewed(self): - return self.missing_reviewers.reviewers().exclude(id__in=self.staff_not_reviewed) + return self.missing_reviewers.reviewers().exclude( + id__in=self.staff_not_reviewed + ) def reviewed_by(self, user): return self.assigned.reviewed().filter(reviewer=user).exists() @@ -728,7 +773,12 @@ def has_permission_to_review(self, user): if user in self.reviewers_not_reviewed: return True - if user.is_community_reviewer and self.user != user and self.community_review and not self.reviewed_by(user): + if ( + user.is_community_reviewer + and self.user != user + and self.community_review + and not self.reviewed_by(user) + ): return True return False @@ -759,7 +809,7 @@ def get_searchable_contents(self): value = field.block.get_searchable_content(field.value, data) if value: if isinstance(value, list): - contents.append(', '.join(value)) + contents.append(", ".join(value)) else: contents.append(value) return contents @@ -768,42 +818,41 @@ def prepare_search_values(self): values = self.get_searchable_contents() # Add named fields into the search index - for field in ['full_name', 'email', 'title']: + for field in ["full_name", "email", "title"]: values.append(getattr(self, field)) return values def index_components(self): return { - 'A': ' '.join([f'id:{self.id}', self.title]), - 'C': ' '.join([self.full_name, self.email]), - 'B': ' '.join(self.get_searchable_contents()), + "A": " ".join([f"id:{self.id}", self.title]), + "C": " ".join([self.full_name, self.email]), + "B": " ".join(self.get_searchable_contents()), } def prepare_search_vector(self): search_vectors = [] for weight, text in self.index_components().items(): - search_vectors.append( - SearchVector(Value(text), weight=weight) - ) + search_vectors.append(SearchVector(Value(text), weight=weight)) return reduce(operator.add, search_vectors) - def get_absolute_url(self): - return reverse('funds:submissions:detail', urlconf='hypha.apply.urls', args=(self.id,)) + return reverse( + "funds:submissions:detail", urlconf="hypha.apply.urls", args=(self.id,) + ) def __str__(self): - return f'{self.title} from {self.full_name} for {self.page.title}' + return f"{self.title} from {self.full_name} for {self.page.title}" def __repr__(self): - return f'<{self.__class__.__name__}: {self.user}, {self.round}, {self.page}>' + return f"<{self.__class__.__name__}: {self.user}, {self.round}, {self.page}>" @property def ready_for_determination(self): - return self.status in PHASES_MAPPING['ready-for-determination']['statuses'] + return self.status in PHASES_MAPPING["ready-for-determination"]["statuses"] @property def accepted_for_funding(self): - accepted = self.status in PHASES_MAPPING['accepted']['statuses'] + accepted = self.status in PHASES_MAPPING["accepted"]["statuses"] return self.in_final_stage and accepted @property @@ -819,16 +868,16 @@ def in_final_stage(self): @property def in_internal_review_phase(self): - return self.status in PHASES_MAPPING['internal-review']['statuses'] + return self.status in PHASES_MAPPING["internal-review"]["statuses"] @property def in_external_review_phase(self): - return self.status in PHASES_MAPPING['external-review']['statuses'] + return self.status in PHASES_MAPPING["external-review"]["statuses"] @property def is_finished(self): - accepted = self.status in PHASES_MAPPING['accepted']['statuses'] - dismissed = self.status in PHASES_MAPPING['dismissed']['statuses'] + accepted = self.status in PHASES_MAPPING["accepted"]["statuses"] + dismissed = self.status in PHASES_MAPPING["dismissed"]["statuses"] return accepted or dismissed # Methods for accessing data on the submission @@ -836,9 +885,11 @@ def is_finished(self): def get_data(self): # Updated for JSONField - Not used but base get_data will error form_data = self.form_data.copy() - form_data.update({ - 'submit_time': self.submit_time, - }) + form_data.update( + { + "submit_time": self.submit_time, + } + ) return form_data @@ -867,20 +918,26 @@ def can_not_edit_default(self): @property def joined_screening_statuses(self): - return ', '.join([s.title for s in self.screening_statuses.all()]) + return ", ".join([s.title for s in self.screening_statuses.all()]) @property def yes_screening_statuses(self): - ScreeningStatus = apps.get_model('funds', 'ScreeningStatus') + ScreeningStatus = apps.get_model("funds", "ScreeningStatus") return json.dumps( - {status.title: status.id for status in ScreeningStatus.objects.filter(yes=True)} + { + status.title: status.id + for status in ScreeningStatus.objects.filter(yes=True) + } ) @property def no_screening_statuses(self): - ScreeningStatus = apps.get_model('funds', 'ScreeningStatus') + ScreeningStatus = apps.get_model("funds", "ScreeningStatus") return json.dumps( - {status.title: status.id for status in ScreeningStatus.objects.filter(yes=False)} + { + status.title: status.id + for status in ScreeningStatus.objects.filter(yes=False) + } ) @property @@ -892,15 +949,15 @@ def supports_default_screening(self): @receiver(post_transition, sender=ApplicationSubmission) def log_status_update(sender, **kwargs): - instance = kwargs['instance'] - old_phase = instance.workflow[kwargs['source']] + instance = kwargs["instance"] + old_phase = instance.workflow[kwargs["source"]] - by = kwargs['method_kwargs']['by'] - request = kwargs['method_kwargs']['request'] - notify = kwargs['method_kwargs'].get('notify', True) + by = kwargs["method_kwargs"]["by"] + request = kwargs["method_kwargs"]["request"] + notify = kwargs["method_kwargs"].get("notify", True) if request and notify: - if kwargs['source'] == DRAFT_STATE: + if kwargs["source"] == DRAFT_STATE: messenger( MESSAGES.NEW_SUBMISSION, request=request, diff --git a/hypha/apply/funds/models/utils.py b/hypha/apply/funds/models/utils.py index 62c441c84f..f7267b5c24 100644 --- a/hypha/apply/funds/models/utils.py +++ b/hypha/apply/funds/models/utils.py @@ -27,30 +27,36 @@ REVIEWER_GROUP_NAME, COMMUNITY_REVIEWER_GROUP_NAME, ] -LIMIT_TO_STAFF = {'groups__name': STAFF_GROUP_NAME, 'is_active': True} -LIMIT_TO_REVIEWERS = {'groups__name': REVIEWER_GROUP_NAME, 'is_active': True} -LIMIT_TO_PARTNERS = {'groups__name': PARTNER_GROUP_NAME, 'is_active': True} -LIMIT_TO_COMMUNITY_REVIEWERS = {'groups__name': COMMUNITY_REVIEWER_GROUP_NAME, 'is_active': True} -LIMIT_TO_REVIEWER_GROUPS = {'groups__name__in': REVIEW_GROUPS, 'is_active': True} +LIMIT_TO_STAFF = {"groups__name": STAFF_GROUP_NAME, "is_active": True} +LIMIT_TO_REVIEWERS = {"groups__name": REVIEWER_GROUP_NAME, "is_active": True} +LIMIT_TO_PARTNERS = {"groups__name": PARTNER_GROUP_NAME, "is_active": True} +LIMIT_TO_COMMUNITY_REVIEWERS = { + "groups__name": COMMUNITY_REVIEWER_GROUP_NAME, + "is_active": True, +} +LIMIT_TO_REVIEWER_GROUPS = {"groups__name__in": REVIEW_GROUPS, "is_active": True} def admin_url(page): - return reverse('wagtailadmin_pages:edit', args=(page.id,)) + return reverse("wagtailadmin_pages:edit", args=(page.id,)) class WorkflowHelpers(models.Model): """ Defines the common methods and fields for working with Workflows within Django models """ + class Meta: abstract = True - WORKFLOW_CHOICES = { - name: workflow.name - for name, workflow in WORKFLOWS.items() - } + WORKFLOW_CHOICES = {name: workflow.name for name, workflow in WORKFLOWS.items()} - workflow_name = models.CharField(choices=WORKFLOW_CHOICES.items(), max_length=100, default='single', verbose_name=_('Workflow')) + workflow_name = models.CharField( + choices=WORKFLOW_CHOICES.items(), + max_length=100, + default="single", + verbose_name=_("Workflow"), + ) @property def workflow(self): @@ -61,6 +67,7 @@ class SubmittableStreamForm(AbstractStreamForm): """ Controls how stream forms are submitted. Any Page allowing submissions should inherit from here. """ + class Meta: abstract = True @@ -92,6 +99,7 @@ class WorkflowStreamForm(WorkflowHelpers, AbstractStreamForm): # type: ignore """ Defines the common methods and fields for working with Workflows within Wagtail pages """ + wagtail_reference_index_ignore = True class Meta: @@ -125,17 +133,18 @@ def render_landing_page(self, request, form_submission=None, *args, **kwargs): return super().render_landing_page(request, form_submission, *args, **kwargs) content_panels = AbstractStreamForm.content_panels + [ - FieldPanel('workflow_name'), - InlinePanel('forms', label=_('Application forms')), - InlinePanel('review_forms', label=_('Internal Review Forms')), + FieldPanel("workflow_name"), + InlinePanel("forms", label=_("Application forms")), + InlinePanel("review_forms", label=_("Internal Review Forms")), InlinePanel( - 'external_review_forms', - label=_('External Review Forms'), max_num=1, - help_text='Add a form to be used by external reviewers.' + "external_review_forms", + label=_("External Review Forms"), + max_num=1, + help_text="Add a form to be used by external reviewers.", ), - InlinePanel('determination_forms', label=_('Determination Forms')), - InlinePanel('approval_forms', label=_('Project Approval Form'), max_num=1), - InlinePanel('sow_forms', label=_('Project SOW Form'), max_num=1) + InlinePanel("determination_forms", label=_("Determination Forms")), + InlinePanel("approval_forms", label=_("Project Approval Form"), max_num=1), + InlinePanel("sow_forms", label=_("Project SOW Form"), max_num=1), ] @@ -145,10 +154,14 @@ class EmailForm(AbstractEmailForm): Email Confirmation Panel should be included to allow admins to make changes. """ + class Meta: abstract = True - confirmation_text_extra = models.TextField(blank=True, help_text=_('Additional text for the application confirmation message.')) + confirmation_text_extra = models.TextField( + blank=True, + help_text=_("Additional text for the application confirmation message."), + ) def send_mail(self, submission): # Make sure we don't send emails to users here. Messaging handles that @@ -157,15 +170,17 @@ def send_mail(self, submission): email_confirmation_panels = [ MultiFieldPanel( [ - FieldRowPanel([ - FieldPanel('from_address', classname="col6"), - FieldPanel('to_address', classname="col6"), - ]), - FieldPanel('subject'), - FieldPanel('confirmation_text_extra'), + FieldRowPanel( + [ + FieldPanel("from_address", classname="col6"), + FieldPanel("to_address", classname="col6"), + ] + ), + FieldPanel("subject"), + FieldPanel("confirmation_text_extra"), ], - heading=_('Confirmation email'), + heading=_("Confirmation email"), ) ] - email_tab = ObjectList(email_confirmation_panels, heading=_('Confirmation email')) + email_tab = ObjectList(email_confirmation_panels, heading=_("Confirmation email")) diff --git a/hypha/apply/funds/permissions.py b/hypha/apply/funds/permissions.py index 8c1c8b57bb..85bf6c9bec 100644 --- a/hypha/apply/funds/permissions.py +++ b/hypha/apply/funds/permissions.py @@ -19,7 +19,7 @@ def can_edit_submission(user, submission): if submission.is_archive: return False, "Archived Submission" - return True, '' + return True, "" def can_bulk_delete_submissions(user) -> bool: @@ -83,18 +83,18 @@ def is_user_has_access_to_view_submission(user, submission): return False, "Archived Submission" if user.is_apply_staff or submission.user == user or user.is_reviewer: - return True, '' + return True, "" if user.is_partner and submission.partners.filter(pk=user.pk).exists(): - return True, '' + return True, "" if user.is_community_reviewer and submission.community_review: - return True, '' + return True, "" - return False, '' + return False, "" permissions_map = { - 'submission_view': is_user_has_access_to_view_submission, - 'submission_edit': can_edit_submission, + "submission_view": is_user_has_access_to_view_submission, + "submission_edit": can_edit_submission, } diff --git a/hypha/apply/funds/reviewers/services.py b/hypha/apply/funds/reviewers/services.py index eff2be17c7..84ff8e0ea7 100644 --- a/hypha/apply/funds/reviewers/services.py +++ b/hypha/apply/funds/reviewers/services.py @@ -8,12 +8,10 @@ def get_all_reviewers(*args, **kwargs) -> QuerySet: - """All assigned reviewers, staff or admin. - """ + """All assigned reviewers, staff or admin.""" q_obj = ( - Q(submissions_reviewer__isnull=False) | - Q(groups__name=STAFF_GROUP_NAME) | - Q(is_superuser=True) + Q(submissions_reviewer__isnull=False) + | Q(groups__name=STAFF_GROUP_NAME) + | Q(is_superuser=True) ) return User.objects.filter(q_obj).distinct() - diff --git a/hypha/apply/funds/services.py b/hypha/apply/funds/services.py index 87c1bfb032..8d372e28b2 100644 --- a/hypha/apply/funds/services.py +++ b/hypha/apply/funds/services.py @@ -59,8 +59,10 @@ def bulk_delete_submissions( QuerySet of submissions that have been archived """ # delete NEW_SUBMISSION events for all submissions - submission_ids = submissions.values_list('id', flat=True) - Event.objects.filter(type=MESSAGES.NEW_SUBMISSION, object_id__in=submission_ids).delete() + submission_ids = submissions.values_list("id", flat=True) + Event.objects.filter( + type=MESSAGES.NEW_SUBMISSION, object_id__in=submission_ids + ).delete() # delete submissions submissions.delete() messenger( @@ -145,14 +147,14 @@ def bulk_update_reviewers( def annotate_comments_count(submissions: QuerySet, user) -> QuerySet: - comments = Activity.comments.filter(submission=OuterRef('id')).visible_to(user) + comments = Activity.comments.filter(submission=OuterRef("id")).visible_to(user) return submissions.annotate( comment_count=Coalesce( Subquery( - comments.values('submission') + comments.values("submission") .order_by() - .annotate(count=Count('pk')) - .values('count'), + .annotate(count=Count("pk")) + .values("count"), output_field=IntegerField(), ), 0, @@ -171,9 +173,9 @@ def set_status_after_reviewers_assigned(submission, updated_by, request) -> None if submission.status == INITIAL_STATE: # Automatically transition the application to "Internal review". action = submission.workflow.stepped_phases[2][0].name - elif submission.status == 'proposal_discussion': + elif submission.status == "proposal_discussion": # Automatically transition the proposal to "Internal review". - action = 'proposal_internal_review' + action = "proposal_internal_review" # If action is set run perform_transition(). if action: @@ -189,72 +191,72 @@ def set_status_after_reviewers_assigned(submission, updated_by, request) -> None def annotate_review_recommendation_and_count(submissions: QuerySet) -> QuerySet: - Review = apps.get_model('review', 'Review') - ReviewOpinion = apps.get_model('review', 'ReviewOpinion') + Review = apps.get_model("review", "Review") + ReviewOpinion = apps.get_model("review", "ReviewOpinion") AssignedReviewers = apps.get_model("funds", "AssignedReviewers") - reviews = Review.objects.filter(submission=OuterRef('id')) - opinions = ReviewOpinion.objects.filter(review__submission=OuterRef('id')) - reviewers = AssignedReviewers.objects.filter(submission=OuterRef('id')) + reviews = Review.objects.filter(submission=OuterRef("id")) + opinions = ReviewOpinion.objects.filter(review__submission=OuterRef("id")) + reviewers = AssignedReviewers.objects.filter(submission=OuterRef("id")) submissions = submissions.annotate( review_count=Subquery( - reviewers.values('submission').annotate(count=Count('pk')).values('count'), + reviewers.values("submission").annotate(count=Count("pk")).values("count"), output_field=IntegerField(), ), review_staff_count=Subquery( reviewers.staff() - .values('submission') - .annotate(count=Count('pk')) - .values('count'), + .values("submission") + .annotate(count=Count("pk")) + .values("count"), output_field=IntegerField(), ), review_submitted_count=Subquery( reviewers.reviewed() - .values('submission') - .annotate(count=Count('pk', distinct=True)) - .values('count'), + .values("submission") + .annotate(count=Count("pk", distinct=True)) + .values("count"), output_field=IntegerField(), ), opinion_disagree=Subquery( opinions.filter(opinion=DISAGREE) - .values('review__submission') - .annotate(count=Count('*')) - .values('count')[:1], + .values("review__submission") + .annotate(count=Count("*")) + .values("count")[:1], output_field=IntegerField(), ), review_recommendation=Case( When(opinion_disagree__gt=0, then=MAYBE), default=Subquery( reviews.submitted() - .values('submission') + .values("submission") .annotate( - calc_recommendation=Sum('recommendation') / Count('recommendation'), + calc_recommendation=Sum("recommendation") / Count("recommendation"), ) - .values('calc_recommendation'), + .values("calc_recommendation"), output_field=IntegerField(), ), ), ).prefetch_related( Prefetch( - 'assigned', + "assigned", queryset=AssignedReviewers.objects.reviewed() .review_order() .select_related( - 'reviewer', + "reviewer", ) .prefetch_related( Prefetch( - 'review__opinions', - queryset=ReviewOpinion.objects.select_related('author'), + "review__opinions", + queryset=ReviewOpinion.objects.select_related("author"), ), ), - to_attr='has_reviewed', + to_attr="has_reviewed", ), Prefetch( - 'assigned', + "assigned", queryset=AssignedReviewers.objects.not_reviewed().staff(), - to_attr='hasnt_reviewed', + to_attr="hasnt_reviewed", ), ) return submissions diff --git a/hypha/apply/funds/tables.py b/hypha/apply/funds/tables.py index 51f1c795e6..cf45b75271 100644 --- a/hypha/apply/funds/tables.py +++ b/hypha/apply/funds/tables.py @@ -30,25 +30,20 @@ def review_filter_for_user(user): review_states = set(get_review_active_statuses(user)) - statuses = [ - name - for name, status in STATUSES.items() - if review_states & status - ] - return [ - slugify(status) - for status in statuses - ] + statuses = [name for name, status in STATUSES.items() if review_states & status] + return [slugify(status) for status in statuses] def make_row_class(record): - css_class = 'submission-meta__row' if record.next else 'all-submissions-table__parent' - css_class += '' if record.active else ' is-inactive' + css_class = ( + "submission-meta__row" if record.next else "all-submissions-table__parent" + ) + css_class += "" if record.active else " is-inactive" return css_class def render_actions(table, record): - user = table.context['user'] + user = table.context["user"] actions = record.get_actions_for_user(user) return json.dumps([slugify(action) for _, action in actions]) @@ -69,59 +64,76 @@ class SubmissionsTable(tables.Table): """Base table for listing submissions, do not include admin data to this table""" title = tables.LinkColumn( - 'funds:submissions:detail', + "funds:submissions:detail", text=render_title, - args=[A('pk')], + args=[A("pk")], orderable=True, attrs={ - 'td': { - 'class': 'js-title', + "td": { + "class": "js-title", }, - 'a': { - 'data-tippy-content': lambda record: record.title, - 'data-tippy-placement': 'top', - + "a": { + "data-tippy-content": lambda record: record.title, + "data-tippy-placement": "top", # Use after:content-[''] after:block to hide the default browser tooltip on Safari # https://stackoverflow.com/a/43915246 - 'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block", - } + "class": "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block", + }, }, ) - submit_time = tables.DateColumn(verbose_name=_('Submitted')) - phase = tables.Column(verbose_name=_('Status'), order_by=('status',), attrs={'td': {'data-actions': render_actions, 'class': 'js-actions'}}) - stage = tables.Column(verbose_name=_('Type'), order_by=('status',)) - fund = tables.Column(verbose_name=_('Fund'), accessor='page') - comments = tables.Column(accessor='comment_count', verbose_name=_('Comments')) - last_update = tables.DateColumn(accessor="last_update", verbose_name=_('Last updated')) + submit_time = tables.DateColumn(verbose_name=_("Submitted")) + phase = tables.Column( + verbose_name=_("Status"), + order_by=("status",), + attrs={"td": {"data-actions": render_actions, "class": "js-actions"}}, + ) + stage = tables.Column(verbose_name=_("Type"), order_by=("status",)) + fund = tables.Column(verbose_name=_("Fund"), accessor="page") + comments = tables.Column(accessor="comment_count", verbose_name=_("Comments")) + last_update = tables.DateColumn( + accessor="last_update", verbose_name=_("Last updated") + ) class Meta: model = ApplicationSubmission - order_by = ('-last_update',) - fields = ('title', 'phase', 'stage', 'fund', 'round', 'submit_time', 'last_update') - sequence = fields + ('comments',) - template_name = 'funds/tables/table.html' + order_by = ("-last_update",) + fields = ( + "title", + "phase", + "stage", + "fund", + "round", + "submit_time", + "last_update", + ) + sequence = fields + ("comments",) + template_name = "funds/tables/table.html" row_attrs = { - 'class': make_row_class, - 'data-record-id': lambda record: record.id, - 'data-archived': lambda record: record.is_archive + "class": make_row_class, + "data-record-id": lambda record: record.id, + "data-archived": lambda record: record.is_archive, } - attrs = {'class': 'all-submissions-table'} - empty_text = _('No submissions available') + attrs = {"class": "all-submissions-table"} + empty_text = _("No submissions available") def render_user(self, value): return value.get_full_name() def render_phase(self, value): - return format_html('{}', value) + return format_html("{}", value) def order_last_update(self, qs, desc): - update_order = getattr(F('last_update'), 'desc' if desc else 'asc')(nulls_last=True) + update_order = getattr(F("last_update"), "desc" if desc else "asc")( + nulls_last=True + ) - qs = qs.order_by(update_order, 'submit_time') + qs = qs.order_by(update_order, "submit_time") return qs, True def get_column_class_names(self, classes_set, bound_column): - classes_set = super(SubmissionsTable, self).get_column_class_names(classes_set, bound_column) + classes_set = super(SubmissionsTable, self).get_column_class_names( + classes_set, bound_column + ) classes_set.add(bound_column.name) return classes_set @@ -142,7 +154,7 @@ def wrap_with_label(self, checkbox, for_value): @property def header(self): checkbox = super().header - return self.wrap_with_label(checkbox, 'selectall') + return self.wrap_with_label(checkbox, "selectall") def render(self, value, record, bound_column): checkbox = super().render(value=value, record=record, bound_column=bound_column) @@ -150,33 +162,48 @@ def render(self, value, record, bound_column): class BaseAdminSubmissionsTable(SubmissionsTable): - lead = tables.Column(order_by=('lead__full_name',)) - reviews_stats = tables.TemplateColumn(template_name='funds/tables/column_reviews.html', verbose_name=mark_safe("Reviews
Comp. / Assgn.
"), orderable=False) - screening_status = tables.Column(verbose_name=_('Screening'), accessor='screening_statuses') + lead = tables.Column(order_by=("lead__full_name",)) + reviews_stats = tables.TemplateColumn( + template_name="funds/tables/column_reviews.html", + verbose_name=mark_safe( + 'Reviews
Comp. / Assgn.
' + ), + orderable=False, + ) + screening_status = tables.Column( + verbose_name=_("Screening"), accessor="screening_statuses" + ) organization_name = tables.Column() class Meta(SubmissionsTable.Meta): - fields = ('title', 'phase', 'stage', 'fund', 'round', 'lead', 'submit_time', 'last_update', 'screening_status', 'reviews_stats', 'organization_name') # type: ignore - sequence = fields + ('comments',) + fields = ("title", "phase", "stage", "fund", "round", "lead", "submit_time", "last_update", "screening_status", "reviews_stats", "organization_name") # type: ignore + sequence = fields + ("comments",) def render_lead(self, value): - return format_html('{}', value) + return format_html("{}", value) def render_screening_status(self, value): try: status = value.get(default=True).title except ScreeningStatus.DoesNotExist: - return format_html('{}', 'Awaiting') + return format_html("{}", "Awaiting") else: - return format_html('{}', status) + return format_html("{}", status) class AdminSubmissionsTable(BaseAdminSubmissionsTable): """Adds admin only columns to the submissions table""" - selected = LabeledCheckboxColumn(accessor=A('pk'), attrs={'input': {'class': 'js-batch-select'}, 'th__input': {'class': 'js-batch-select-all'}}) + + selected = LabeledCheckboxColumn( + accessor=A("pk"), + attrs={ + "input": {"class": "js-batch-select"}, + "th__input": {"class": "js-batch-select-all"}, + }, + ) class Meta(BaseAdminSubmissionsTable.Meta): - fields = ('selected', *BaseAdminSubmissionsTable.Meta.fields) + fields = ("selected", *BaseAdminSubmissionsTable.Meta.fields) sequence = fields @@ -186,21 +213,22 @@ class Meta(BaseAdminSubmissionsTable.Meta): class SummarySubmissionsTableWithRole(BaseAdminSubmissionsTable): - """ Adds Role Assigned to the 'Waiting for My Review' table """ - role_icon = tables.Column(verbose_name=_('Role')) + """Adds Role Assigned to the 'Waiting for My Review' table""" + + role_icon = tables.Column(verbose_name=_("Role")) class Meta(BaseAdminSubmissionsTable.Meta): - sequence = BaseAdminSubmissionsTable.Meta.fields + ('role_icon', 'comments') + sequence = BaseAdminSubmissionsTable.Meta.fields + ("role_icon", "comments") orderable = False def render_role_icon(self, value): if value: image = CustomImage.objects.filter(id=value).first() if image: - filter_spec = 'fill-20x20' + filter_spec = "fill-20x20" return generate_image_tag(image, filter_spec) - return '' + return "" def get_used_rounds(request): @@ -208,7 +236,7 @@ def get_used_rounds(request): def get_used_rounds_from_dataset(dataset): - return Round.objects.filter(id__in=dataset.values('round')).distinct() + return Round.objects.filter(id__in=dataset.values("round")).distinct() def get_used_funds(request): @@ -217,7 +245,7 @@ def get_used_funds(request): def get_used_funds_from_dataset(dataset): - return Page.objects.filter(id__in=dataset.values('page')).distinct() + return Page.objects.filter(id__in=dataset.values("page")).distinct() def get_round_leads(request): @@ -225,49 +253,61 @@ def get_round_leads(request): def get_round_leads_from_dataset(dataset): - return User.objects.filter(id__in=dataset.values('lead')).distinct() + return User.objects.filter(id__in=dataset.values("lead")).distinct() def get_reviewers_from_dataset(dataset): - """ All assigned reviewers, not including Staff and Admin because we want a list of reviewers only""" - return User.objects.filter(id__in=dataset.values('reviewers')).distinct() + """All assigned reviewers, not including Staff and Admin because we want a list of reviewers only""" + return User.objects.filter(id__in=dataset.values("reviewers")).distinct() def get_screening_statuses(request): return ScreeningStatus.objects.filter( - id__in=ApplicationSubmission.objects.all().values('screening_statuses__id').distinct('screening_statuses__id')) + id__in=ApplicationSubmission.objects.all() + .values("screening_statuses__id") + .distinct("screening_statuses__id") + ) def get_screening_statuses_from_dataset(dataset): return ScreeningStatus.objects.filter( - id__in=dataset.values('screening_statuses__id') + id__in=dataset.values("screening_statuses__id") ).distinct() def get_meta_terms(request): return MetaTerm.objects.filter( filter_on_dashboard=True, - id__in=ApplicationSubmission.objects.all().values('meta_terms__id').distinct('meta_terms__id')) + id__in=ApplicationSubmission.objects.all() + .values("meta_terms__id") + .distinct("meta_terms__id"), + ) def get_meta_terms_from_dataset(dataset): return MetaTerm.objects.filter( - filter_on_dashboard=True, - id__in=dataset.values('meta_terms__id')).distinct() + filter_on_dashboard=True, id__in=dataset.values("meta_terms__id") + ).distinct() class Select2CheckboxWidgetMixin(filters.Filter): def __init__(self, *args, **kwargs): - label = kwargs.get('label') - kwargs.setdefault('widget', Select2MultiCheckboxesWidget(attrs={'data-placeholder': label})) + label = kwargs.get("label") + kwargs.setdefault( + "widget", Select2MultiCheckboxesWidget(attrs={"data-placeholder": label}) + ) super().__init__(*args, **kwargs) -class Select2MultipleChoiceFilter(Select2CheckboxWidgetMixin, filters.MultipleChoiceFilter): +class Select2MultipleChoiceFilter( + Select2CheckboxWidgetMixin, filters.MultipleChoiceFilter +): pass -class Select2ModelMultipleChoiceFilter(Select2MultipleChoiceFilter, filters.ModelMultipleChoiceFilter): +class Select2ModelMultipleChoiceFilter( + Select2MultipleChoiceFilter, filters.ModelMultipleChoiceFilter +): pass @@ -279,14 +319,13 @@ def __init__(self, limit_to, *args, **kwargs): if not limit_to or self.has_any(statuses, limit_to) ] self.status_map = { - slugify(name): list(status) - for name, status in STATUSES.items() + slugify(name): list(status) for name, status in STATUSES.items() } super().__init__( *args, - field_name='status', + field_name="status", choices=choices, - label=_('Statuses'), + label=_("Statuses"), **kwargs, ) @@ -294,51 +333,66 @@ def has_any(self, first, second): return any(item in second for item in first) def get_filter_predicate(self, v): - return {f'{ self.field_name }__in': self.status_map.get(v, [])} + return {f"{ self.field_name }__in": self.status_map.get(v, [])} class SubmissionFilter(filters.FilterSet): - fund = Select2ModelMultipleChoiceFilter(field_name='page', queryset=get_used_funds, label=_('Funds')) - round = Select2ModelMultipleChoiceFilter(queryset=get_used_rounds, label=_('Rounds')) - lead = Select2ModelMultipleChoiceFilter(queryset=get_round_leads, label=_('Leads')) - screening_statuses = Select2ModelMultipleChoiceFilter(queryset=get_screening_statuses, label=_('Screening'), null_label=_('No Status')) - reviewers = Select2ModelMultipleChoiceFilter(queryset=get_all_reviewers, label=_('Reviewers')) + fund = Select2ModelMultipleChoiceFilter( + field_name="page", queryset=get_used_funds, label=_("Funds") + ) + round = Select2ModelMultipleChoiceFilter( + queryset=get_used_rounds, label=_("Rounds") + ) + lead = Select2ModelMultipleChoiceFilter(queryset=get_round_leads, label=_("Leads")) + screening_statuses = Select2ModelMultipleChoiceFilter( + queryset=get_screening_statuses, label=_("Screening"), null_label=_("No Status") + ) + reviewers = Select2ModelMultipleChoiceFilter( + queryset=get_all_reviewers, label=_("Reviewers") + ) category_options = Select2MultipleChoiceFilter( - choices=[], label=_('Category'), - method='filter_category_options' + choices=[], label=_("Category"), method="filter_category_options" + ) + meta_terms = Select2ModelMultipleChoiceFilter( + queryset=get_meta_terms, label=_("Terms") ) - meta_terms = Select2ModelMultipleChoiceFilter(queryset=get_meta_terms, label=_('Terms')) class Meta: model = ApplicationSubmission - fields = ('status', 'fund', 'round') + fields = ("status", "fund", "round") def __init__(self, *args, exclude=None, limit_statuses=None, **kwargs): if exclude is None: exclude = [] - qs = kwargs.get('queryset') + qs = kwargs.get("queryset") - archived = kwargs.pop('archived') if 'archived' in kwargs.keys() else None + archived = kwargs.pop("archived") if "archived" in kwargs.keys() else None if archived is not None: archived = int(archived) if archived else None super().__init__(*args, **kwargs) - reviewers_qs = get_reviewers_from_dataset(dataset=qs.exclude(reviewers__isnull=True)) + reviewers_qs = get_reviewers_from_dataset( + dataset=qs.exclude(reviewers__isnull=True) + ) if archived is not None and archived == 0: - reviewers_qs = get_reviewers_from_dataset(dataset=qs.filter(is_archive=archived).exclude(reviewers__isnull=True)) + reviewers_qs = get_reviewers_from_dataset( + dataset=qs.filter(is_archive=archived).exclude(reviewers__isnull=True) + ) qs = qs.filter(is_archive=archived) - self.filters['fund'].queryset = get_used_funds_from_dataset(dataset=qs) - self.filters['round'].queryset = get_used_rounds_from_dataset(dataset=qs) - self.filters['lead'].queryset = get_round_leads_from_dataset(dataset=qs) - self.filters['screening_statuses'].queryset = get_screening_statuses_from_dataset(dataset=qs) - self.filters['reviewers'].queryset = reviewers_qs - self.filters['meta_terms'].queryset = get_meta_terms_from_dataset(dataset=qs) - - self.filters['status'] = StatusMultipleChoiceFilter(limit_to=limit_statuses) - self.filters['category_options'].extra['choices'] = [ + self.filters["fund"].queryset = get_used_funds_from_dataset(dataset=qs) + self.filters["round"].queryset = get_used_rounds_from_dataset(dataset=qs) + self.filters["lead"].queryset = get_round_leads_from_dataset(dataset=qs) + self.filters[ + "screening_statuses" + ].queryset = get_screening_statuses_from_dataset(dataset=qs) + self.filters["reviewers"].queryset = reviewers_qs + self.filters["meta_terms"].queryset = get_meta_terms_from_dataset(dataset=qs) + + self.filters["status"] = StatusMultipleChoiceFilter(limit_to=limit_statuses) + self.filters["category_options"].extra["choices"] = [ (option.id, option.value) for option in Option.objects.filter(category__filter_on_dashboard=True) ] @@ -357,12 +411,14 @@ def filter_category_options(self, queryset, name, value): And then use those category fields to filter submissions with their form_data. """ query = Q() - submission_data = queryset.values('form_fields', 'form_data').distinct() + submission_data = queryset.values("form_fields", "form_data").distinct() for submission in submission_data: - for field in submission['form_fields']: + for field in submission["form_fields"]: if isinstance(field.block, CategoryQuestionBlock): try: - category_options = category_ids = submission['form_data'][field.id] + category_options = category_ids = submission["form_data"][ + field.id + ] except KeyError: include_in_filter = False else: @@ -373,15 +429,17 @@ def filter_category_options(self, queryset, name, value): # If yes then those submissions should be filtered in the list if include_in_filter: kwargs = { - '{0}__{1}'.format('form_data', field.id): category_ids + "{0}__{1}".format("form_data", field.id): category_ids } query |= Q(**kwargs) return queryset.filter(query) class SubmissionFilterAndSearch(SubmissionFilter): - query = filters.CharFilter(method='search_data_and_id', widget=forms.HiddenInput) - archived = filters.BooleanFilter(field_name='is_archive', widget=forms.HiddenInput, method='filter_archived') + query = filters.CharFilter(method="search_data_and_id", widget=forms.HiddenInput) + archived = filters.BooleanFilter( + field_name="is_archive", widget=forms.HiddenInput, method="filter_archived" + ) def search_data_and_id(self, queryset, name, value): possible_id = re.search("^#(\\d+)$", value.strip()) @@ -397,12 +455,16 @@ def filter_archived(self, queryset, name, value): class SubmissionDashboardFilter(filters.FilterSet): - round = Select2ModelMultipleChoiceFilter(queryset=get_used_rounds, label=_('Rounds')) - fund = Select2ModelMultipleChoiceFilter(field_name='page', queryset=get_used_funds, label=_('Funds')) + round = Select2ModelMultipleChoiceFilter( + queryset=get_used_rounds, label=_("Rounds") + ) + fund = Select2ModelMultipleChoiceFilter( + field_name="page", queryset=get_used_funds, label=_("Funds") + ) class Meta: model = ApplicationSubmission - fields = ('fund', 'round') + fields = ("fund", "round") def __init__(self, *args, exclude=None, limit_statuses=None, **kwargs): if exclude is None: @@ -417,58 +479,72 @@ def __init__(self, *args, exclude=None, limit_statuses=None, **kwargs): class SubmissionReviewerFilterAndSearch(SubmissionDashboardFilter): - query = filters.CharFilter(field_name='search_data', lookup_expr="icontains", widget=forms.HiddenInput) + query = filters.CharFilter( + field_name="search_data", lookup_expr="icontains", widget=forms.HiddenInput + ) class RoundsTable(tables.Table): - title = tables.LinkColumn('funds:rounds:detail', args=[A('pk')], orderable=True, text=lambda record: record.title) - fund = tables.Column(accessor=A('specific__fund')) + title = tables.LinkColumn( + "funds:rounds:detail", + args=[A("pk")], + orderable=True, + text=lambda record: record.title, + ) + fund = tables.Column(accessor=A("specific__fund")) lead = tables.Column() start_date = tables.Column() end_date = tables.Column() - progress = tables.Column(verbose_name=_('Determined')) + progress = tables.Column(verbose_name=_("Determined")) class Meta: - fields = ('title', 'fund', 'lead', 'start_date', 'end_date', 'progress') - attrs = {'class': 'responsive-table'} + fields = ("title", "fund", "lead", "start_date", "end_date", "progress") + attrs = {"class": "responsive-table"} def render_lead(self, value): - return format_html('{}', value) + return format_html("{}", value) def render_progress(self, record): - return f'{record.progress}%' + return f"{record.progress}%" def _field_order(self, field, desc): - return getattr(F(f'{field}'), 'desc' if desc else 'asc')(nulls_last=True) + return getattr(F(f"{field}"), "desc" if desc else "asc")(nulls_last=True) def order_start_date(self, qs, desc): - return qs.order_by(self._field_order('start_date', desc)), True + return qs.order_by(self._field_order("start_date", desc)), True def order_end_date(self, qs, desc): - return qs.order_by(self._field_order('end_date', desc)), True + return qs.order_by(self._field_order("end_date", desc)), True def order_fund(self, qs, desc): - return qs.order_by(self._field_order('fund', desc)), True + return qs.order_by(self._field_order("fund", desc)), True def order_progress(self, qs, desc): - return qs.order_by(self._field_order('progress', desc)), True + return qs.order_by(self._field_order("progress", desc)), True def get_column_class_names(self, classes_set, bound_column): - classes_set = super(RoundsTable, self).get_column_class_names(classes_set, bound_column) + classes_set = super(RoundsTable, self).get_column_class_names( + classes_set, bound_column + ) classes_set.add(bound_column.name) return classes_set class ActiveRoundFilter(Select2MultipleChoiceFilter): def __init__(self, *args, **kwargs): - super().__init__(self, *args, choices=[('active', 'Active'), ('inactive', 'Inactive')], **kwargs) + super().__init__( + self, + *args, + choices=[("active", "Active"), ("inactive", "Inactive")], + **kwargs, + ) def filter(self, qs, value): if value is None or len(value) != 1: return qs value = value[0] - if value == 'active': + if value == "active": return qs.active() else: return qs.inactive() @@ -476,26 +552,31 @@ def filter(self, qs, value): class OpenRoundFilter(Select2MultipleChoiceFilter): def __init__(self, *args, **kwargs): - super().__init__(self, *args, choices=[('open', 'Open'), ('closed', 'Closed'), ('new', 'Not Started')], **kwargs) + super().__init__( + self, + *args, + choices=[("open", "Open"), ("closed", "Closed"), ("new", "Not Started")], + **kwargs, + ) def filter(self, qs, value): if value is None or len(value) != 1: return qs value = value[0] - if value == 'closed': + if value == "closed": return qs.closed() - if value == 'new': + if value == "new": return qs.new() return qs.open() class RoundsFilter(filters.FilterSet): - fund = Select2ModelMultipleChoiceFilter(queryset=get_used_funds, label=_('Funds')) - lead = Select2ModelMultipleChoiceFilter(queryset=get_round_leads, label=_('Leads')) - active = ActiveRoundFilter(label=_('Active')) - round_state = OpenRoundFilter(label=_('Open')) + fund = Select2ModelMultipleChoiceFilter(queryset=get_used_funds, label=_("Funds")) + lead = Select2ModelMultipleChoiceFilter(queryset=get_round_leads, label=_("Leads")) + active = ActiveRoundFilter(label=_("Active")) + round_state = OpenRoundFilter(label=_("Open")) class ReviewerLeaderboardFilterForm(forms.ModelForm): @@ -508,101 +589,115 @@ class ReviewerLeaderboardFilterForm(forms.ModelForm): with User objects. So this form converts back to a list of User PKs using the clean_reviewer method. """ + class Meta: fields = ["id"] model = User def clean_reviewer(self): - return [u.id for u in self.cleaned_data['reviewer']] + return [u.id for u in self.cleaned_data["reviewer"]] class ReviewerLeaderboardFilter(filters.FilterSet): - query = filters.CharFilter(field_name='full_name', lookup_expr="icontains", widget=forms.HiddenInput) + query = filters.CharFilter( + field_name="full_name", lookup_expr="icontains", widget=forms.HiddenInput + ) reviewer = Select2ModelMultipleChoiceFilter( - field_name='pk', - label=_('Reviewers'), + field_name="pk", + label=_("Reviewers"), queryset=get_all_reviewers, ) funds = Select2ModelMultipleChoiceFilter( - field_name='submission__page', - label=_('Funds'), + field_name="submission__page", + label=_("Funds"), queryset=get_used_funds, ) rounds = Select2ModelMultipleChoiceFilter( - field_name='submission__round', - label=_('Rounds'), + field_name="submission__round", + label=_("Rounds"), queryset=get_used_rounds, ) class Meta: fields = [ - 'reviewer', - 'funds', - 'rounds', + "reviewer", + "funds", + "rounds", ] form = ReviewerLeaderboardFilterForm model = User class ReviewerLeaderboardTable(tables.Table): - full_name = tables.LinkColumn('funds:submissions:reviewer_leaderboard_detail', args=[A('pk')], orderable=True, verbose_name=_('Reviewer'), attrs={'td': {'class': 'title'}}) + full_name = tables.LinkColumn( + "funds:submissions:reviewer_leaderboard_detail", + args=[A("pk")], + orderable=True, + verbose_name=_("Reviewer"), + attrs={"td": {"class": "title"}}, + ) class Meta: model = User fields = [ - 'full_name', - 'ninety_days', - 'this_year', - 'last_year', - 'total', + "full_name", + "ninety_days", + "this_year", + "last_year", + "total", ] - order_by = ('-ninety_days',) - attrs = {'class': 'all-reviews-table'} - empty_text = _('No reviews available') + order_by = ("-ninety_days",) + attrs = {"class": "all-reviews-table"} + empty_text = _("No reviews available") class ReviewerLeaderboardDetailTable(tables.Table): title = tables.LinkColumn( - 'funds:submissions:reviews:review', + "funds:submissions:reviews:review", text=render_title, - args=[A('submission_id'), A('pk')], + args=[A("submission_id"), A("pk")], orderable=True, - verbose_name=_('Submission'), + verbose_name=_("Submission"), attrs={ - 'td': { - 'class': 'js-title', + "td": { + "class": "js-title", }, - 'a': { - 'data-tippy-content': lambda record: record.submission.title, - 'data-tippy-placement': 'top', - + "a": { + "data-tippy-content": lambda record: record.submission.title, + "data-tippy-placement": "top", # Use after:content-[''] after:block to hide the default browser tooltip on Safari # https://stackoverflow.com/a/43915246 - 'class': 'truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block', - } + "class": "truncate inline-block w-[calc(100%-2rem)] after:content-[" + "] after:block", + }, }, ) class Meta: model = Review fields = [ - 'title', - 'recommendation', - 'created_at', + "title", + "recommendation", + "created_at", ] - order_by = ('-created_at',) - attrs = {'class': 'all-reviews-table'} - empty_text = _('No reviews available') + order_by = ("-created_at",) + attrs = {"class": "all-reviews-table"} + empty_text = _("No reviews available") class StaffAssignmentsTable(tables.Table): - full_name = tables.Column(linkify=render_reviewer_link, orderable=True, verbose_name=_('Staff'), attrs={'td': {'class': 'title'}}) + full_name = tables.Column( + linkify=render_reviewer_link, + orderable=True, + verbose_name=_("Staff"), + attrs={"td": {"class": "title"}}, + ) class Meta: model = User fields = [ - 'full_name', + "full_name", ] - attrs = {'class': 'all-reviews-table'} - empty_text = _('No staff available') + attrs = {"class": "all-reviews-table"} + empty_text = _("No staff available") diff --git a/hypha/apply/funds/templates/funds/admin/parent_chooser.html b/hypha/apply/funds/templates/funds/admin/parent_chooser.html index 093a0239eb..61ae59e65a 100644 --- a/hypha/apply/funds/templates/funds/admin/parent_chooser.html +++ b/hypha/apply/funds/templates/funds/admin/parent_chooser.html @@ -2,32 +2,32 @@ {% load i18n %} {% block content %} -
- - {% block header %} - {% include "wagtailadmin/shared/header_with_locale_selector.html" with title=view.get_page_title subtitle=view.get_page_subtitle icon=view.header_icon %} - {% endblock %} + input[type=radio] { + vertical-align: middle; + } + + {% block header %} + {% include "wagtailadmin/shared/header_with_locale_selector.html" with title=view.get_page_title subtitle=view.get_page_subtitle icon=view.header_icon %} + {% endblock %} -
-

{% blocktrans %}Choose a Fund{% endblocktrans %}

-

{% blocktrans %}Rounds must be associated with a Fund or RFP. What are you creating a new Round for?{% endblocktrans %}

+
+

{% blocktrans %}Choose a Fund{% endblocktrans %}

+

{% blocktrans %}Rounds must be associated with a Fund or RFP. What are you creating a new Round for?{% endblocktrans %}

-
- {% csrf_token %} + + {% csrf_token %} -
    - {% include "wagtailadmin/shared/field_as_li.html" with field=form.parent_page %} -
  • - -
  • -
-
+
    + {% include "wagtailadmin/shared/field_as_li.html" with field=form.parent_page %} +
  • + +
  • +
+ +
-
{% endblock %} diff --git a/hypha/apply/funds/templates/funds/application_base_landing.html b/hypha/apply/funds/templates/funds/application_base_landing.html index f5932fa6da..e9ac3fca1b 100644 --- a/hypha/apply/funds/templates/funds/application_base_landing.html +++ b/hypha/apply/funds/templates/funds/application_base_landing.html @@ -18,16 +18,16 @@

{% blocktrans %}Thank you for your submission to the {{ ORG_LONG_NAME }}.{%

{% blocktrans with email=ORG_EMAIL|urlize %}If you do not receive an e-mail within 15 minutes please check your spam folder and contact {{ email }} for further assistance.{% endblocktrans %}

- {% with email_context=page.specific %}

{{ email_context.confirmation_text_extra|urlize }}

{% endwith %} + {% with email_context=page.specific %}

{{ email_context.confirmation_text_extra|urlize }}

{% endwith %} - {% block extra_text %}{{ settings.funds.ApplicationSettings.extra_text_round|richtext }}{% endblock %} + {% block extra_text %}{{ settings.funds.ApplicationSettings.extra_text_round|richtext }}{% endblock %}

- {% if request.user.is_authenticated %} - - {% else %} - - {% endif %} + {% if request.user.is_authenticated %} + + {% else %} + + {% endif %}

diff --git a/hypha/apply/funds/templates/funds/applicationrevision_list.html b/hypha/apply/funds/templates/funds/applicationrevision_list.html index 3ce639ee8a..ca769513de 100644 --- a/hypha/apply/funds/templates/funds/applicationrevision_list.html +++ b/hypha/apply/funds/templates/funds/applicationrevision_list.html @@ -8,22 +8,22 @@ {% slot sub_heading %}{% trans "For" %} {{ submission.title }}{% endslot %} {% endadminbar %} -
-
    - {% for revision in object_list %} -
  • -

    - {{ revision.timestamp|date:"Y-m-d H:i e"}} - {% trans "by" %} {{ revision.author }} - {% if forloop.first %} - - {% trans "current" %} +

    +
      + {% for revision in object_list %} +
    • +

      + {{ revision.timestamp|date:"Y-m-d H:i e"}} + {% trans "by" %} {{ revision.author }} + {% if forloop.first %} + - {% trans "current" %} + {% endif %} +

      + {% if not forloop.first %} + {% trans "Compare" %} {% endif %} -

      - {% if not forloop.first %} - {% trans "Compare" %} - {% endif %} -
    • - {% endfor %} -
    -
    +
  • + {% endfor %} +
+
{% endblock %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html b/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html index 7eb9d3b252..f7c07d93ed 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html @@ -2,8 +2,8 @@ {% load i18n static workflow_tags review_tags determination_tags %} {% block extra_css %} - - {{ reviewer_form.media.css }} + + {{ reviewer_form.media.css }} {% endblock %} {% block mobile_actions %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_confirm_delete.html b/hypha/apply/funds/templates/funds/applicationsubmission_confirm_delete.html index c70f15744d..a8be354ec1 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_confirm_delete.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_confirm_delete.html @@ -4,21 +4,21 @@ {% block title %}{% trans "Deleting" %}: {{object.title }}{% endblock %} {% block content %} -
-
-

{% trans "Deleting" %}: {{ object.title }}

+
+
+

{% trans "Deleting" %}: {{ object.title }}

+
-
-
-
-
- {% csrf_token %} -

{% blocktrans %}Are you sure you want to delete "{{ object }}"?{% endblocktrans %}

-

{% trans "All content related to this submission will also be deleted. This includes reviews, determinations and comments." %}

- -
+
+
+
+ {% csrf_token %} +

{% blocktrans %}Are you sure you want to delete "{{ object }}"?{% endblocktrans %}

+

{% trans "All content related to this submission will also be deleted. This includes reviews, determinations and comments." %}

+ +
+
-
{% endblock %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_detail.html b/hypha/apply/funds/templates/funds/applicationsubmission_detail.html index 3d7407ff7b..1dfba9b0a6 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_detail.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_detail.html @@ -5,196 +5,196 @@ {% block title %}{{ object.title }}{% endblock %} {% block body_class %}{% endblock %} {% block content %} -{% if object.round.specific.is_sealed %} -
    - {% trans "This submission is sealed" as warning_message %} - {% include "includes/message_item.html" with message=warning_message tag="warning" close=False %} - } -
-{% endif %} -
-
- {% if request.GET.ref == 'all-beta' %} - - {% trans "Back to submissions" %} - - {% endif %} -

{{ object.title }}

-
- {{ object.stage }} - {{ object.page }} - {% if request.user.is_apply_staff and object.round %} - {{ object.round }} - {% else %} - {{ object.round }} - {% endif %} - {% if request.user.is_apply_staff %} - {% trans "Lead" %}: {{ object.lead }} - {% else %} - {% trans "Lead" %}: {{ object.lead }} - {% endif %} -
- {% status_bar object.workflow object.phase request.user author=object.user same_stage=True %} - -
-
- - {% trans "Submission details" %} - - - - {% trans "Communications" %} - - - + {% trans "This submission is sealed" as warning_message %} + {% include "includes/message_item.html" with message=warning_message tag="warning" close=False %} + } + + {% endif %} +
+
+ {% if request.GET.ref == 'all-beta' %} + - {% trans "Activity feed" %} - - {% if request.user.is_apply_staff_admin %} - - {% trans "View message log" %} + {% trans "Back to submissions" %} + {% endif %} +

{{ object.title }}

+
+ {{ object.stage }} + {{ object.page }} + {% if request.user.is_apply_staff and object.round %} + {{ object.round }} + {% else %} + {{ object.round }} + {% endif %} + {% if request.user.is_apply_staff %} + {% trans "Lead" %}: {{ object.lead }} + {% else %} + {% trans "Lead" %}: {{ object.lead }} {% endif %}
+ {% status_bar object.workflow object.phase request.user author=object.user same_stage=True %} + +
-
-{% if object.is_archive %} -
- {% heroicon_outline "lock-closed" aria_hidden="true" size=16 stroke_width=2 class="inline align-baseline mr-1" %} - {% trans "This submission has been archived." %} -
-{% endif %} + {% if object.is_archive %} +
+ {% heroicon_outline "lock-closed" aria_hidden="true" size=16 stroke_width=2 class="inline align-baseline mr-1" %} + {% trans "This submission has been archived." %} +
+ {% endif %} -
+
{# Tab 1 #} -
- {% block mobile_actions %} - {% endblock %} -
- {% if request.user|has_edit_perm:object and object.status == 'draft_proposal' and not request.user.is_apply_staff %} -
-

{% trans "Congratulations!" %}

-
{% blocktrans with stage=object.previous.stage %}Your {{ stage }} application has been accepted.{% endblocktrans %}
- {% blocktrans with stage=object.stage %}Start your {{ stage }} application.{% endblocktrans %} -
- {% else %} -
-
- {% trans "Submitted" %} {{ object.submit_time|date:"SHORT_DATETIME_FORMAT" }} {% trans "by" %} {{ object.user.get_full_name }} - {% trans "Updated" %} {{ object.live_revision.timestamp|date:"SHORT_DATETIME_FORMAT" }} {% trans "by" %} {{ object.user.get_full_name }} -
- {% if perms.funds.delete_applicationsubmission %} - - {% trans "Delete" %} - - - {% endif %} - {% if request.user|has_edit_perm:object %} - - {% trans "Edit" %} - - - {% endif %} -
-
- - {% include "funds/includes/rendered_answers.html" %} - -
- {% endif %} +
+ {% block mobile_actions %} + {% endblock %} +
+ {% if request.user|has_edit_perm:object and object.status == 'draft_proposal' and not request.user.is_apply_staff %} +
+

{% trans "Congratulations!" %}

+
{% blocktrans with stage=object.previous.stage %}Your {{ stage }} application has been accepted.{% endblocktrans %}
+ {% blocktrans with stage=object.stage %}Start your {{ stage }} application.{% endblocktrans %} +
+ {% else %} +
+
+ {% trans "Submitted" %} {{ object.submit_time|date:"SHORT_DATETIME_FORMAT" }} {% trans "by" %} {{ object.user.get_full_name }} + {% trans "Updated" %} {{ object.live_revision.timestamp|date:"SHORT_DATETIME_FORMAT" }} {% trans "by" %} {{ object.user.get_full_name }} +
+ {% if perms.funds.delete_applicationsubmission %} + + {% trans "Delete" %} + + + {% endif %} + {% if request.user|has_edit_perm:object %} + + {% trans "Edit" %} + + + {% endif %} +
+
-
{% endif %} - {% block screening_status %} - {% endblock %} + + + {% for submission in other_submissions %} + {% if forloop.first %} +
{% trans "Past Submissions" %}
+ + {% endif %} + {% endfor %} +
+ {% endif %} + {% endblock %} + +
-
{# Tab 2 #} -
-
- {% if not object.is_archive %} - {% include "activity/include/comment_form.html" %} - {% include "activity/include/comment_list.html" with editable=True %} - {% else %} - {% include "activity/include/comment_list.html" with editable=False %} - {% endif %} +
+
+ {% if not object.is_archive %} + {% include "activity/include/comment_form.html" %} + {% include "activity/include/comment_list.html" with editable=True %} + {% else %} + {% include "activity/include/comment_list.html" with editable=False %} + {% endif %} +
-
{# Tab 3 #} -
-
+
+
{% comment %} Loaded using the htmx via alpine's custom event "open-tab-3"{% endcomment %} -

Loading...

+

Loading...

+
-
{% endblock %} {% block extra_js %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_form.html b/hypha/apply/funds/templates/funds/applicationsubmission_form.html index 453263bb01..eea9f19d83 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_form.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_form.html @@ -8,40 +8,40 @@ {% slot header %}{% trans "Editing" %}: {{ object.title }}{% endslot %} {% endadminbar %} -{% include "forms/includes/form_errors.html" with form=form %} - -
-
-
- {% csrf_token %} - {{ form.media }} - - {% for field in form %} - {% if field.field %} - {% if field.field.multi_input_field %} - {% include "forms/includes/multi_input_field.html" %} + {% include "forms/includes/form_errors.html" with form=form %} + +
+
+ + {% csrf_token %} + {{ form.media }} + + {% for field in form %} + {% if field.field %} + {% if field.field.multi_input_field %} + {% include "forms/includes/multi_input_field.html" %} + {% else %} + {% include "forms/includes/field.html" %} + {% endif %} {% else %} - {% include "forms/includes/field.html" %} + {{ field.block }} {% endif %} - {% else %} - {{ field.block }} - {% endif %} - {% endfor %} + {% endfor %} {# Hidden fields needed e.g. for django-file-form. See `StreamBaseForm.hidden_fields` #} - {% for hidden_field in form.hidden_fields %} - {{ hidden_field }} - {% endfor %} - -
- {% trans "Save draft" as save_draft %} - {% for button_name, button_type, button_value in buttons %} - + {% for hidden_field in form.hidden_fields %} + {{ hidden_field }} {% endfor %} -
- + +
+ {% trans "Save draft" as save_draft %} + {% for button_name, button_type, button_value in buttons %} + + {% endfor %} +
+ +
-
{% endblock %} @@ -51,6 +51,6 @@ {% if not show_all_group_fields %} - + {% endif %} {% endblock %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_simplified_detail.html b/hypha/apply/funds/templates/funds/applicationsubmission_simplified_detail.html index 3f11aee241..4ed88529e9 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_simplified_detail.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_simplified_detail.html @@ -26,7 +26,7 @@ {% endslot %} {% trans "Download PDF" %} @@ -44,7 +44,7 @@

{% trans "Proposal Information" %}

{{ object.output_text_answers }}
-
+
{% endblock %} {% block extra_js %} diff --git a/hypha/apply/funds/templates/funds/base_submissions_table.html b/hypha/apply/funds/templates/funds/base_submissions_table.html index 0ac905ba2e..2af95d6018 100644 --- a/hypha/apply/funds/templates/funds/base_submissions_table.html +++ b/hypha/apply/funds/templates/funds/base_submissions_table.html @@ -3,8 +3,8 @@ {% load render_table from django_tables2 %} {% block extra_css %} - -{{ filter.form.media.css }} + + {{ filter.form.media.css }} {% endblock %} {% block content %} diff --git a/hypha/apply/funds/templates/funds/demo_workflow.html b/hypha/apply/funds/templates/funds/demo_workflow.html index 830e4c7baf..84f180a473 100644 --- a/hypha/apply/funds/templates/funds/demo_workflow.html +++ b/hypha/apply/funds/templates/funds/demo_workflow.html @@ -17,41 +17,41 @@

Demo of interacting with the workflow

{{ workflow}}

{{ phase.stage }}

- {% if form %} -
- {% csrf_token %} - {{ form }} - - -
- {% else %} -

{{ ORG_SHORT_NAME }}: {{ phase.name }}

-

Public: {{ phase.public_name }}

-
- {% csrf_token %} - - {% for action in phase.action_names %} - - {% empty %} -

There are no actions

- {% endfor %} -
-
-
-

Logs

-
    - {% for log in logs %} -
  • {{ log }}
  • - {% endfor %} -
-
-
-

Submission

- {% for key, value in data.items %} -

{{ key }}

- {{ value }} - {% endfor %} - {% endif %} + {% if form %} +
+ {% csrf_token %} + {{ form }} + + +
+ {% else %} +

{{ ORG_SHORT_NAME }}: {{ phase.name }}

+

Public: {{ phase.public_name }}

+
+ {% csrf_token %} + + {% for action in phase.action_names %} + + {% empty %} +

There are no actions

+ {% endfor %} +
+
+
+

Logs

+
    + {% for log in logs %} +
  • {{ log }}
  • + {% endfor %} +
+
+
+

Submission

+ {% for key, value in data.items %} +

{{ key }}

+ {{ value }} + {% endfor %} + {% endif %}
Reset diff --git a/hypha/apply/funds/templates/funds/grouped_application_list.html b/hypha/apply/funds/templates/funds/grouped_application_list.html index ff7e3c8f84..2368605b43 100644 --- a/hypha/apply/funds/templates/funds/grouped_application_list.html +++ b/hypha/apply/funds/templates/funds/grouped_application_list.html @@ -2,8 +2,8 @@ {% load i18n static %} {% block extra_css %} - -{{ filter.form.media.css }} + + {{ filter.form.media.css }} {% endblock %} {% block content %} @@ -12,7 +12,7 @@ {% slot header %}{% trans "List of Submissions summary" %}{% endslot %} {% endadminbar %} -
+
{% endblock %} {% block extra_js %} diff --git a/hypha/apply/funds/templates/funds/includes/admin_primary_actions.html b/hypha/apply/funds/templates/funds/includes/admin_primary_actions.html index 92789022ab..117564366f 100644 --- a/hypha/apply/funds/templates/funds/includes/admin_primary_actions.html +++ b/hypha/apply/funds/templates/funds/includes/admin_primary_actions.html @@ -4,9 +4,9 @@
{% trans "Actions to take" %}
{% if object.is_archive %} + data-src="#unarchive-submission" + class="button button--bottom-space button--primary" + href="#"> {% heroicon_outline "lock-open" aria_hidden="true" size=16 stroke_width=2 class="inline align-baseline mr-1" %} {% trans "Unarchive Submission" %} @@ -14,14 +14,14 @@
{% trans "Actions to take" %}
{% else %} {% if PROJECTS_ENABLED %} - {% if object.accepted_for_funding and not object.project %} - - {% trans "Create Project" %} - - {% endif %} + {% if object.accepted_for_funding and not object.project %} + + {% trans "Create Project" %} + + {% endif %} {% endif %} {% if object.has_default_screening_status_set and not object.can_not_edit_default %} @@ -44,9 +44,9 @@
{% trans "Actions to take" %}
{% if object.is_finished %} {% with determination=object.determinations.last %} - {% if determination %} - {% trans "View determination" %} - {% endif %} + {% if determination %} + {% trans "View determination" %} + {% endif %} {% endwith %} {% endif %} diff --git a/hypha/apply/funds/templates/funds/includes/delegated_form_base.html b/hypha/apply/funds/templates/funds/includes/delegated_form_base.html index 84fa9a5e82..fd2127f1e8 100644 --- a/hypha/apply/funds/templates/funds/includes/delegated_form_base.html +++ b/hypha/apply/funds/templates/funds/includes/delegated_form_base.html @@ -5,7 +5,7 @@ id="{% if form_id %}{{ form_id }}{% else %}{{ form.name }}{% endif %}" enctype="multipart/form-data" {% if action %}action="{{ action }}"{% endif %} - > +> {% csrf_token %} {{ form.media }} @@ -22,13 +22,13 @@
{% if cancel %} - + {% endif %} {% trans "Delete" as delete %}
diff --git a/hypha/apply/funds/templates/funds/includes/progress_form.html b/hypha/apply/funds/templates/funds/includes/progress_form.html index d7b5d5ac59..b0e323961b 100644 --- a/hypha/apply/funds/templates/funds/includes/progress_form.html +++ b/hypha/apply/funds/templates/funds/includes/progress_form.html @@ -1,9 +1,9 @@ {% load i18n %} {% if progress_form.should_show %} - + {% endif %} diff --git a/hypha/apply/funds/templates/funds/includes/reminders_block.html b/hypha/apply/funds/templates/funds/includes/reminders_block.html index 0488e1bb3e..839fc886ef 100644 --- a/hypha/apply/funds/templates/funds/includes/reminders_block.html +++ b/hypha/apply/funds/templates/funds/includes/reminders_block.html @@ -7,24 +7,24 @@
{% trans "Reminders" %}
  • {{ action.grouper }}
      {% for reminder in action.list %} -
    • -
      - {% if reminder.title %} - {{ reminder.title }} - {% else %} - {% trans "untitled reminder" %} - {% endif %} -
      - - - -
    • +
    • +
      + {% if reminder.title %} + {{ reminder.title }} + {% else %} + {% trans "untitled reminder" %} + {% endif %} +
      + + + +
    • {% endfor %}

  • {% empty %} -
  • {% trans "No reminders yet." %}
  • - {% endfor %} +
  • {% trans "No reminders yet." %}
  • + {% endfor %}
    diff --git a/hypha/apply/funds/templates/funds/includes/rendered_answers.html b/hypha/apply/funds/templates/funds/includes/rendered_answers.html index cb08862694..f6127bd817 100644 --- a/hypha/apply/funds/templates/funds/includes/rendered_answers.html +++ b/hypha/apply/funds/templates/funds/includes/rendered_answers.html @@ -2,17 +2,17 @@

    {% trans "Proposal Information" %}

    {% if object.get_value_display != "-" %} -
    -
    {% trans "Requested Funding" %}
    - {{ object.get_value_display }} -
    +
    +
    {% trans "Requested Funding" %}
    + {{ object.get_value_display }} +
    {% endif %} {% if object.get_duration_display != "-" %} -
    -
    {% trans "Project Duration" %}
    - {{ object.get_duration_display }} -
    +
    +
    {% trans "Project Duration" %}
    + {{ object.get_duration_display }} +
    {% endif %}
    @@ -25,16 +25,16 @@
    {% trans "E-mail" %}
    {{ object.get_email_display }}
    {% if object.get_address_display != "-" %} -
    -
    {% trans "Address" %}
    - {{ object.get_address_display }} -
    +
    +
    {% trans "Address" %}
    + {{ object.get_address_display }} +
    {% endif %} {% if object.get_organization_name_display != "-" %} -
    -
    {% trans "Organization name" %}
    - {{ object.get_organization_name_display }} -
    +
    +
    {% trans "Organization name" %}
    + {{ object.get_organization_name_display }} +
    {% endif %}
    diff --git a/hypha/apply/funds/templates/funds/includes/review_sidebar.html b/hypha/apply/funds/templates/funds/includes/review_sidebar.html index e584ba00c7..fc81143b3c 100644 --- a/hypha/apply/funds/templates/funds/includes/review_sidebar.html +++ b/hypha/apply/funds/templates/funds/includes/review_sidebar.html @@ -8,7 +8,7 @@ {% trans 'Avg. Score'%}: {{assigned_reviewers|average_review_score|floatformat:'1'}}
    - +
      {% if not staff_reviewers_exist %}
    • {% trans "No staff reviewers yet" %}
    • diff --git a/hypha/apply/funds/templates/funds/includes/review_sidebar_item.html b/hypha/apply/funds/templates/funds/includes/review_sidebar_item.html index 855fe31e4b..984bba7297 100644 --- a/hypha/apply/funds/templates/funds/includes/review_sidebar_item.html +++ b/hypha/apply/funds/templates/funds/includes/review_sidebar_item.html @@ -37,16 +37,16 @@ {% if forloop.first %}
        {% endif %} -
      • -
        - {{ opinion.author }} - {% with role=opinion.author.role %} - {% if role %}{% image role.icon max-12x12 %}{% endif %} - {% endwith %} -
        -
        -
        {{ opinion.get_opinion_display}}
        -
      • +
      • +
        + {{ opinion.author }} + {% with role=opinion.author.role %} + {% if role %}{% image role.icon max-12x12 %}{% endif %} + {% endwith %} +
        +
        +
        {{ opinion.get_opinion_display}}
        +
      • {% if forloop.last %}
      {% endif %} diff --git a/hypha/apply/funds/templates/funds/includes/revision_diff_table.html b/hypha/apply/funds/templates/funds/includes/revision_diff_table.html index 55ecc5325e..6017274d36 100644 --- a/hypha/apply/funds/templates/funds/includes/revision_diff_table.html +++ b/hypha/apply/funds/templates/funds/includes/revision_diff_table.html @@ -1,25 +1,25 @@ {% load i18n %} - - -{% for from_field, to_field in required_fields %} - {% if forloop.first %} - - {% elif forloop.counter == 2 %} - - {% elif forloop.counter == 3 %} - - {% elif forloop.counter == 4 %} - - {% elif forloop.counter == 5 %} - - {% elif forloop.counter == 6 %} - - {% else %} + + + {% for from_field, to_field in required_fields %} + {% if forloop.first %} + + {% elif forloop.counter == 2 %} + + {% elif forloop.counter == 3 %} + + {% elif forloop.counter == 4 %} + + {% elif forloop.counter == 5 %} + + {% elif forloop.counter == 6 %} + + {% else %} + + {% endif %} + {% endfor %} + {% for from_field, to_field in stream_fields %} - {% endif %} -{% endfor %} -{% for from_field, to_field in stream_fields %} - -{% endfor %} + {% endfor %}

      {% trans "Proposal Information" %}

      {% trans "Proposal Information" %}

      {% trans "Submitted" %}
      {{ timestamps.0|date:"DATETIME_FORMAT"}}
      {% trans "Submitted" %}
      {{ timestamps.1|date:"DATETIME_FORMAT"}}

      {% trans "Title" %}

      {{ from_field }}

      {% trans "Title" %}

      {{ to_field }}
      {% trans "Legal Name" %}
      {{ from_field }}
      {% trans "Legal Name" %}
      {{ to_field }}
      {% trans "E-mail" %}
      {{ from_field }}
      {% trans "E-mail" %}
      {{ to_field }}
      {% trans "Requested Funding" %}
      {{ from_field }}
      {% trans "Requested Funding" %}
      {{ to_field }}
      {% trans "Project Duration" %}
      {{ from_field }}
      {% trans "Project Duration" %}
      {{ to_field }}
      {% trans "Address" %}
      {{ from_field }}
      {% trans "Address" %}
      {{ to_field }}

      {% trans "Proposal Information" %}

      {% trans "Proposal Information" %}

      {% trans "Submitted" %}
      {{ timestamps.0|date:"DATETIME_FORMAT"}}
      {% trans "Submitted" %}
      {{ timestamps.1|date:"DATETIME_FORMAT"}}

      {% trans "Title" %}

      {{ from_field }}

      {% trans "Title" %}

      {{ to_field }}
      {% trans "Legal Name" %}
      {{ from_field }}
      {% trans "Legal Name" %}
      {{ to_field }}
      {% trans "E-mail" %}
      {{ from_field }}
      {% trans "E-mail" %}
      {{ to_field }}
      {% trans "Requested Funding" %}
      {{ from_field }}
      {% trans "Requested Funding" %}
      {{ to_field }}
      {% trans "Project Duration" %}
      {{ from_field }}
      {% trans "Project Duration" %}
      {{ to_field }}
      {% trans "Address" %}
      {{ from_field }}
      {% trans "Address" %}
      {{ to_field }}
      {{ from_field }}{{ to_field }}
      {{ from_field }}{{ to_field }}
      {{ from_field }}{{ to_field }}
      diff --git a/hypha/apply/funds/templates/funds/includes/round-block-listing.html b/hypha/apply/funds/templates/funds/includes/round-block-listing.html index 5fbd25c298..e59a459412 100644 --- a/hypha/apply/funds/templates/funds/includes/round-block-listing.html +++ b/hypha/apply/funds/templates/funds/includes/round-block-listing.html @@ -12,14 +12,14 @@ {% else %} {% trans "Open" %} {% endif %} -

      -

      - {% if round.progress is None %} - - - {% else %} - {{ round.progress }}% {% trans 'Determined' %} ({{ round.closed_submissions }}/{{ round.total_submissions }}) - {% endif %} -

      +

      +

      + {% if round.progress is None %} + - + {% else %} + {{ round.progress }}% {% trans 'Determined' %} ({{ round.closed_submissions }}/{{ round.total_submissions }}) + {% endif %} +

      {% trans 'View' %} {% trans 'Export' %} @@ -29,10 +29,10 @@ {% endif %} {% empty %} - {% block empty_round %} -

      - {% trans "There are no" %} {% if round.end_date %} {{ display_text|lower }} {% else %} {{ type|lower }} {% endif %} {% trans "rounds" %} -

      - {% endblock %} + {% block empty_round %} +

      + {% trans "There are no" %} {% if round.end_date %} {{ display_text|lower }} {% else %} {{ type|lower }} {% endif %} {% trans "rounds" %} +

      + {% endblock %} {% endfor %}
    diff --git a/hypha/apply/funds/templates/funds/includes/round-block.html b/hypha/apply/funds/templates/funds/includes/round-block.html index e4b8695683..460c4faf4d 100644 --- a/hypha/apply/funds/templates/funds/includes/round-block.html +++ b/hypha/apply/funds/templates/funds/includes/round-block.html @@ -1,39 +1,39 @@ {% load i18n %}

    {{ title }}

    - -
    + + {# Open rounds/labs tab #} -
    - {% if page_type == 'dashboard' %} - {% include "funds/includes/no_round_block_dashboard.html" with rounds=open_rounds display_text="Open until" query=open_query type="Open" %} - {% else %} - {% include "funds/includes/round-block-listing.html" with rounds=open_rounds display_text="Open until" query=open_query type="Open" %} - {% endif %} -
    +
    + {% if page_type == 'dashboard' %} + {% include "funds/includes/no_round_block_dashboard.html" with rounds=open_rounds display_text="Open until" query=open_query type="Open" %} + {% else %} + {% include "funds/includes/round-block-listing.html" with rounds=open_rounds display_text="Open until" query=open_query type="Open" %} + {% endif %} +
    {# Closed rounds/labs tab #} -
    - {% if page_type == 'dashboard' %} - {% include "funds/includes/no_round_block_dashboard.html" with rounds=closed_rounds display_text="Closed" query=closed_query type="Closed" %} - {% else %} - {% include "funds/includes/round-block-listing.html" with rounds=closed_rounds display_text="Closed" query=closed_query type="Closed" %} - {% endif %} -
    +
    + {% if page_type == 'dashboard' %} + {% include "funds/includes/no_round_block_dashboard.html" with rounds=closed_rounds display_text="Closed" query=closed_query type="Closed" %} + {% else %} + {% include "funds/includes/round-block-listing.html" with rounds=closed_rounds display_text="Closed" query=closed_query type="Closed" %} + {% endif %} +
    diff --git a/hypha/apply/funds/templates/funds/includes/screening_form.html b/hypha/apply/funds/templates/funds/includes/screening_form.html index 405afa466c..1d4248b526 100644 --- a/hypha/apply/funds/templates/funds/includes/screening_form.html +++ b/hypha/apply/funds/templates/funds/includes/screening_form.html @@ -1,9 +1,9 @@ {% load i18n %} {% if screening_form.should_show %} - + {% endif %} diff --git a/hypha/apply/funds/templates/funds/includes/screening_status_block.html b/hypha/apply/funds/templates/funds/includes/screening_status_block.html index 671723c560..0a2dfaebdc 100644 --- a/hypha/apply/funds/templates/funds/includes/screening_status_block.html +++ b/hypha/apply/funds/templates/funds/includes/screening_status_block.html @@ -28,14 +28,14 @@
    {% trans "Screening decision" %}
    {% if object.has_default_screening_status_set %}

    {% if object.screening_statuses.all.count > 1 %} -

    {% endif %} {% if screen_able %} - {% trans "Screening options" %} + {% trans "Screening options" %} {% endif %}

    {% endif %} @@ -43,7 +43,7 @@
    {% trans "Screening decision" %}

    diff --git a/hypha/apply/funds/templates/funds/includes/status_bar_item.html b/hypha/apply/funds/templates/funds/includes/status_bar_item.html index 051d097a31..0925a32198 100644 --- a/hypha/apply/funds/templates/funds/includes/status_bar_item.html +++ b/hypha/apply/funds/templates/funds/includes/status_bar_item.html @@ -1,11 +1,11 @@
    + {% if is_current %} + status-bar__item--is-current + {% elif is_complete %} + status-bar__item--is-complete + {% endif %}"> + data-title="{{ label }}" aria-label="{{ label }}"> diff --git a/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html b/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html index ad72271e58..f561b17a74 100644 --- a/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html +++ b/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html @@ -12,8 +12,8 @@

    {% if show_try_new_submissions_link %} ({% heroicon_outline "rocket-launch" aria_hidden="true" size=15 stroke_width="2" class="inline align-text-bottom" %} {% trans "Try newer version" %}) @@ -76,16 +76,16 @@

    {% if use_search|default:False %} - + {% endif %}

    diff --git a/hypha/apply/funds/templates/funds/reminder_confirm_delete.html b/hypha/apply/funds/templates/funds/reminder_confirm_delete.html index 88334d3945..777fc55808 100644 --- a/hypha/apply/funds/templates/funds/reminder_confirm_delete.html +++ b/hypha/apply/funds/templates/funds/reminder_confirm_delete.html @@ -14,9 +14,9 @@
    {% csrf_token %}

    Are you sure you want to delete "{{ object }}"?{% endblocktrans %}

    - -
    -
    + + +
    {% endblock %} diff --git a/hypha/apply/funds/templates/funds/reviewer_leaderboard.html b/hypha/apply/funds/templates/funds/reviewer_leaderboard.html index ba2a70f21c..e2caa5e493 100644 --- a/hypha/apply/funds/templates/funds/reviewer_leaderboard.html +++ b/hypha/apply/funds/templates/funds/reviewer_leaderboard.html @@ -13,8 +13,8 @@ {% if request.user.is_apply_staff %}
    {% trans "All" %} @@ -31,12 +31,12 @@ {% endif %} {% endadminbar %} -
    - {% block table %} - {% trans "All reviewers" as all_reviewers %} - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term search_placeholder="reviewers" use_search=True filter_action=filter_action use_batch_actions=False heading=all_reviewers %} +
    + {% block table %} + {% trans "All reviewers" as all_reviewers %} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term search_placeholder="reviewers" use_search=True filter_action=filter_action use_batch_actions=False heading=all_reviewers %} - {% render_table table %} - {% endblock %} -
    + {% render_table table %} + {% endblock %} +
    {% endblock %} diff --git a/hypha/apply/funds/templates/funds/rounds.html b/hypha/apply/funds/templates/funds/rounds.html index 410d9e6507..f3f9f80c54 100644 --- a/hypha/apply/funds/templates/funds/rounds.html +++ b/hypha/apply/funds/templates/funds/rounds.html @@ -5,7 +5,7 @@ {% block title %}{% trans "Rounds" %}{% endblock %} {% block extra_css %} -{{ filter.form.media.css }} + {{ filter.form.media.css }} {% endblock %} @@ -16,15 +16,15 @@ {% slot sub_heading %}{% trans "Explore current and past rounds" %}{% endslot %} {% endadminbar %} -
    - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_batch_actions=False %} - {% render_table table %} -
    +
    + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_batch_actions=False %} + {% render_table table %} +
    {% endblock %} {% block extra_js %} -{{ filter.form.media.js }} - - + {{ filter.form.media.js }} + + {% endblock %} diff --git a/hypha/apply/funds/templates/funds/submission_sealed.html b/hypha/apply/funds/templates/funds/submission_sealed.html index c08b4061b6..4db73b2332 100644 --- a/hypha/apply/funds/templates/funds/submission_sealed.html +++ b/hypha/apply/funds/templates/funds/submission_sealed.html @@ -4,28 +4,28 @@ {% block title %}{% trans "Sealed" %}: {{ object.title }}{% endblock %} {% block content %} -
    -
    -

    {{ object.title }}

    -
    - {{ object.stage }} - {{ object.page }} - {{ object.round }} - {% trans "Lead" %}: {{ object.lead }} -
    - {% status_bar object.workflow object.phase request.user same_stage=True %} +
    +
    +

    {{ object.title }}

    +
    + {{ object.stage }} + {{ object.page }} + {{ object.round }} + {% trans "Lead" %}: {{ object.lead }} +
    + {% status_bar object.workflow object.phase request.user same_stage=True %} +
    +
    +
    +

    {% trans "This application is sealed until the round is closed" %}

    +

    {% trans "The round ends on" %}: {{ object.round.specific.end_date }}

    + {% trans "Go back" %} + {% if can_view_sealed %} +

    {% trans "As an admin you are allowed to access the application. However, this action will be recorded." %}

    +
    + {% csrf_token %} + +
    + {% endif %}
    -
    -
    -

    {% trans "This application is sealed until the round is closed" %}

    -

    {% trans "The round ends on" %}: {{ object.round.specific.end_date }}

    - {% trans "Go back" %} - {% if can_view_sealed %} -

    {% trans "As an admin you are allowed to access the application. However, this action will be recorded." %}

    -
    - {% csrf_token %} - -
    - {% endif %} -
    {% endblock %} diff --git a/hypha/apply/funds/templates/funds/submissions.html b/hypha/apply/funds/templates/funds/submissions.html index 01efc3a9ba..993e0540dd 100644 --- a/hypha/apply/funds/templates/funds/submissions.html +++ b/hypha/apply/funds/templates/funds/submissions.html @@ -10,8 +10,8 @@ {% slot header %} {% trans "All Submissions" %} ({{ table.rows|length }}) {% heroicon_outline "rocket-launch" aria_hidden="true" size=15 stroke_width="2" class="inline align-text-bottom" %} {% trans "Try newer version" %} @@ -20,11 +20,11 @@ {% slot sub_heading %}{% trans "Search and filter all submissions" %}{% endslot %} {% endadminbar %} -
    - {% block table %} - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action use_batch_actions=True filter_classes="filters-open" show_archive=show_archive %} +
    + {% block table %} + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action use_batch_actions=True filter_classes="filters-open" show_archive=show_archive %} - {% render_table table %} - {% endblock %} -
    + {% render_table table %} + {% endblock %} +
    {% endblock %} diff --git a/hypha/apply/funds/templates/funds/submissions_overview.html b/hypha/apply/funds/templates/funds/submissions_overview.html index 755737935a..3fbb1a2cdb 100644 --- a/hypha/apply/funds/templates/funds/submissions_overview.html +++ b/hypha/apply/funds/templates/funds/submissions_overview.html @@ -12,23 +12,23 @@ {% if request.user.is_apply_staff %}
    diff --git a/hypha/apply/funds/templates/funds/submissions_result.html b/hypha/apply/funds/templates/funds/submissions_result.html index ab423a0939..501d5087cf 100644 --- a/hypha/apply/funds/templates/funds/submissions_result.html +++ b/hypha/apply/funds/templates/funds/submissions_result.html @@ -27,21 +27,21 @@ {% endadminbar %} -
    -
    -

    {% trans "Summary" %}

    - {% include "funds/includes/submission_stats.html" %} -
    +
    +
    +

    {% trans "Summary" %}

    + {% include "funds/includes/submission_stats.html" %} +
    -

    {% trans "Filter submissions to calculate values" %}

    - {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action use_batch_actions=False filter_classes="filters-open" %} -
    -
    {% trans "Number of submission" %}: {{ count_values }}{% if not count_values == object_list.count %} ({{ object_list.count }}){% endif %}
    -
    {% trans "Average value" %}: {{ average_value|format_number_as_currency }}
    -
    {% trans "Total value" %}: {{ total_value|format_number_as_currency }}
    +

    {% trans "Filter submissions to calculate values" %}

    + {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action use_batch_actions=False filter_classes="filters-open" %} +
    +
    {% trans "Number of submission" %}: {{ count_values }}{% if not count_values == object_list.count %} ({{ object_list.count }}){% endif %}
    +
    {% trans "Average value" %}: {{ average_value|format_number_as_currency }}
    +
    {% trans "Total value" %}: {{ total_value|format_number_as_currency }}
    +
    + {% if not count_values == object_list.count %} +

    {% trans "Some submissions lack values and are not included." %}

    + {% endif %}
    - {% if not count_values == object_list.count %} -

    {% trans "Some submissions lack values and are not included." %}

    - {% endif %} -
    {% endblock %} diff --git a/hypha/apply/funds/templates/funds/tables/column_reviews.html b/hypha/apply/funds/templates/funds/tables/column_reviews.html index 1b89d74a34..f06b6f9819 100644 --- a/hypha/apply/funds/templates/funds/tables/column_reviews.html +++ b/hypha/apply/funds/templates/funds/tables/column_reviews.html @@ -4,7 +4,7 @@
    - {{ record.review_submitted_count|default:'0' }} + {{ record.review_submitted_count|default:'0' }} / {% if record.stage.has_external_review %} {{ record.review_count|default:'0' }} diff --git a/hypha/apply/funds/templates/funds/tables/table.html b/hypha/apply/funds/templates/funds/tables/table.html index e44777c5c2..4971400454 100644 --- a/hypha/apply/funds/templates/funds/tables/table.html +++ b/hypha/apply/funds/templates/funds/tables/table.html @@ -53,13 +53,13 @@
      {% endif %} -
    • - - {{ opinion.author }} - {% if opinion.author.role %}{% image opinion.author.role.icon max-12x12 %}{% endif %} - - {{ opinion.get_opinion_display }} -
    • +
    • + + {{ opinion.author }} + {% if opinion.author.role %}{% image opinion.author.role.icon max-12x12 %}{% endif %} + + {{ opinion.get_opinion_display }} +
    • {% if forloop.last %}
    @@ -89,14 +89,14 @@ - {% for column in row.table.columns %} - {% if forloop.first %} - {% elif forloop.counter == 2 %} - - {% else %} - - {% endif %} - {% endfor %} + {% for column in row.table.columns %} + {% if forloop.first %} + {% elif forloop.counter == 2 %} + + {% else %} + + {% endif %} + {% endfor %} {# mutate the row to render the data for the child row #} @@ -105,7 +105,7 @@ {% for column, cell in row.items %} {% if column.name != "selected" %} - {% endif %} + {% endif %} {% endfor %} {% endwith %} @@ -117,7 +117,7 @@ {% endblock %} {% block table.tbody.empty_text %} - + {% endblock table.tbody.empty_text %} {% block pagination %} diff --git a/hypha/apply/funds/templates/submissions/all.html b/hypha/apply/funds/templates/submissions/all.html index 42c4527d32..05f144da1a 100644 --- a/hypha/apply/funds/templates/submissions/all.html +++ b/hypha/apply/funds/templates/submissions/all.html @@ -12,7 +12,7 @@ {% trans "All Submissions" %} ({{ page.paginator.count }}) {% trans "View older version" %} @@ -221,43 +221,43 @@
    ' + review_form_cell = ( + f'' + ) self.assertContains(response, review_form_cell, html=True) @@ -140,106 +156,114 @@ class TestCreateApplicationFormView(TestCase): def setUpTestData(cls): cls.user = SuperUserFactory() cls.label_help_text_data = { - 'field_label': factory.Faker('sentence').evaluate(None, None, {'locale': None}), - 'help_text': factory.Faker('sentence').evaluate(None, None, {'locale': None}) + "field_label": factory.Faker("sentence").evaluate( + None, None, {"locale": None} + ), + "help_text": factory.Faker("sentence").evaluate( + None, None, {"locale": None} + ), } - cls.name = factory.Faker('name').evaluate(None, None, {'locale': None}) + cls.name = factory.Faker("name").evaluate(None, None, {"locale": None}) def create_page(self, data): self.client.force_login(self.user) - url = reverse('funds_applicationform_modeladmin_create') + url = reverse("funds_applicationform_modeladmin_create") response = self.client.post(url, data=data, secure=True, follow=True) return response def test_name_field_required(self): - data = {'name': ['']} + data = {"name": [""]} form_field_data = create_form_fields_data( { - 'title': self.label_help_text_data, - 'email': self.label_help_text_data, - 'full_name': self.label_help_text_data, + "title": self.label_help_text_data, + "email": self.label_help_text_data, + "full_name": self.label_help_text_data, } ) data.update(form_field_data) response = self.create_page(data=data) - expected_message = 'This field is required.' - for message in get_messages(response.context['request']): + expected_message = "This field is required." + for message in get_messages(response.context["request"]): self.assertEqual(expected_message, str(message.message).strip()) self.assertEqual(ApplicationForm.objects.count(), 0) def test_title_block_required(self): - data = {'name': [self.name]} + data = {"name": [self.name]} form_field_data = create_form_fields_data( { - 'email': self.label_help_text_data, - 'full_name': self.label_help_text_data, + "email": self.label_help_text_data, + "full_name": self.label_help_text_data, } ) data.update(form_field_data) response = self.create_page(data=data) - expected_message = 'You are missing the following required fields: Title' - for message in get_messages(response.context['request']): + expected_message = "You are missing the following required fields: Title" + for message in get_messages(response.context["request"]): self.assertEqual(expected_message, str(message.message).strip()) self.assertEqual(ApplicationForm.objects.count(), 0) def test_email_block_required(self): - data = {'name': [self.name]} + data = {"name": [self.name]} form_field_data = create_form_fields_data( { - 'title': self.label_help_text_data, - 'full_name': self.label_help_text_data, + "title": self.label_help_text_data, + "full_name": self.label_help_text_data, } ) data.update(form_field_data) response = self.create_page(data=data) - expected_message = 'You are missing the following required fields: Email' - for message in get_messages(response.context['request']): + expected_message = "You are missing the following required fields: Email" + for message in get_messages(response.context["request"]): self.assertEqual(expected_message, str(message.message).strip()) self.assertEqual(ApplicationForm.objects.count(), 0) def test_full_name_block_required(self): - data = {'name': [self.name]} + data = {"name": [self.name]} form_field_data = create_form_fields_data( { - 'title': self.label_help_text_data, - 'email': self.label_help_text_data, + "title": self.label_help_text_data, + "email": self.label_help_text_data, } ) data.update(form_field_data) response = self.create_page(data=data) - expected_message = 'You are missing the following required fields: Full Name' - for message in get_messages(response.context['request']): + expected_message = "You are missing the following required fields: Full Name" + for message in get_messages(response.context["request"]): self.assertEqual(expected_message, str(message.message).strip()) self.assertEqual(ApplicationForm.objects.count(), 0) def test_field_label_required(self): - data = {'name': [self.name]} + data = {"name": [self.name]} form_field_data = create_form_fields_data( { - 'title': {}, - 'email': {}, - 'full_name': {}, + "title": {}, + "email": {}, + "full_name": {}, } ) data.update(form_field_data) response = self.create_page(data=data) - expected_messages_list = ['Label cannot be empty for Application title', 'Label cannot be empty for Email', 'Label cannot be empty for Full name'] - for message in get_messages(response.context['request']): + expected_messages_list = [ + "Label cannot be empty for Application title", + "Label cannot be empty for Email", + "Label cannot be empty for Full name", + ] + for message in get_messages(response.context["request"]): self.assertIn(str(message.message).strip(), expected_messages_list) self.assertEqual(ApplicationForm.objects.count(), 0) def test_form_creation(self): - data = {'name': [self.name]} + data = {"name": [self.name]} form_field_data = create_form_fields_data( { - 'title': self.label_help_text_data, - 'email': self.label_help_text_data, - 'full_name': self.label_help_text_data, + "title": self.label_help_text_data, + "email": self.label_help_text_data, + "full_name": self.label_help_text_data, } ) data.update(form_field_data) diff --git a/hypha/apply/funds/tests/test_forms.py b/hypha/apply/funds/tests/test_forms.py index eb8615f649..389fe9d6dc 100644 --- a/hypha/apply/funds/tests/test_forms.py +++ b/hypha/apply/funds/tests/test_forms.py @@ -47,12 +47,16 @@ def test_queries_roles_swap(self): form = UpdateReviewersForm(user=user, instance=submission) - AssignedWithRoleReviewersFactory(role=roles[0], submission=submission, reviewer=staff[0], staff=True) - AssignedWithRoleReviewersFactory(role=roles[1], submission=submission, reviewer=staff[1], staff=True) + AssignedWithRoleReviewersFactory( + role=roles[0], submission=submission, reviewer=staff[0], staff=True + ) + AssignedWithRoleReviewersFactory( + role=roles[1], submission=submission, reviewer=staff[1], staff=True + ) data = {} for field, user in zip(form.fields, staff, strict=False): - if field.startswith('role'): + if field.startswith("role"): data[field] = user.id else: data[field] = None @@ -84,7 +88,7 @@ def test_queries_reviewers_swap(self): AssignedReviewersFactory(submission=submission, reviewer=reviewers[0]) AssignedReviewersFactory(submission=submission, reviewer=reviewers[1]) - data = {'reviewer_reviewers': [reviewer.id for reviewer in reviewers[2:]]} + data = {"reviewer_reviewers": [reviewer.id for reviewer in reviewers[2:]]} form = UpdateReviewersForm(data, user=user, instance=submission) @@ -109,7 +113,7 @@ def test_queries_existing_reviews(self): ReviewFactory(submission=submission, author__reviewer=reviewers[0]) ReviewFactory(submission=submission, author__reviewer=reviewers[1]) - data = {'reviewer_reviewers': [reviewer.id for reviewer in reviewers[2:]]} + data = {"reviewer_reviewers": [reviewer.id for reviewer in reviewers[2:]]} form = UpdateReviewersForm(data, user=user, instance=submission) diff --git a/hypha/apply/funds/tests/test_models.py b/hypha/apply/funds/tests/test_models.py index e79ce64451..6259dc7afb 100644 --- a/hypha/apply/funds/tests/test_models.py +++ b/hypha/apply/funds/tests/test_models.py @@ -41,14 +41,16 @@ def setUp(self): self.fund = FundTypeFactory(parent=None) def test_can_access_workflow_class(self): - self.assertEqual(self.fund.workflow_name, 'single') + self.assertEqual(self.fund.workflow_name, "single") self.assertEqual(self.fund.workflow, Request) def test_no_open_rounds(self): self.assertIsNone(self.fund.open_round) def test_open_ended_round(self): - open_round = RoundFactory(start_date=date.today(), end_date=None, parent=self.fund) + open_round = RoundFactory( + start_date=date.today(), end_date=None, parent=self.fund + ) self.assertEqual(self.fund.open_round, open_round) def test_normal_round(self): @@ -87,7 +89,7 @@ def setUp(self): self.fund = FundTypeFactory(parent=None) def make_round(self, **kwargs): - data = {'parent': self.fund} + data = {"parent": self.fund} data.update(kwargs) return RoundFactory(**data) @@ -171,7 +173,9 @@ def test_workflow_is_copied_to_new_rounds(self): def test_forms_are_copied_to_new_rounds(self): self.round.save() - for round_form, fund_form in itertools.zip_longest(self.round.forms.all(), self.fund.forms.all()): + for round_form, fund_form in itertools.zip_longest( + self.round.forms.all(), self.fund.forms.all() + ): self.assertEqual(round_form.fields, fund_form.fields) self.assertEqual(round_form.sort_order, fund_form.sort_order) @@ -184,18 +188,20 @@ def test_can_change_round_form_not_fund(self): new_field = CustomFormFieldsFactory.generate(None, {}) form.form_fields = new_field form.save() - for round_form, fund_form in itertools.zip_longest(self.round.forms.all(), self.fund.forms.all()): + for round_form, fund_form in itertools.zip_longest( + self.round.forms.all(), self.fund.forms.all() + ): self.assertNotEqual(round_form, fund_form) -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") @override_settings(FORCE_LOGIN_FOR_APPLICATION=False) class TestFormSubmission(TestCase): def setUp(self): self.User = get_user_model() - self.email = 'test@test.com' - self.name = 'My Name' + self.email = "test@test.com" + self.name = "My Name" fund = FundTypeFactory() @@ -204,7 +210,15 @@ def setUp(self): self.round_page = RoundFactory(parent=fund, now=True) self.lab_page = LabFactory(lead=self.round_page.lead) - def submit_form(self, page=None, email=None, name=None, draft=None, user=None, ignore_errors=False): + def submit_form( + self, + page=None, + email=None, + name=None, + draft=None, + user=None, + ignore_errors=False, + ): user = user or AnonymousUser() page = page or self.round_page @@ -218,9 +232,9 @@ def submit_form(self, page=None, email=None, name=None, draft=None, user=None, i if isinstance(field.block, FullNameBlock): data[field.id] = self.name if name is None else name if draft: - data['draft'] = 'Save draft' + data["draft"] = "Save draft" - request = make_request(user, data, method='post', site=self.site) + request = make_request(user, data, method="post", site=self.site) if page.get_parent().id != self.site.root_page.id: # Its a fund @@ -230,7 +244,7 @@ def submit_form(self, page=None, email=None, name=None, draft=None, user=None, i if not ignore_errors: # Check the data we submit is correct - self.assertNotContains(response, 'errors') + self.assertNotContains(response, "errors") return response def test_workflow_and_draft(self): @@ -290,7 +304,7 @@ def test_associated_if_not_new(self): self.assertEqual(ApplicationSubmission.objects.first().user, user) def test_associated_if_another_user_exists(self): - email = 'another@email.com' + email = "another@email.com" self.submit_form() # Someone else submits a form self.submit_form(email=email) @@ -298,13 +312,17 @@ def test_associated_if_another_user_exists(self): # Lead + 2 x applicant self.assertEqual(self.User.objects.count(), 3) - first_user, second_user = self.User.objects.get(email=self.email), self.User.objects.get(email=email) + first_user, second_user = self.User.objects.get( + email=self.email + ), self.User.objects.get(email=email) self.assertEqual(ApplicationSubmission.objects.count(), 2) self.assertEqual(ApplicationSubmission.objects.first().user, first_user) self.assertEqual(ApplicationSubmission.objects.last().user, second_user) def test_associated_if_logged_in(self): - user, _ = self.User.objects.get_or_create(email=self.email, defaults={'full_name': self.name}) + user, _ = self.User.objects.get_or_create( + email=self.email, defaults={"full_name": self.name} + ) # Lead + Applicant self.assertEqual(self.User.objects.count(), 2) @@ -319,12 +337,14 @@ def test_associated_if_logged_in(self): # This will need to be updated when we hide user information contextually def test_can_submit_if_blank_user_data_even_if_logged_in(self): - user, _ = self.User.objects.get_or_create(email=self.email, defaults={'full_name': self.name}) + user, _ = self.User.objects.get_or_create( + email=self.email, defaults={"full_name": self.name} + ) # Lead + applicant self.assertEqual(self.User.objects.count(), 2) - response = self.submit_form(email='', name='', user=user, ignore_errors=True) + response = self.submit_form(email="", name="", user=user, ignore_errors=True) self.assertEqual(response.status_code, 200) # Lead + applicant @@ -338,9 +358,9 @@ def test_can_submit_if_blank_user_data_even_if_logged_in(self): self.assertEqual(submission.user.email, self.email) def test_valid_email(self): - email = 'not_a_valid_email@' + email = "not_a_valid_email@" response = self.submit_form(email=email, ignore_errors=True) - self.assertContains(response, 'Enter a valid email address') + self.assertContains(response, "Enter a valid email address") @override_settings(SEND_MESSAGES=True) def test_email_sent_to_user_on_submission_fund(self): @@ -365,7 +385,7 @@ def refresh(self, instance): return instance.__class__.objects.get(id=instance.id) def test_can_get_required_block_names(self): - email = 'test@test.com' + email = "test@test.com" submission = self.make_submission(user__email=email) self.assertEqual(submission.email, email) @@ -375,7 +395,7 @@ def test_can_get_ordered_qs(self): submission_b = self.make_submission(round=submission_a.round) submissions = [submission_a, submission_b] self.assertEqual( - list(ApplicationSubmission.objects.order_by('id')), + list(ApplicationSubmission.objects.order_by("id")), submissions, ) @@ -384,28 +404,30 @@ def test_can_get_reverse_ordered_qs(self): submission_b = self.make_submission(round=submission_a.round) submissions = [submission_b, submission_a] self.assertEqual( - list(ApplicationSubmission.objects.order_by('-id')), + list(ApplicationSubmission.objects.order_by("-id")), submissions, ) def test_richtext_in_char_is_removed_for_search(self): - text = 'I am text' - rich_text = f'{text}' + text = "I am text" + rich_text = f"{text}" submission = self.make_submission(form_data__char=rich_text) self.assertNotIn(rich_text, submission.search_data) self.assertIn(text, submission.search_data) def test_richtext_is_removed_for_search(self): - text = 'I am text' - rich_text = f'{text}' + text = "I am text" + rich_text = f"{text}" submission = self.make_submission(form_data__rich_text=rich_text) self.assertNotIn(rich_text, submission.search_data) self.assertIn(text, submission.search_data) def test_choices_added_for_search(self): - choices = ['blah', 'foo'] - submission = self.make_submission(form_fields__radios__choices=choices, form_data__radios=['blah']) - self.assertIn('blah', submission.search_data) + choices = ["blah", "foo"] + submission = self.make_submission( + form_fields__radios__choices=choices, form_data__radios=["blah"] + ) + self.assertIn("blah", submission.search_data) def test_number_not_in_search(self): value = 12345 @@ -413,9 +435,9 @@ def test_number_not_in_search(self): self.assertNotIn(str(value), submission.search_data) def test_file_gets_uploaded(self): - filename = 'file_name.png' + filename = "file_name.png" submission = self.make_submission(form_data__image__filename=filename) - path = os.path.join(settings.MEDIA_ROOT, 'submission', str(submission.id)) + path = os.path.join(settings.MEDIA_ROOT, "submission", str(submission.id)) # Check we created the top level folder self.assertTrue(os.path.isdir(path)) @@ -432,14 +454,13 @@ def test_correct_file_path_generated(self): def check_generated_file_path(file_to_test, file_id): file_path_generated = file_to_test.generate_filename() - file_path_required = os.path.join('submission', str(submission.id), str(file_id), file_to_test.basename) + file_path_required = os.path.join( + "submission", str(submission.id), str(file_id), file_to_test.basename + ) self.assertEqual(file_path_generated, file_path_required) for file_id in submission.file_field_ids: - - - file_response = submission.data(file_id) if isinstance(file_response, list): for stream_file in file_response: @@ -455,7 +476,7 @@ def test_create_revision_on_create(self): def test_create_revision_on_data_change(self): submission = ApplicationSubmissionFactory() - submission.form_data['title'] = 'My Awesome Title' + submission.form_data["title"] = "My Awesome Title" new_data = submission.form_data submission.create_revision() submission = self.refresh(submission) @@ -474,8 +495,8 @@ def test_is_draft_property(self): def test_can_get_draft_data(self): submission = ApplicationSubmissionFactory() - title = 'My new title' - submission.form_data['title'] = title + title = "My new title" + submission.form_data["title"] = title submission.create_revision(draft=True) self.assertEqual(submission.revisions.count(), 2) @@ -492,13 +513,13 @@ def test_can_get_draft_data(self): def test_draft_updated(self): submission = ApplicationSubmissionFactory() - title = 'My new title' - submission.form_data['title'] = title + title = "My new title" + submission.form_data["title"] = title submission.create_revision(draft=True) self.assertEqual(submission.revisions.count(), 2) - title = 'My even newer title' - submission.form_data['title'] = title + title = "My even newer title" + submission.form_data["title"] = title submission.create_revision(draft=True) self.assertEqual(submission.revisions.count(), 2) @@ -511,14 +532,14 @@ def test_in_final_stage(self): self.assertTrue(submission.in_final_stage) -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class TestSubmissionRenderMethods(TestCase): def test_named_blocks_not_included_in_answers(self): submission = ApplicationSubmissionFactory() answers = submission.output_answers() for name in submission.named_blocks: field = submission.field(name) - self.assertNotIn(field.value['field_label'], answers) + self.assertNotIn(field.value["field_label"], answers) def test_normal_answers_included_in_answers(self): submission = ApplicationSubmissionFactory() @@ -526,10 +547,10 @@ def test_normal_answers_included_in_answers(self): for field_name in submission.question_field_ids: if field_name not in submission.named_blocks: field = submission.field(field_name) - self.assertIn(field.value['field_label'], answers) + self.assertIn(field.value["field_label"], answers) def test_paragraph_not_rendered_in_answers(self): - rich_text_label = 'My rich text label!' + rich_text_label = "My rich text label!" submission = ApplicationSubmissionFactory( form_fields__text_markup__value=rich_text_label ) @@ -540,13 +561,13 @@ def test_named_blocks_dont_break_if_no_response(self): submission = ApplicationSubmissionFactory() # the user didn't respond - del submission.form_data['value'] + del submission.form_data["value"] # value doesnt sneak into raw_data - self.assertTrue('value' not in submission.raw_data) + self.assertTrue("value" not in submission.raw_data) # value field_id gone - field_id = submission.get_definitive_id('value') + field_id = submission.get_definitive_id("value") self.assertTrue(field_id not in submission.raw_data) # value attr is None @@ -558,11 +579,12 @@ def test_file_private_url_included(self): def file_url_in_answers(file_to_test, file_id): url = reverse( - 'apply:submissions:serve_private_media', kwargs={ - 'pk': submission.pk, - 'field_id': file_id, - 'file_name': file_to_test.basename, - } + "apply:submissions:serve_private_media", + kwargs={ + "pk": submission.pk, + "field_id": file_id, + "file_name": file_to_test.basename, + }, ) self.assertIn(url, answers) @@ -581,16 +603,16 @@ def test_message_when_no_round(self): rfp = RequestForPartnersFactory() request = make_request(site=rfp.get_site()) response = rfp.serve(request) - self.assertContains(response, 'not accepting') - self.assertNotContains(response, 'Submit') + self.assertContains(response, "not accepting") + self.assertNotContains(response, "Submit") def test_form_when_round(self): rfp = RequestForPartnersFactory() TodayRoundFactory(parent=rfp) request = make_request(site=rfp.get_site()) response = rfp.serve(request) - self.assertNotContains(response, 'not accepting') - self.assertContains(response, 'Submit') + self.assertNotContains(response, "not accepting") + self.assertContains(response, "Submit") class TestForTableQueryset(TestCase): @@ -635,8 +657,12 @@ def test_opinionated_slash_confused_reviewer(self): submission = ApplicationSubmissionFactory() review_one = ReviewFactory(submission=submission) review_two = ReviewFactory(submission=submission) - ReviewOpinionFactory(opinion_disagree=True, review=review_one, author__reviewer=staff) - ReviewOpinionFactory(opinion_agree=True, review=review_two, author__reviewer=staff) + ReviewOpinionFactory( + opinion_disagree=True, review=review_one, author__reviewer=staff + ) + ReviewOpinionFactory( + opinion_agree=True, review=review_two, author__reviewer=staff + ) qs = ApplicationSubmission.objects.for_table(user=staff) submission = qs[0] self.assertEqual(submission.opinion_disagree, 1) @@ -649,12 +675,19 @@ def test_dont_double_count_review_and_opinion(self): staff = StaffFactory() submission = ApplicationSubmissionFactory() - review = ReviewFactory(submission=submission, author__reviewer=staff, author__staff=True) + review = ReviewFactory( + submission=submission, author__reviewer=staff, author__staff=True + ) opinion = ReviewOpinionFactory(opinion_disagree=True, review=review) # Another pair of review/opinion review_two = ReviewFactory(author=opinion.author, submission=submission) - ReviewOpinionFactory(opinion_disagree=True, author__reviewer=staff, author__staff=True, review=review_two) + ReviewOpinionFactory( + opinion_disagree=True, + author__reviewer=staff, + author__staff=True, + review=review_two, + ) qs = ApplicationSubmission.objects.for_table(user=staff) submission = qs[0] @@ -672,7 +705,7 @@ def test_submissions_dont_conflict(self): ReviewFactory(submission=submission_two) - qs = ApplicationSubmission.objects.order_by('pk').for_table(user=staff) + qs = ApplicationSubmission.objects.order_by("pk").for_table(user=staff) submission = qs[0] self.assertEqual(submission, submission_one) self.assertEqual(submission.opinion_disagree, 1) @@ -690,7 +723,6 @@ def test_submissions_dont_conflict(self): class TestReminderModel(TestCase): - def test_can_save_reminder(self): submission = ApplicationSubmissionFactory() reminder = ReminderFactory(submission=submission) @@ -703,7 +735,10 @@ def test_check_default_action(self): def test_reminder_action_message(self): reminder = ReminderFactory() - self.assertEqual(reminder.action_message, Reminder.ACTION_MESSAGE[f'{reminder.action}-{reminder.medium}']) + self.assertEqual( + reminder.action_message, + Reminder.ACTION_MESSAGE[f"{reminder.action}-{reminder.medium}"], + ) class TestAssignedReviewersQuerySet(TestCase): diff --git a/hypha/apply/funds/tests/test_tags.py b/hypha/apply/funds/tests/test_tags.py index fc8630b81a..4a4de66e3d 100644 --- a/hypha/apply/funds/tests/test_tags.py +++ b/hypha/apply/funds/tests/test_tags.py @@ -4,17 +4,24 @@ from hypha.apply.funds.tests.factories import ApplicationSubmissionFactory -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class TestTemplateTags(TestCase): def test_markdown_tags(self): - template = Template('{% load markdown_tags %}{{ content|markdown|safe }}') - context = Context({'content': 'Lorem ipsum **dolor** sit amet.'}) + template = Template("{% load markdown_tags %}{{ content|markdown|safe }}") + context = Context({"content": "Lorem ipsum **dolor** sit amet."}) output = template.render(context) - self.assertEqual(output, '

    Lorem ipsum dolor sit amet.

    \n') + self.assertEqual( + output, "

    Lorem ipsum dolor sit amet.

    \n" + ) def test_submission_tags(self): submission = ApplicationSubmissionFactory() - template = Template('{% load submission_tags %}{{ content|submission_links|safe }}') - context = Context({'content': f'Lorem ipsum dolor #{submission.id} sit amet.'}) + template = Template( + "{% load submission_tags %}{{ content|submission_links|safe }}" + ) + context = Context({"content": f"Lorem ipsum dolor #{submission.id} sit amet."}) output = template.render(context) - self.assertEqual(output, f'Lorem ipsum dolor {submission.title} #{submission.id} sit amet.') + self.assertEqual( + output, + f'Lorem ipsum dolor {submission.title} #{submission.id} sit amet.', + ) diff --git a/hypha/apply/funds/tests/test_views.py b/hypha/apply/funds/tests/test_views.py index 93699d3e6b..054c9df112 100644 --- a/hypha/apply/funds/tests/test_views.py +++ b/hypha/apply/funds/tests/test_views.py @@ -62,11 +62,11 @@ def prepare_form_data(submission, **kwargs): class BaseSubmissionViewTestCase(BaseViewTestCase): - url_name = 'funds:submissions:{}' - base_view_name = 'detail' + url_name = "funds:submissions:{}" + base_view_name = "detail" def get_kwargs(self, instance): - return {'pk': instance.id} + return {"pk": instance.id} class TestStaffSubmissionView(BaseSubmissionViewTestCase): @@ -94,26 +94,38 @@ def test_can_view_a_lab_submission(self): self.assertContains(response, submission.title) def test_can_progress_phase(self): - next_status = 'internal_review' - self.post_page(self.submission, {'form-submitted-progress_form': '', 'action': next_status}) + next_status = "internal_review" + self.post_page( + self.submission, {"form-submitted-progress_form": "", "action": next_status} + ) submission = self.refresh(self.submission) self.assertEqual(submission.status, next_status) def test_redirected_to_determination(self): - submission = ApplicationSubmissionFactory(status='concept_review_discussion', workflow_stages=2, lead=self.user) - response = self.post_page(submission, {'form-submitted-progress_form': '', 'action': 'invited_to_proposal'}) + submission = ApplicationSubmissionFactory( + status="concept_review_discussion", workflow_stages=2, lead=self.user + ) + response = self.post_page( + submission, + {"form-submitted-progress_form": "", "action": "invited_to_proposal"}, + ) # Invited for proposal is a a determination, so this will redirect to the determination form. - url = self.url_from_pattern('funds:submissions:determinations:form', kwargs={'submission_pk': submission.id}) + url = self.url_from_pattern( + "funds:submissions:determinations:form", + kwargs={"submission_pk": submission.id}, + ) self.assertRedirects(response, f"{url}?action=invited_to_proposal") def test_new_form_after_progress(self): - submission = ApplicationSubmissionFactory(status='invited_to_proposal', workflow_stages=2, lead=self.user) + submission = ApplicationSubmissionFactory( + status="invited_to_proposal", workflow_stages=2, lead=self.user + ) stage = submission.stage DeterminationFactory(submission=submission, accepted=True) - request = make_request(self.user, method='get', site=submission.page.get_site()) + request = make_request(self.user, method="get", site=submission.page.get_site()) submission.progress_stage_when_possible(self.user, request) submission = self.refresh(submission) @@ -121,50 +133,59 @@ def test_new_form_after_progress(self): self.assertNotEqual(stage, new_stage) - get_forms = submission.get_from_parent('get_defined_fields') + get_forms = submission.get_from_parent("get_defined_fields") self.assertEqual(submission.form_fields, get_forms(new_stage)) self.assertNotEqual(submission.form_fields, get_forms(stage)) def test_cant_progress_stage_if_not_lead(self): - submission = ApplicationSubmissionFactory(status='concept_review_discussion', workflow_stages=2) - self.post_page(submission, {'form-submitted-progress_form': '', 'action': 'invited_to_proposal'}) + submission = ApplicationSubmissionFactory( + status="concept_review_discussion", workflow_stages=2 + ) + self.post_page( + submission, + {"form-submitted-progress_form": "", "action": "invited_to_proposal"}, + ) submission = self.refresh(submission) - self.assertEqual(submission.status, 'concept_review_discussion') + self.assertEqual(submission.status, "concept_review_discussion") self.assertIsNone(submission.next) def test_not_redirected_if_determination_submitted(self): submission = ApplicationSubmissionFactory(lead=self.user) DeterminationFactory(submission=submission, rejected=True, submitted=True) - self.post_page(submission, {'form-submitted-progress_form': '', 'action': 'rejected'}) + self.post_page( + submission, {"form-submitted-progress_form": "", "action": "rejected"} + ) submission = self.refresh(submission) - self.assertEqual(submission.status, 'rejected') + self.assertEqual(submission.status, "rejected") def test_not_redirected_if_wrong_determination_selected(self): submission = ApplicationSubmissionFactory(lead=self.user) DeterminationFactory(submission=submission, accepted=True, submitted=True) - response = self.post_page(submission, {'form-submitted-progress_form': '', 'action': 'rejected'}) - self.assertContains(response, 'you tried to progress') + response = self.post_page( + submission, {"form-submitted-progress_form": "", "action": "rejected"} + ) + self.assertContains(response, "you tried to progress") submission = self.refresh(submission) - self.assertNotEqual(submission.status, 'accepted') - self.assertNotEqual(submission.status, 'rejected') + self.assertNotEqual(submission.status, "accepted") + self.assertNotEqual(submission.status, "rejected") def test_cant_access_edit_button_when_applicant_editing(self): - submission = ApplicationSubmissionFactory(status='more_info') + submission = ApplicationSubmissionFactory(status="more_info") response = self.get_page(submission) - self.assertNotContains(response, self.url(submission, 'edit', absolute=False)) + self.assertNotContains(response, self.url(submission, "edit", absolute=False)) def test_can_access_edit_button(self): response = self.get_page(self.submission) - self.assertContains(response, self.url(self.submission, 'edit', absolute=False)) + self.assertContains(response, self.url(self.submission, "edit", absolute=False)) def test_can_access_edit(self): - response = self.get_page(self.submission, 'edit') + response = self.get_page(self.submission, "edit") self.assertContains(response, self.submission.title) def test_previous_and_next_appears_on_page(self): @@ -177,9 +198,9 @@ def test_previous_and_next_appears_on_page(self): def test_can_edit_submission(self): old_status = self.submission.status - new_title = 'A new Title' + new_title = "A new Title" data = prepare_form_data(self.submission, title=new_title) - response = self.post_page(self.submission, {'submit': True, **data}, 'edit') + response = self.post_page(self.submission, {"submit": True, **data}, "edit") url = self.url(self.submission) @@ -193,7 +214,7 @@ def test_can_edit_submission(self): def test_not_included_fields_render(self): submission = ApplicationSubmissionFactory(form_fields__exclude__checkbox=True) response = self.get_page(submission) - self.assertNotContains(response, 'check_one') + self.assertNotContains(response, "check_one") def test_can_screen_submission(self): ScreeningStatus.objects.all().delete() @@ -206,7 +227,13 @@ def test_can_screen_submission(self): screening_outcome2.save() self.submission.screening_statuses.clear() self.submission.screening_statuses.add(screening_outcome2) - self.post_page(self.submission, {'form-submitted-screening_form': '', 'screening_statuses': [screening_outcome1.id, screening_outcome2.id]}) + self.post_page( + self.submission, + { + "form-submitted-screening_form": "", + "screening_statuses": [screening_outcome1.id, screening_outcome2.id], + }, + ) submission = self.refresh(self.submission) self.assertEqual(submission.screening_statuses.count(), 2) @@ -223,7 +250,7 @@ def test_can_view_submission_screening_block(self): screening_outcome2.save() self.submission.screening_statuses.clear() response = self.get_page(self.submission) - self.assertContains(response, 'Screening decision') + self.assertContains(response, "Screening decision") def test_cant_view_submission_screening_block(self): """ @@ -232,50 +259,65 @@ def test_cant_view_submission_screening_block(self): ScreeningStatus.objects.all().delete() self.submission.screening_statuses.clear() response = self.get_page(self.submission) - self.assertNotContains(response, 'Screening decision') + self.assertNotContains(response, "Screening decision") def test_can_create_project(self): # check submission doesn't already have a Project - with self.assertRaisesMessage(Project.DoesNotExist, 'ApplicationSubmission has no project.'): + with self.assertRaisesMessage( + Project.DoesNotExist, "ApplicationSubmission has no project." + ): self.submission.project # noqa: B018 - self.post_page(self.submission, { - 'form-submitted-project_form': '', - 'project_lead': self.user.id, - 'submission': self.submission.id, - }) + self.post_page( + self.submission, + { + "form-submitted-project_form": "", + "project_lead": self.user.id, + "submission": self.submission.id, + }, + ) - project = Project.objects.order_by('-pk').first() + project = Project.objects.order_by("-pk").first() submission = ApplicationSubmission.objects.get(pk=self.submission.pk) - self.assertTrue(hasattr(submission, 'project')) + self.assertTrue(hasattr(submission, "project")) self.assertEqual(submission.project.id, project.id) def test_can_see_add_determination_primary_action(self): def assert_add_determination_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string=pattern) + ) self.assertEqual(len(buttons), 1) - submission = ApplicationSubmissionFactory(status='determination') + submission = ApplicationSubmissionFactory(status="determination") # Phase: ready-for-determination, no determination # "Add determination" should be displayed - assert_add_determination_displayed(submission, 'Add determination') + assert_add_determination_displayed(submission, "Add determination") # Phase: ready-for-determination, draft determination # "Complete draft determination" should be displayed - DeterminationFactory(submission=submission, author=self.user, accepted=True, submitted=False) - assert_add_determination_displayed(submission, 'Complete draft determination') + DeterminationFactory( + submission=submission, author=self.user, accepted=True, submitted=False + ) + assert_add_determination_displayed(submission, "Complete draft determination") def test_cant_see_add_determination_primary_action(self): def assert_add_determination_not_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string=pattern) + ) self.assertEqual(len(buttons), 0) submission = ApplicationSubmissionFactory() @@ -283,15 +325,19 @@ def assert_add_determination_not_displayed(submission, button_text): # Phase: received / in_discussion # "Add determination" should not be displayed # "Complete draft determination" should not be displayed - assert_add_determination_not_displayed(submission, 'Add determination') - assert_add_determination_not_displayed(submission, 'Complete draft determination') + assert_add_determination_not_displayed(submission, "Add determination") + assert_add_determination_not_displayed( + submission, "Complete draft determination" + ) # Phase: accepted # "Add determination" should not be displayed # "Complete draft determination" should not be displayed - submission.perform_transition('accepted', self.user) - assert_add_determination_not_displayed(submission, 'Add determination') - assert_add_determination_not_displayed(submission, 'Complete draft determination') + submission.perform_transition("accepted", self.user) + assert_add_determination_not_displayed(submission, "Add determination") + assert_add_determination_not_displayed( + submission, "Complete draft determination" + ) def test_screen_application_primary_action_is_displayed(self): ScreeningStatus.objects.all().delete() @@ -303,52 +349,72 @@ def test_screen_application_primary_action_is_displayed(self): self.submission.screening_statuses.clear() self.submission.screening_statuses.add(screening_outcome) response = self.get_page(self.submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', string='Screen application') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", string="Screen application") + ) self.assertEqual(len(buttons), 1) self.submission.screening_statuses.clear() def test_screen_application_primary_action_is_not_displayed(self): response = self.get_page(self.submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', string='Screen application') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", string="Screen application") + ) self.assertEqual(len(buttons), 0) def test_can_see_create_review_primary_action(self): def assert_create_review_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string=pattern) + ) self.assertEqual(len(buttons), 1) - submission = ApplicationSubmissionFactory(with_external_review=True, status='ext_internal_review') + submission = ApplicationSubmissionFactory( + with_external_review=True, status="ext_internal_review" + ) # Phase: internal_review, no review # "Add a review" should be displayed - assert_create_review_displayed(submission, 'Add a review') + assert_create_review_displayed(submission, "Add a review") # Phase: internal_review, draft review created # "Complete draft review" should be displayed - review = ReviewFactory(submission=submission, author__reviewer=self.user, is_draft=True) - assert_create_review_displayed(submission, 'Complete draft review') + review = ReviewFactory( + submission=submission, author__reviewer=self.user, is_draft=True + ) + assert_create_review_displayed(submission, "Complete draft review") review.delete() # Phase: external_review, no review # "Add a review" should be displayed - submission.perform_transition('ext_post_review_discussion', self.user) - submission.perform_transition('ext_external_review', self.user) - assert_create_review_displayed(submission, 'Add a review') + submission.perform_transition("ext_post_review_discussion", self.user) + submission.perform_transition("ext_external_review", self.user) + assert_create_review_displayed(submission, "Add a review") # Phase: external_review, draft review created # "Complete draft review" should be displayed ReviewFactory(submission=submission, author__reviewer=self.user, is_draft=True) - assert_create_review_displayed(submission, 'Complete draft review') + assert_create_review_displayed(submission, "Complete draft review") def test_cant_see_create_review_primary_action(self): def assert_create_review_not_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string=pattern) + ) self.assertEqual(len(buttons), 0) submission = ApplicationSubmissionFactory(with_external_review=True) @@ -356,32 +422,36 @@ def assert_create_review_not_displayed(submission, button_text): # Phase: received / in_discussion # "Add a review" should not be displayed # "Complete draft review" should not be displayed - assert_create_review_not_displayed(submission, 'Add a review') - assert_create_review_not_displayed(submission, 'Complete draft review') + assert_create_review_not_displayed(submission, "Add a review") + assert_create_review_not_displayed(submission, "Complete draft review") # Phase: internal_review, review completed # "Add a review" should not be displayed # "Update draft review" should not be displayed - submission.perform_transition('ext_internal_review', self.user) + submission.perform_transition("ext_internal_review", self.user) ReviewFactory(submission=submission, author__reviewer=self.user, is_draft=False) - assert_create_review_not_displayed(submission, 'Add a review') - assert_create_review_not_displayed(submission, 'Complete draft review') + assert_create_review_not_displayed(submission, "Add a review") + assert_create_review_not_displayed(submission, "Complete draft review") # Phase: external_review, review completed # "Add a review" should not be displayed # "Update draft review" should not be displayed - submission.perform_transition('ext_post_review_discussion', self.user) - submission.perform_transition('ext_external_review', self.user) - assert_create_review_not_displayed(submission, 'Add a review') - assert_create_review_not_displayed(submission, 'Complete draft review') + submission.perform_transition("ext_post_review_discussion", self.user) + submission.perform_transition("ext_external_review", self.user) + assert_create_review_not_displayed(submission, "Add a review") + assert_create_review_not_displayed(submission, "Complete draft review") def test_can_see_assign_reviewers_primary_action(self): def assert_assign_reviewers_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--primary', string='Assign reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--primary", string="Assign reviewers") + ) self.assertEqual(len(buttons), 1) - submission = ApplicationSubmissionFactory(status='internal_review') + submission = ApplicationSubmissionFactory(status="internal_review") reviewer_role_a = ReviewerRoleFactory() reviewer_role_b = ReviewerRoleFactory() @@ -391,24 +461,36 @@ def assert_assign_reviewers_displayed(submission): # Phase: internal_review - not all reviewer types assigned # Assign reviewers should be displayed - AssignedReviewersFactory(submission=submission, reviewer=ReviewerFactory(), role=reviewer_role_a) + AssignedReviewersFactory( + submission=submission, reviewer=ReviewerFactory(), role=reviewer_role_a + ) assert_assign_reviewers_displayed(submission) # Phase: external_review - no reviewers assigned # Assign reviewers should be displayed - submission = ApplicationSubmissionFactory(with_external_review=True, status='ext_external_review') + submission = ApplicationSubmissionFactory( + with_external_review=True, status="ext_external_review" + ) assert_assign_reviewers_displayed(submission) # Phase: external_review - all reviewers types assigned # Assign reviewers should still be displayed - AssignedReviewersFactory(submission=submission, reviewer=ReviewerFactory(), role=reviewer_role_a) - AssignedReviewersFactory(submission=submission, reviewer=ReviewerFactory(), role=reviewer_role_b) + AssignedReviewersFactory( + submission=submission, reviewer=ReviewerFactory(), role=reviewer_role_a + ) + AssignedReviewersFactory( + submission=submission, reviewer=ReviewerFactory(), role=reviewer_role_b + ) assert_assign_reviewers_displayed(submission) def test_cant_see_assign_reviewers_primary_action(self): def assert_assign_reviewers_not_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--primary', string='Assign reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--primary", string="Assign reviewers") + ) self.assertEqual(len(buttons), 0) submission = ApplicationSubmissionFactory() @@ -419,13 +501,19 @@ def assert_assign_reviewers_not_displayed(submission): # Phase: internal_review - all reviewer types assigned # Assign reviewers should not be displayed - AssignedReviewersFactory(submission=submission, reviewer=ReviewerFactory(), role=reviewer_role) + AssignedReviewersFactory( + submission=submission, reviewer=ReviewerFactory(), role=reviewer_role + ) assert_assign_reviewers_not_displayed(submission) def test_can_see_assign_reviewers_secondary_action(self): def assert_assign_reviewers_secondary_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--white', string='Reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--white", string="Reviewers") + ) self.assertEqual(len(buttons), 1) submission = ApplicationSubmissionFactory() @@ -435,33 +523,47 @@ def assert_assign_reviewers_secondary_displayed(submission): assert_assign_reviewers_secondary_displayed(submission) # Phase: internal_review - no reviewers assigned - submission.perform_transition('internal_review', self.user) + submission.perform_transition("internal_review", self.user) assert_assign_reviewers_secondary_displayed(submission) # Phase: internal_review - all reviewer types assigned - AssignedReviewersFactory(submission=submission, reviewer=ReviewerFactory(), role=reviewer_role) + AssignedReviewersFactory( + submission=submission, reviewer=ReviewerFactory(), role=reviewer_role + ) assert_assign_reviewers_secondary_displayed(submission) def test_can_see_view_determination_primary_action(self): def assert_view_determination_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string='View determination') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string="View determination") + ) self.assertEqual(len(buttons), 1) # Phase: accepted - submission = ApplicationSubmissionFactory(status='accepted') - DeterminationFactory(submission=submission, author=self.user, accepted=True, submitted=True) + submission = ApplicationSubmissionFactory(status="accepted") + DeterminationFactory( + submission=submission, author=self.user, accepted=True, submitted=True + ) assert_view_determination_displayed(submission) # Phase: rejected - submission = ApplicationSubmissionFactory(status='rejected') - DeterminationFactory(submission=submission, author=self.user, rejected=True, submitted=True) + submission = ApplicationSubmissionFactory(status="rejected") + DeterminationFactory( + submission=submission, author=self.user, rejected=True, submitted=True + ) assert_view_determination_displayed(submission) def test_cant_see_view_determination_primary_action(self): def assert_view_determination_not_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string='View determination') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string="View determination") + ) self.assertEqual(len(buttons), 0) # Phase: received / in_discussion @@ -469,19 +571,21 @@ def assert_view_determination_not_displayed(submission): assert_view_determination_not_displayed(submission) # Phase: ready-for-determination, no determination - submission.perform_transition('determination', self.user) + submission.perform_transition("determination", self.user) assert_view_determination_not_displayed(submission) # Phase: ready-for-determination, draft determination - DeterminationFactory(submission=submission, author=self.user, accepted=True, submitted=False) + DeterminationFactory( + submission=submission, author=self.user, accepted=True, submitted=False + ) assert_view_determination_not_displayed(submission) def test_cant_see_application_draft_status(self): factory = RequestFactory() - submission = ApplicationSubmissionFactory(status='draft') + submission = ApplicationSubmissionFactory(status="draft") ProjectFactory(submission=submission) - request = factory.get(f'/submission/{submission.pk}') + request = factory.get(f"/submission/{submission.pk}") request.user = StaffFactory() with self.assertRaises(Http404): @@ -490,10 +594,10 @@ def test_cant_see_application_draft_status(self): def test_applicant_can_see_application_draft_status(self): factory = RequestFactory() user = ApplicantFactory() - submission = ApplicationSubmissionFactory(status='draft', user=user) + submission = ApplicationSubmissionFactory(status="draft", user=user) ProjectFactory(submission=submission) - request = factory.get(f'/submission/{submission.pk}') + request = factory.get(f"/submission/{submission.pk}") request.user = user response = SubmissionDetailView.as_view()(request, pk=submission.pk) @@ -515,12 +619,12 @@ def post_form(self, submission, reviewer_roles=None, reviewers=None): if reviewers is None: reviewers = [] data = { - 'form-submitted-reviewer_form': '', - 'reviewer_reviewers': [r.id for r in reviewers] + "form-submitted-reviewer_form": "", + "reviewer_reviewers": [r.id for r in reviewers], } data.update( **{ - f'role_reviewer_{str(role.id)}': reviewer.id + f"role_reviewer_{str(role.id)}": reviewer.id for role, reviewer in zip(self.roles, reviewer_roles, strict=False) } ) @@ -535,13 +639,17 @@ def test_lead_can_add_staff_single(self): def test_lead_can_change_staff_single(self): submission = ApplicationSubmissionFactory(lead=self.user) - AssignedWithRoleReviewersFactory(role=self.roles[0], submission=submission, reviewer=self.staff[0]) + AssignedWithRoleReviewersFactory( + role=self.roles[0], submission=submission, reviewer=self.staff[0] + ) self.assertCountEqual(submission.reviewers.all(), [self.staff[0]]) self.post_form(submission, reviewer_roles=[self.staff[1]]) self.assertCountEqual(submission.reviewers.all(), [self.staff[1]]) - self.assertEqual(submission.assigned.with_roles().first().reviewer, self.staff[1]) + self.assertEqual( + submission.assigned.with_roles().first().reviewer, self.staff[1] + ) def test_lead_cant_add_reviewers_single(self): submission = ApplicationSubmissionFactory(lead=self.user) @@ -590,10 +698,14 @@ def test_staff_cant_remove_reviewers_proposal(self): def test_lead_can_change_role_reviewer_and_review_remains(self): submission = ApplicationSubmissionFactory() - AssignedWithRoleReviewersFactory(role=self.roles[0], submission=submission, reviewer=self.staff[0]) + AssignedWithRoleReviewersFactory( + role=self.roles[0], submission=submission, reviewer=self.staff[0] + ) # Add a review from that staff reviewer - ReviewFactory(submission=submission, author__reviewer=self.staff[0], author__staff=True) + ReviewFactory( + submission=submission, author__reviewer=self.staff[0], author__staff=True + ) # Assign a different reviewer to the same role self.post_form(submission, reviewer_roles=[self.staff[1]]) @@ -604,7 +716,9 @@ def test_lead_can_change_role_reviewer_and_review_remains(self): def test_can_be_made_role_and_not_duplciated(self): submission = ApplicationSubmissionFactory() - ReviewFactory(submission=submission, author__reviewer=self.staff[0], author__staff=True) + ReviewFactory( + submission=submission, author__reviewer=self.staff[0], author__staff=True + ) self.post_form(submission, reviewer_roles=[self.staff[0]]) self.assertCountEqual(submission.reviewers.all(), [self.staff[0]]) @@ -638,7 +752,9 @@ def setUp(self): self.applicant = ApplicantFactory() self.reviewer_role = ReviewerRoleFactory() apply_site = ApplySiteFactory() - self.reviewer_settings, _ = ReviewerSettings.objects.get_or_create(site_id=apply_site.id) + self.reviewer_settings, _ = ReviewerSettings.objects.get_or_create( + site_id=apply_site.id + ) self.reviewer_settings.use_settings = True self.reviewer_settings.save() @@ -646,123 +762,172 @@ def test_cant_see_add_determination_primary_action(self): def assert_add_determination_not_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = BeautifulSoup(response.content, "html5lib").find_all( + "a", class_="button--primary", string=pattern + ) self.assertEqual(len(buttons), 0) - submission = ApplicationSubmissionFactory(status='determination', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="determination", user=self.applicant, reviewers=[self.user] + ) # Phase: ready-for-determination, no determination # "Add determination" should not be displayed # "Complete draft determination" should not be displayed - assert_add_determination_not_displayed(submission, 'Add determination') - assert_add_determination_not_displayed(submission, 'Complete draft determination') + assert_add_determination_not_displayed(submission, "Add determination") + assert_add_determination_not_displayed( + submission, "Complete draft determination" + ) # Phase: ready-for-determination, draft determination # "Add determination" should not be displayed # "Complete draft determination" should not be displayed DeterminationFactory(submission=submission, accepted=True, submitted=False) - assert_add_determination_not_displayed(submission, 'Add determination') - assert_add_determination_not_displayed(submission, 'Complete draft determination') + assert_add_determination_not_displayed(submission, "Add determination") + assert_add_determination_not_displayed( + submission, "Complete draft determination" + ) def test_can_see_create_review_primary_action(self): def assert_create_review_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string=pattern) + ) self.assertEqual(len(buttons), 1) - submission = ApplicationSubmissionFactory(with_external_review=True, status='ext_external_review', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + with_external_review=True, + status="ext_external_review", + user=self.applicant, + reviewers=[self.user], + ) # Phase: external_review, no review # "Add a review" should be displayed - submission.perform_transition('ext_post_review_discussion', self.user) - submission.perform_transition('ext_external_review', self.user) - assert_create_review_displayed(submission, 'Add a review') + submission.perform_transition("ext_post_review_discussion", self.user) + submission.perform_transition("ext_external_review", self.user) + assert_create_review_displayed(submission, "Add a review") # Phase: external_review, draft review created # "Complete draft review" should be displayed ReviewFactory(submission=submission, author__reviewer=self.user, is_draft=True) - assert_create_review_displayed(submission, 'Complete draft review') + assert_create_review_displayed(submission, "Complete draft review") def test_cant_see_create_review_primary_action(self): def assert_create_review_not_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = BeautifulSoup(response.content, "html5lib").find_all( + "a", class_="button--primary", string=pattern + ) self.assertEqual(len(buttons), 0) - submission = ApplicationSubmissionFactory(with_external_review=True, user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + with_external_review=True, user=self.applicant, reviewers=[self.user] + ) # Phase: received / in_discussion # "Add a review" should not be displayed # "Complete draft review" should not be displayed - assert_create_review_not_displayed(submission, 'Add a review') - assert_create_review_not_displayed(submission, 'Complete draft review') + assert_create_review_not_displayed(submission, "Add a review") + assert_create_review_not_displayed(submission, "Complete draft review") # Phase: internal_review, only viewable by staff users # "Add a review" should not be displayed # "Update draft review" should not be displayed - submission.perform_transition('ext_internal_review', self.user) - assert_create_review_not_displayed(submission, 'Add a review') - assert_create_review_not_displayed(submission, 'Complete draft review') + submission.perform_transition("ext_internal_review", self.user) + assert_create_review_not_displayed(submission, "Add a review") + assert_create_review_not_displayed(submission, "Complete draft review") # Phase: external_review, review completed # "Add a review" should not be displayed # "Update draft review" should not be displayed - submission.perform_transition('ext_post_review_discussion', self.user) - submission.perform_transition('ext_external_review', self.user) + submission.perform_transition("ext_post_review_discussion", self.user) + submission.perform_transition("ext_external_review", self.user) ReviewFactory(submission=submission, author__reviewer=self.user, is_draft=False) - assert_create_review_not_displayed(submission, 'Add a review') - assert_create_review_not_displayed(submission, 'Complete draft review') + assert_create_review_not_displayed(submission, "Add a review") + assert_create_review_not_displayed(submission, "Complete draft review") def test_cant_see_assign_reviewers_primary_action(self): - submission = ApplicationSubmissionFactory(status='internal_review', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="internal_review", user=self.applicant, reviewers=[self.user] + ) response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--primary', string='Assign reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--primary", string="Assign reviewers") + ) self.assertEqual(len(buttons), 0) def test_cant_see_assign_reviewers_secondary_action(self): - submission = ApplicationSubmissionFactory(status='internal_review', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="internal_review", user=self.applicant, reviewers=[self.user] + ) response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--white', string='Reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--white", string="Reviewers") + ) self.assertEqual(len(buttons), 0) def test_can_see_view_determination_primary_action(self): def assert_view_determination_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string='View determination') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string="View determination") + ) self.assertEqual(len(buttons), 1) # Phase: accepted - submission = ApplicationSubmissionFactory(status='accepted', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="accepted", user=self.applicant, reviewers=[self.user] + ) DeterminationFactory(submission=submission, accepted=True, submitted=True) assert_view_determination_displayed(submission) # Phase: rejected - submission = ApplicationSubmissionFactory(status='rejected', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="rejected", user=self.applicant, reviewers=[self.user] + ) DeterminationFactory(submission=submission, rejected=True, submitted=True) assert_view_determination_displayed(submission) def test_cant_see_view_determination_primary_action(self): def assert_view_determination_not_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--primary', string='View determination') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--primary", string="View determination") + ) self.assertEqual(len(buttons), 0) # Phase: received / in_discussion - submission = ApplicationSubmissionFactory(user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + user=self.applicant, reviewers=[self.user] + ) assert_view_determination_not_displayed(submission) # Phase: ready-for-determination, no determination - submission.perform_transition('determination', self.user) + submission.perform_transition("determination", self.user) assert_view_determination_not_displayed(submission) # Phase: ready-for-determination, draft determination - DeterminationFactory(submission=submission, author=self.user, accepted=True, submitted=False) + DeterminationFactory( + submission=submission, author=self.user, accepted=True, submitted=False + ) assert_view_determination_not_displayed(submission) def test_can_access_any_submission(self): @@ -774,11 +939,13 @@ def test_can_access_any_submission(self): self.assertEqual(response.status_code, 200) def test_can_only_access_reviewed_submission(self): - self.reviewer_settings.submission = 'reviewed' - self.reviewer_settings.state = 'all' - self.reviewer_settings.outcome = 'all' + self.reviewer_settings.submission = "reviewed" + self.reviewer_settings.state = "all" + self.reviewer_settings.outcome = "all" self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + user=self.applicant, reviewers=[self.user] + ) response = self.get_page(submission) self.assertEqual(response.status_code, 403) @@ -787,9 +954,9 @@ def test_can_only_access_reviewed_submission(self): self.assertEqual(response.status_code, 200) def test_can_only_access_external_review_or_higher_submission(self): - self.reviewer_settings.submission = 'all' - self.reviewer_settings.state = 'ext_state_or_higher' - self.reviewer_settings.outcome = 'all' + self.reviewer_settings.submission = "all" + self.reviewer_settings.state = "ext_state_or_higher" + self.reviewer_settings.outcome = "all" self.reviewer_settings.assigned = False self.reviewer_settings.save() @@ -797,67 +964,85 @@ def test_can_only_access_external_review_or_higher_submission(self): response = self.get_page(submission) self.assertEqual(response.status_code, 403) - submission = ApplicationSubmissionFactory(with_external_review=True, user=self.applicant) - submission.perform_transition('ext_internal_review', self.user) - submission.perform_transition('ext_post_review_discussion', self.user) - submission.perform_transition('ext_external_review', self.user) + submission = ApplicationSubmissionFactory( + with_external_review=True, user=self.applicant + ) + submission.perform_transition("ext_internal_review", self.user) + submission.perform_transition("ext_post_review_discussion", self.user) + submission.perform_transition("ext_external_review", self.user) response = self.get_page(submission) self.assertEqual(response.status_code, 200) def test_cant_access_dismissed_submission(self): - self.reviewer_settings.submission = 'all' - self.reviewer_settings.state = 'all' - self.reviewer_settings.outcome = 'all' + self.reviewer_settings.submission = "all" + self.reviewer_settings.state = "all" + self.reviewer_settings.outcome = "all" self.reviewer_settings.assigned = False self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(status='rejected', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="rejected", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 200) - self.reviewer_settings.outcome = 'all_except_dismissed' + self.reviewer_settings.outcome = "all_except_dismissed" self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(status='rejected', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="rejected", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 403) def test_can_only_access_accepted_submission(self): - self.reviewer_settings.submission = 'all' - self.reviewer_settings.state = 'all' + self.reviewer_settings.submission = "all" + self.reviewer_settings.state = "all" self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(status='rejected', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="rejected", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 200) - self.reviewer_settings.outcome = 'accepted' + self.reviewer_settings.outcome = "accepted" self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(status='rejected', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="rejected", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 403) - submission = ApplicationSubmissionFactory(status='accepted', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="accepted", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 200) def test_can_only_access_assigned_submission(self): - self.reviewer_settings.submission = 'all' - self.reviewer_settings.state = 'all' - self.reviewer_settings.outcome = 'all' + self.reviewer_settings.submission = "all" + self.reviewer_settings.state = "all" + self.reviewer_settings.outcome = "all" self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(status='accepted', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="accepted", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 200) self.reviewer_settings.assigned = True self.reviewer_settings.save() - submission = ApplicationSubmissionFactory(status='accepted', user=self.applicant) + submission = ApplicationSubmissionFactory( + status="accepted", user=self.applicant + ) response = self.get_page(submission) self.assertEqual(response.status_code, 403) - submission = ApplicationSubmissionFactory(status='accepted', user=self.applicant, reviewers=[self.user]) + submission = ApplicationSubmissionFactory( + status="accepted", user=self.applicant, reviewers=[self.user] + ) response = self.get_page(submission) self.assertEqual(response.status_code, 200) @@ -870,7 +1055,9 @@ class TestApplicantSubmissionView(BaseSubmissionViewTestCase): def setUp(self): super().setUp() self.submission = ApplicationSubmissionFactory(user=self.user) - self.draft_proposal_submission = InvitedToProposalFactory(user=self.user, draft=True) + self.draft_proposal_submission = InvitedToProposalFactory( + user=self.user, draft=True + ) def __setUp__(self): self.refresh(self.submission) @@ -896,49 +1083,59 @@ def test_cant_view_others_submission(self): self.assertEqual(response.status_code, 403) def test_get_edit_link_when_editable(self): - submission = ApplicationSubmissionFactory(user=self.user, status='more_info') + submission = ApplicationSubmissionFactory(user=self.user, status="more_info") response = self.get_page(submission) - self.assertContains(response, 'Edit') - self.assertContains(response, self.url(submission, 'edit', absolute=False)) - self.assertNotContains(response, 'Congratulations') + self.assertContains(response, "Edit") + self.assertContains(response, self.url(submission, "edit", absolute=False)) + self.assertNotContains(response, "Congratulations") def test_get_congratulations_draft_proposal(self): response = self.get_page(self.draft_proposal_submission) - self.assertContains(response, 'Congratulations') + self.assertContains(response, "Congratulations") def test_can_edit_own_submission(self): - response = self.get_page(self.draft_proposal_submission, 'edit') + response = self.get_page(self.draft_proposal_submission, "edit") self.assertContains(response, self.draft_proposal_submission.title) def test_can_submit_submission(self): old_status = self.draft_proposal_submission.status - data = prepare_form_data(self.draft_proposal_submission, title='This is different') + data = prepare_form_data( + self.draft_proposal_submission, title="This is different" + ) - response = self.post_page(self.draft_proposal_submission, {'submit': True, **data}, 'edit') + response = self.post_page( + self.draft_proposal_submission, {"submit": True, **data}, "edit" + ) - url = self.url_from_pattern('funds:submissions:detail', kwargs={'pk': self.draft_proposal_submission.id}) + url = self.url_from_pattern( + "funds:submissions:detail", kwargs={"pk": self.draft_proposal_submission.id} + ) self.assertRedirects(response, url) submission = self.refresh(self.draft_proposal_submission) self.assertNotEqual(old_status, submission.status) def test_gets_draft_on_edit_submission(self): - draft_revision = ApplicationRevisionFactory(submission=self.draft_proposal_submission) + draft_revision = ApplicationRevisionFactory( + submission=self.draft_proposal_submission + ) self.draft_proposal_submission.draft_revision = draft_revision self.draft_proposal_submission.save() - response = self.get_page(self.draft_proposal_submission, 'edit') - self.assertDictEqual(response.context['object'].form_data, draft_revision.form_data) + response = self.get_page(self.draft_proposal_submission, "edit") + self.assertDictEqual( + response.context["object"].form_data, draft_revision.form_data + ) def test_cant_edit_submission_incorrect_state(self): submission = InvitedToProposalFactory(user=self.user) - response = self.get_page(submission, 'edit') + response = self.get_page(submission, "edit") self.assertEqual(response.status_code, 403) def test_cant_edit_other_submission(self): submission = InvitedToProposalFactory(draft=True) - response = self.get_page(submission, 'edit') + response = self.get_page(submission, "edit") self.assertEqual(response.status_code, 403) def test_cant_screen_submission(self): @@ -947,44 +1144,60 @@ def test_cant_screen_submission(self): and that they don't see the screening decision form. """ screening_outcome = ScreeningStatusFactory() - response = self.post_page(self.submission, {'form-submitted-screening_form': '', 'screening_statuses': [screening_outcome.id]}) - self.assertNotIn('screening_form', response.context_data) + response = self.post_page( + self.submission, + { + "form-submitted-screening_form": "", + "screening_statuses": [screening_outcome.id], + }, + ) + self.assertNotIn("screening_form", response.context_data) submission = self.refresh(self.submission) self.assertNotIn(screening_outcome, submission.screening_statuses.all()) def test_cant_see_screening_status_block(self): response = self.get_page(self.submission) - self.assertNotContains(response, 'Screening decision') + self.assertNotContains(response, "Screening decision") def test_cant_see_add_determination_primary_action(self): def assert_add_determination_not_displayed(submission, button_text): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(rf'\s*{button_text}\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(rf"\s*{button_text}\s*") + buttons = BeautifulSoup(response.content, "html5lib").find_all( + "a", class_="button--primary", string=pattern + ) self.assertEqual(len(buttons), 0) - submission = ApplicationSubmissionFactory(status='determination', user=self.user) + submission = ApplicationSubmissionFactory( + status="determination", user=self.user + ) # Phase: ready-for-determination, no determination # "Add determination" should not be displayed # "Complete draft determination" should not be displayed - assert_add_determination_not_displayed(submission, 'Add determination') - assert_add_determination_not_displayed(submission, 'Complete draft determination') + assert_add_determination_not_displayed(submission, "Add determination") + assert_add_determination_not_displayed( + submission, "Complete draft determination" + ) # Phase: ready-for-determination, draft determination # "Add determination" should not be displayed # "Complete draft determination" should not be displayed DeterminationFactory(submission=submission, accepted=True, submitted=False) - assert_add_determination_not_displayed(submission, 'Add determination') - assert_add_determination_not_displayed(submission, 'Complete draft determination') + assert_add_determination_not_displayed(submission, "Add determination") + assert_add_determination_not_displayed( + submission, "Complete draft determination" + ) def test_cant_see_create_review_primary_action(self): def assert_create_review_not_displayed(submission): response = self.get_page(submission) # Ignore whitespace (including line breaks) in button text - pattern = re.compile(r'\s*Add a review\s*') - buttons = BeautifulSoup(response.content, 'html5lib').find_all('a', class_='button--primary', string=pattern) + pattern = re.compile(r"\s*Add a review\s*") + buttons = BeautifulSoup(response.content, "html5lib").find_all( + "a", class_="button--primary", string=pattern + ) self.assertEqual(len(buttons), 0) submission = ApplicationSubmissionFactory(user=self.user) @@ -996,43 +1209,63 @@ def assert_create_review_not_displayed(submission): # Phase: internal_review # "Add a review" should not be displayed staff_user = StaffFactory() - submission.perform_transition('internal_review', staff_user) + submission.perform_transition("internal_review", staff_user) assert_create_review_not_displayed(submission) def test_cant_see_assign_reviewers_primary_action(self): - submission = ApplicationSubmissionFactory(status='internal_review', user=self.user) + submission = ApplicationSubmissionFactory( + status="internal_review", user=self.user + ) ReviewerRoleFactory() response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--primary', string='Assign reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--primary", string="Assign reviewers") + ) self.assertEqual(len(buttons), 0) def test_cant_see_assign_reviewers_secondary_action(self): - submission = ApplicationSubmissionFactory(status='internal_review', user=self.user) + submission = ApplicationSubmissionFactory( + status="internal_review", user=self.user + ) ReviewerRoleFactory() response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--white', string='Reviewers') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--white", string="Reviewers") + ) self.assertEqual(len(buttons), 0) def test_can_see_view_determination_primary_action(self): def assert_view_determination_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='js-actions-sidebar').find_all('a', class_='button--primary', string='View determination') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="js-actions-sidebar") + .find_all("a", class_="button--primary", string="View determination") + ) self.assertEqual(len(buttons), 1) # Phase: accepted - submission = ApplicationSubmissionFactory(status='accepted', user=self.user) + submission = ApplicationSubmissionFactory(status="accepted", user=self.user) DeterminationFactory(submission=submission, accepted=True, submitted=True) assert_view_determination_displayed(submission) # Phase: rejected - submission = ApplicationSubmissionFactory(status='rejected', user=self.user) + submission = ApplicationSubmissionFactory(status="rejected", user=self.user) DeterminationFactory(submission=submission, rejected=True, submitted=True) assert_view_determination_displayed(submission) def test_cant_see_view_determination_primary_action(self): def assert_view_determination_not_displayed(submission): response = self.get_page(submission) - buttons = BeautifulSoup(response.content, 'html5lib').find(class_='sidebar').find_all('a', class_='button--primary', string='View determination') + buttons = ( + BeautifulSoup(response.content, "html5lib") + .find(class_="sidebar") + .find_all("a", class_="button--primary", string="View determination") + ) self.assertEqual(len(buttons), 0) # Phase: received / in_discussion @@ -1040,7 +1273,7 @@ def assert_view_determination_not_displayed(submission): assert_view_determination_not_displayed(submission) # Phase: ready-for-determination, no determination - submission.perform_transition('determination', self.user) + submission.perform_transition("determination", self.user) assert_view_determination_not_displayed(submission) # Phase: ready-for-determination, draft determination @@ -1052,18 +1285,20 @@ class TestRevisionsView(BaseSubmissionViewTestCase): user_factory = ApplicantFactory def test_create_revisions_on_submit(self): - submission = ApplicationSubmissionFactory(status='draft_proposal', workflow_stages=2, user=self.user) + submission = ApplicationSubmissionFactory( + status="draft_proposal", workflow_stages=2, user=self.user + ) old_data = submission.form_data.copy() - new_title = 'New title' + new_title = "New title" new_data = prepare_form_data(submission, title=new_title) - self.post_page(submission, {'submit': True, **new_data}, 'edit') + self.post_page(submission, {"submit": True, **new_data}, "edit") submission = self.refresh(submission) self.maxDiff = None - self.assertEqual(submission.status, 'proposal_discussion') + self.assertEqual(submission.status, "proposal_discussion") self.assertEqual(submission.revisions.count(), 2) self.assertDictEqual(submission.revisions.last().form_data, old_data) self.assertDictEqual(submission.live_revision.form_data, submission.form_data) @@ -1071,38 +1306,46 @@ def test_create_revisions_on_submit(self): self.assertEqual(submission.title, new_title) def test_dont_update_live_revision_on_save(self): - submission = ApplicationSubmissionFactory(status='draft_proposal', workflow_stages=2, user=self.user) + submission = ApplicationSubmissionFactory( + status="draft_proposal", workflow_stages=2, user=self.user + ) old_data = submission.form_data.copy() - new_data = prepare_form_data(submission, title='New title') + new_data = prepare_form_data(submission, title="New title") - self.post_page(submission, {'save': True, **new_data}, 'edit') + self.post_page(submission, {"save": True, **new_data}, "edit") submission = self.refresh(submission) self.maxDiff = None - self.assertEqual(submission.status, 'draft_proposal') + self.assertEqual(submission.status, "draft_proposal") self.assertEqual(submission.revisions.count(), 2) - self.assertDictEqual(submission.draft_revision.form_data, submission.from_draft().form_data) + self.assertDictEqual( + submission.draft_revision.form_data, submission.from_draft().form_data + ) self.assertEqual(submission.draft_revision.author, self.user) self.assertDictEqual(submission.live_revision.form_data, old_data) def test_existing_draft_edit_and_submit(self): - submission = ApplicationSubmissionFactory(status='draft_proposal', workflow_stages=2, user=self.user) - draft_data = prepare_form_data(submission, title='A new title') + submission = ApplicationSubmissionFactory( + status="draft_proposal", workflow_stages=2, user=self.user + ) + draft_data = prepare_form_data(submission, title="A new title") - self.post_page(submission, {'save': True, **draft_data}, 'edit') + self.post_page(submission, {"save": True, **draft_data}, "edit") submission = self.refresh(submission) - newer_title = 'Newer title' + newer_title = "Newer title" draft_data = prepare_form_data(submission, title=newer_title) - self.post_page(submission, {'submit': True, **draft_data}, 'edit') + self.post_page(submission, {"submit": True, **draft_data}, "edit") submission = self.refresh(submission) self.maxDiff = None - self.assertDictEqual(submission.draft_revision.form_data, submission.from_draft().form_data) + self.assertDictEqual( + submission.draft_revision.form_data, submission.from_draft().form_data + ) self.assertDictEqual(submission.live_revision.form_data, submission.form_data) self.assertEqual(submission.revisions.count(), 2) @@ -1110,19 +1353,21 @@ def test_existing_draft_edit_and_submit(self): class TestRevisionCompare(BaseSubmissionViewTestCase): - base_view_name = 'revisions:compare' + base_view_name = "revisions:compare" user_factory = StaffFactory def get_kwargs(self, instance): return { - 'submission_pk': instance.pk, - 'to': instance.live_revision.id, - 'from': instance.revisions.last().id, + "submission_pk": instance.pk, + "to": instance.live_revision.id, + "from": instance.revisions.last().id, } def test_renders_with_all_the_diffs(self): submission = ApplicationSubmissionFactory() - new_data = ApplicationSubmissionFactory(round=submission.round, form_fields=submission.form_fields).form_data + new_data = ApplicationSubmissionFactory( + round=submission.round, form_fields=submission.form_fields + ).form_data submission.form_data = new_data @@ -1133,11 +1378,11 @@ def test_renders_with_all_the_diffs(self): class TestRevisionList(BaseSubmissionViewTestCase): - base_view_name = 'revisions:list' + base_view_name = "revisions:list" user_factory = StaffFactory def get_kwargs(self, instance): - return {'submission_pk': instance.pk} + return {"submission_pk": instance.pk} def test_list_doesnt_include_draft(self): submission = ApplicationSubmissionFactory() @@ -1147,21 +1392,25 @@ def test_list_doesnt_include_draft(self): response = self.get_page(submission) - self.assertNotIn(draft_revision, response.context['object_list']) + self.assertNotIn(draft_revision, response.context["object_list"]) def test_get_in_correct_order(self): submission = ApplicationSubmissionFactory() revision = ApplicationRevisionFactory(submission=submission) - ApplicationRevision.objects.filter(id=revision.id).update(timestamp=timezone.now() - timedelta(days=1)) + ApplicationRevision.objects.filter(id=revision.id).update( + timestamp=timezone.now() - timedelta(days=1) + ) revision_older = ApplicationRevisionFactory(submission=submission) - ApplicationRevision.objects.filter(id=revision_older.id).update(timestamp=timezone.now() - timedelta(days=2)) + ApplicationRevision.objects.filter(id=revision_older.id).update( + timestamp=timezone.now() - timedelta(days=2) + ) response = self.get_page(submission) self.assertSequenceEqual( - response.context['object_list'], + response.context["object_list"], [submission.live_revision, revision, revision_older], ) @@ -1172,14 +1421,18 @@ class TestStaffSealedView(BaseSubmissionViewTestCase): def test_redirected_to_sealed(self): submission = SealedSubmissionFactory() response = self.get_page(submission) - url = self.url_from_pattern('funds:submissions:sealed', kwargs={'pk': submission.id}) + url = self.url_from_pattern( + "funds:submissions:sealed", kwargs={"pk": submission.id} + ) self.assertRedirects(response, url) def test_cant_post_to_sealed(self): submission = SealedSubmissionFactory() - response = self.post_page(submission, {'some': 'data'}, 'sealed') + response = self.post_page(submission, {"some": "data"}, "sealed") # Because of the redirect chain the url returned is not absolute - url = self.url_from_pattern('funds:submissions:sealed', kwargs={'pk': submission.id}, absolute=False) + url = self.url_from_pattern( + "funds:submissions:sealed", kwargs={"pk": submission.id}, absolute=False + ) self.assertRedirects(response, url) def test_non_sealed_unaffected(self): @@ -1189,8 +1442,10 @@ def test_non_sealed_unaffected(self): def test_non_sealed_redirected_away(self): submission = ApplicationSubmissionFactory() - response = self.get_page(submission, 'sealed') - url = self.url_from_pattern('funds:submissions:detail', kwargs={'pk': submission.id}) + response = self.get_page(submission, "sealed") + url = self.url_from_pattern( + "funds:submissions:detail", kwargs={"pk": submission.id} + ) self.assertRedirects(response, url) @@ -1200,28 +1455,32 @@ class TestSuperUserSealedView(BaseSubmissionViewTestCase): def test_redirected_to_sealed(self): submission = SealedSubmissionFactory() response = self.get_page(submission) - url = self.url_from_pattern('funds:submissions:sealed', kwargs={'pk': submission.id}) + url = self.url_from_pattern( + "funds:submissions:sealed", kwargs={"pk": submission.id} + ) self.assertRedirects(response, url) def test_can_post_to_sealed(self): submission = SealedSubmissionFactory() - response = self.post_page(submission, {}, 'sealed') - url = self.url_from_pattern('funds:submissions:detail', kwargs={'pk': submission.id}) + response = self.post_page(submission, {}, "sealed") + url = self.url_from_pattern( + "funds:submissions:detail", kwargs={"pk": submission.id} + ) self.assertRedirects(response, url) def test_peeking_is_logged(self): submission = SealedSubmissionFactory() - self.post_page(submission, {}, 'sealed') + self.post_page(submission, {}, "sealed") - self.assertTrue('peeked' in self.client.session) - self.assertTrue(str(submission.id) in self.client.session['peeked']) + self.assertTrue("peeked" in self.client.session) + self.assertTrue(str(submission.id) in self.client.session["peeked"]) self.assertEqual(Activity.objects.count(), 1) - self.assertTrue('sealed' in Activity.objects.first().message) + self.assertTrue("sealed" in Activity.objects.first().message) def test_not_asked_again(self): submission = SealedSubmissionFactory() - self.post_page(submission, {}, 'sealed') + self.post_page(submission, {}, "sealed") # Now request the page again response = self.get_page(submission) @@ -1231,12 +1490,12 @@ def test_can_view_multiple_sealed(self): sealed_round = SealedRoundFactory() first, second = SealedSubmissionFactory.create_batch(2, round=sealed_round) - self.post_page(first, {}, 'sealed') - self.post_page(second, {}, 'sealed') + self.post_page(first, {}, "sealed") + self.post_page(second, {}, "sealed") - self.assertTrue('peeked' in self.client.session) - self.assertTrue(str(first.id) in self.client.session['peeked']) - self.assertTrue(str(second.id) in self.client.session['peeked']) + self.assertTrue("peeked" in self.client.session) + self.assertTrue(str(first.id) in self.client.session["peeked"]) + self.assertTrue(str(second.id) in self.client.session["peeked"]) class TestSuperUserSubmissionView(BaseSubmissionViewTestCase): @@ -1261,7 +1520,13 @@ def test_can_screen_submission(self): screening_outcome2.save() self.submission.screening_statuses.clear() self.submission.screening_statuses.add(screening_outcome2) - self.post_page(self.submission, {'form-submitted-screening_form': '', 'screening_statuses': [screening_outcome1.id, screening_outcome2.id]}) + self.post_page( + self.submission, + { + "form-submitted-screening_form": "", + "screening_statuses": [screening_outcome1.id, screening_outcome2.id], + }, + ) submission = self.refresh(self.submission) self.assertEqual(submission.screening_statuses.count(), 2) @@ -1280,13 +1545,21 @@ def test_can_screen_applications_in_final_status(self): screening_outcome2.default = True screening_outcome2.save() submission.screening_statuses.add(screening_outcome2) - response = self.post_page(submission, {'form-submitted-screening_form': '', 'screening_statuses': [screening_outcome1.id, screening_outcome2.id]}) + response = self.post_page( + submission, + { + "form-submitted-screening_form": "", + "screening_statuses": [screening_outcome1.id, screening_outcome2.id], + }, + ) submission = self.refresh(submission) - self.assertEqual(response.context_data['screening_form'].should_show, True) + self.assertEqual(response.context_data["screening_form"].should_show, True) self.assertEqual(submission.screening_statuses.count(), 2) # Check that an activity was created that should only be viewable internally - activity = Activity.objects.filter(message__contains='Screening decision').first() + activity = Activity.objects.filter( + message__contains="Screening decision" + ).first() self.assertEqual(activity.visibility, TEAM) @@ -1296,7 +1569,7 @@ def test_staff_only(self): submission = ApplicationSubmissionFactory() ProjectFactory(submission=submission) - request = factory.get(f'/submission/{submission.pk}') + request = factory.get(f"/submission/{submission.pk}") request.user = StaffFactory() response = SubmissionDetailSimplifiedView.as_view()(request, pk=submission.pk) @@ -1310,7 +1583,7 @@ def test_project_required(self): factory = RequestFactory() submission = ApplicationSubmissionFactory() - request = factory.get(f'/submission/{submission.pk}') + request = factory.get(f"/submission/{submission.pk}") request.user = StaffFactory() with self.assertRaises(Http404): @@ -1322,17 +1595,17 @@ def test_project_required(self): class BaseSubmissionFileViewTestCase(BaseViewTestCase): - url_name = 'funds:submissions:{}' - base_view_name = 'serve_private_media' + url_name = "funds:submissions:{}" + base_view_name = "serve_private_media" def get_kwargs(self, instance): document_fields = list(instance.file_field_ids) field_id = document_fields[0] document = instance.data(field_id) return { - 'pk': instance.pk, - 'field_id': field_id, - 'file_name': document.basename, + "pk": instance.pk, + "field_id": field_id, + "file_name": document.basename, } @@ -1371,15 +1644,15 @@ def test_anonymous_can_not_access(self): self.assertEqual(response.status_code, 200) self.assertEqual(len(response.redirect_chain), 2) for path, _ in response.redirect_chain: - self.assertIn(reverse('users_public:login'), path) + self.assertIn(reverse("users_public:login"), path) class BaseProjectDeleteTestCase(BaseViewTestCase): - url_name = 'funds:submissions:reminders:{}' - base_view_name = 'delete' + url_name = "funds:submissions:reminders:{}" + base_view_name = "delete" def get_kwargs(self, instance): - return {'pk': instance.id, 'submission_pk': instance.submission.id} + return {"pk": instance.id, "submission_pk": instance.submission.id} class TestStaffReminderDeleteView(BaseProjectDeleteTestCase): @@ -1393,7 +1666,7 @@ def test_has_access(self): def test_confirm_message(self): reminder = ReminderFactory() response = self.get_page(reminder) - self.assertContains(response, 'Are you sure you want to delete') + self.assertContains(response, "Are you sure you want to delete") self.assertEqual(response.status_code, 200) @@ -1406,31 +1679,41 @@ def test_doesnt_has_access(self): self.assertEqual(response.status_code, 403) -@override_settings(ROOT_URLCONF='hypha.apply.urls') +@override_settings(ROOT_URLCONF="hypha.apply.urls") class TestReviewerLeaderboard(TestCase): def test_applicant_cannot_access_reviewer_leaderboard(self): self.client.force_login(ApplicantFactory()) - response = self.client.get('/apply/submissions/reviews/', follow=True, secure=True) + response = self.client.get( + "/apply/submissions/reviews/", follow=True, secure=True + ) self.assertEqual(response.status_code, 403) def test_community_reviewer_cannot_access_reviewer_leaderboard(self): self.client.force_login(CommunityReviewerFactory()) - response = self.client.get('/apply/submissions/reviews/', follow=True, secure=True) + response = self.client.get( + "/apply/submissions/reviews/", follow=True, secure=True + ) self.assertEqual(response.status_code, 403) def test_partner_cannot_access_reviewer_leaderboard(self): self.client.force_login(PartnerFactory()) - response = self.client.get('/apply/submissions/reviews/', follow=True, secure=True) + response = self.client.get( + "/apply/submissions/reviews/", follow=True, secure=True + ) self.assertEqual(response.status_code, 403) def test_reviewer_cannot_access_leader_board(self): self.client.force_login(ReviewerFactory()) - response = self.client.get('/apply/submissions/reviews/', follow=True, secure=True) + response = self.client.get( + "/apply/submissions/reviews/", follow=True, secure=True + ) self.assertEqual(response.status_code, 403) def test_staff_can_access_leaderboard(self): self.client.force_login(StaffFactory()) - response = self.client.get('/apply/submissions/reviews/', follow=True, secure=True) + response = self.client.get( + "/apply/submissions/reviews/", follow=True, secure=True + ) self.assertEqual(response.status_code, 200) @@ -1450,12 +1733,12 @@ def post_form(self, submission, reviewer_roles=None, reviewers=None): if reviewers is None: reviewers = [] data = { - 'form-submitted-reviewer_form': '', - 'reviewer_reviewers': [r.id for r in reviewers] + "form-submitted-reviewer_form": "", + "reviewer_reviewers": [r.id for r in reviewers], } data.update( **{ - f'role_reviewer_{str(role.id)}': reviewer.id + f"role_reviewer_{str(role.id)}": reviewer.id for role, reviewer in zip(self.roles, reviewer_roles, strict=False) } ) @@ -1467,10 +1750,7 @@ def test_submission_transition_all_reviewer_roles_not_assigned(self): submission = ApplicationSubmission.objects.get(id=submission.id) # Submission state shouldn't change when all_reviewer_roles_not_assigned - self.assertEqual( - submission.status, - INITIAL_STATE - ) + self.assertEqual(submission.status, INITIAL_STATE) def test_submission_transition_to_internal_review(self): submission = ApplicationSubmissionFactory(lead=self.user, status=INITIAL_STATE) @@ -1479,17 +1759,15 @@ def test_submission_transition_to_internal_review(self): # Automatically transition the application to "Internal review". self.assertEqual( - submission.status, - submission.workflow.stepped_phases[2][0].name + submission.status, submission.workflow.stepped_phases[2][0].name ) def test_submission_transition_to_proposal_internal_review(self): - submission = ApplicationSubmissionFactory(lead=self.user, status='proposal_discussion', workflow_stages=2) + submission = ApplicationSubmissionFactory( + lead=self.user, status="proposal_discussion", workflow_stages=2 + ) self.post_form(submission, reviewer_roles=[self.staff[0], self.staff[1]]) submission = ApplicationSubmission.objects.get(id=submission.id) # Automatically transition the application to "Internal review". - self.assertEqual( - submission.status, - 'proposal_internal_review' - ) + self.assertEqual(submission.status, "proposal_internal_review") diff --git a/hypha/apply/funds/tests/views/test_batch_progress.py b/hypha/apply/funds/tests/views/test_batch_progress.py index 5326d0fbe8..be42de8077 100644 --- a/hypha/apply/funds/tests/views/test_batch_progress.py +++ b/hypha/apply/funds/tests/views/test_batch_progress.py @@ -11,14 +11,14 @@ class BaseBatchProgressViewTestCase(BaseViewTestCase): - url_name = 'funds:submissions:{}' - base_view_name = 'list' + url_name = "funds:submissions:{}" + base_view_name = "list" def data(self, action, submissions): return { - 'form-submitted-batch_progress_form': 'Update', - 'action': action, - 'submissions': ','.join([str(submission.id) for submission in submissions]), + "form-submitted-batch_progress_form": "Update", + "action": action, + "submissions": ",".join([str(submission.id) for submission in submissions]), } @@ -27,82 +27,92 @@ class StaffTestCase(BaseBatchProgressViewTestCase): def test_can_progress_application(self): submission = ApplicationSubmissionFactory() - action = 'open-review' + action = "open-review" self.post_page(data=self.data(action, [submission])) submission = self.refresh(submission) - self.assertEqual(submission.status, 'internal_review') + self.assertEqual(submission.status, "internal_review") def test_can_progress_multiple_applications(self): submissions = ApplicationSubmissionFactory.create_batch(3) - action = 'open-review' + action = "open-review" self.post_page(data=self.data(action, submissions)) self.assertCountEqual( [self.refresh(submission).status for submission in submissions], - ['internal_review'] * 3, + ["internal_review"] * 3, ) def test_cant_progress_in_incorrect_state(self): submission = ApplicationSubmissionFactory() - action = 'close-review' + action = "close-review" self.post_page(data=self.data(action, [submission])) submission = self.refresh(submission) - self.assertEqual(submission.status, 'in_discussion') + self.assertEqual(submission.status, "in_discussion") def test_can_progress_one_in_mixed_state(self): bad_submission = ApplicationSubmissionFactory() - good_submission = ApplicationSubmissionFactory(status='internal_review') - action = 'close-review' + good_submission = ApplicationSubmissionFactory(status="internal_review") + action = "close-review" self.post_page(data=self.data(action, [good_submission, bad_submission])) good_submission = self.refresh(good_submission) bad_submission = self.refresh(bad_submission) - self.assertEqual(bad_submission.status, 'in_discussion') - self.assertEqual(good_submission.status, 'post_review_discussion') + self.assertEqual(bad_submission.status, "in_discussion") + self.assertEqual(good_submission.status, "post_review_discussion") def test_can_progress_different_states(self): submission = ApplicationSubmissionFactory() other_submission = InvitedToProposalFactory() - action = 'open-review' + action = "open-review" self.post_page(data=self.data(action, [submission, other_submission])) submission = self.refresh(submission) other_submission = self.refresh(other_submission) - self.assertEqual(submission.status, 'internal_review') - self.assertEqual(other_submission.status, 'proposal_internal_review') + self.assertEqual(submission.status, "internal_review") + self.assertEqual(other_submission.status, "proposal_internal_review") def test_mixed_determine_notifies(self): submission = ApplicationSubmissionFactory() - dismissed_submission = ApplicationSubmissionFactory(status='rejected') - DeterminationFactory(submission=dismissed_submission, rejected=True, submitted=True) - action = 'dismiss' - response = self.post_page(data=self.data(action, [submission, dismissed_submission])) - self.assertEqual(len(response.context['messages']), 1) + dismissed_submission = ApplicationSubmissionFactory(status="rejected") + DeterminationFactory( + submission=dismissed_submission, rejected=True, submitted=True + ) + action = "dismiss" + response = self.post_page( + data=self.data(action, [submission, dismissed_submission]) + ) + self.assertEqual(len(response.context["messages"]), 1) def test_determine_redirects(self): submission = ApplicationSubmissionFactory() - action = 'dismiss' + action = "dismiss" response = self.post_page(data=self.data(action, [submission])) - redirect_url = self.url_from_pattern('apply:submissions:determinations:batch', absolute=False) - self.assertEqual(response.request['PATH_INFO'][:len(redirect_url)], redirect_url) + redirect_url = self.url_from_pattern( + "apply:submissions:determinations:batch", absolute=False + ) + self.assertEqual( + response.request["PATH_INFO"][: len(redirect_url)], redirect_url + ) - @mock.patch('hypha.apply.funds.views.messenger') + @mock.patch("hypha.apply.funds.views.messenger") def test_messenger_not_called_with_failed(self, patched): submission = ApplicationSubmissionFactory() - action = 'close-review' + action = "close-review" self.post_page(data=self.data(action, [submission])) patched.assert_called_once() _, _, kwargs = patched.mock_calls[0] - self.assertQuerysetEqual(kwargs['sources'], ApplicationSubmission.objects.none()) + self.assertQuerysetEqual( + kwargs["sources"], ApplicationSubmission.objects.none() + ) - @mock.patch('hypha.apply.funds.views.messenger') + @mock.patch("hypha.apply.funds.views.messenger") def test_messenger_with_submission_in_review(self, patched): submission = ApplicationSubmissionFactory() - action = 'open-review' + action = "open-review" self.post_page(data=self.data(action, [submission])) self.assertEqual(patched.call_count, 2) _, _, kwargs = patched.mock_calls[0] - self.assertCountEqual(kwargs['sources'], [submission]) + self.assertCountEqual(kwargs["sources"], [submission]) _, _, kwargs = patched.mock_calls[1] - self.assertCountEqual(kwargs['sources'], [submission]) + self.assertCountEqual(kwargs["sources"], [submission]) class ReivewersTestCase(BaseBatchProgressViewTestCase): diff --git a/hypha/apply/funds/tests/views/test_batch_reviewers.py b/hypha/apply/funds/tests/views/test_batch_reviewers.py index b1145156f1..0ce01e4bfa 100644 --- a/hypha/apply/funds/tests/views/test_batch_reviewers.py +++ b/hypha/apply/funds/tests/views/test_batch_reviewers.py @@ -9,8 +9,8 @@ class BaseBatchReviewerTestCase(BaseViewTestCase): - url_name = 'funds:submissions:{}' - base_view_name = 'list' + url_name = "funds:submissions:{}" + base_view_name = "list" submissions = [] staff = None reviewers = [] @@ -25,13 +25,13 @@ def setUp(self): def data(self, reviewer_roles, submissions): data = { - 'form-submitted-batch_reviewer_form': 'Update', - 'submissions': ','.join([str(submission.id) for submission in submissions]), + "form-submitted-batch_reviewer_form": "Update", + "submissions": ",".join([str(submission.id) for submission in submissions]), } data.update( **{ - f'role_reviewer_{str(role.id)}': reviewer.id + f"role_reviewer_{str(role.id)}": reviewer.id for role, reviewer in zip(self.roles, reviewer_roles, strict=False) } ) @@ -51,8 +51,12 @@ def test_can_assign_role_reviewers(self): self.assertEqual(submission.assigned.first().role, self.roles[0]) def test_can_reassign_role_reviewers(self): - AssignedWithRoleReviewersFactory(reviewer=self.staff[1], submission=self.submissions[0], role=self.roles[0]) - AssignedWithRoleReviewersFactory(reviewer=self.staff[1], submission=self.submissions[1], role=self.roles[0]) + AssignedWithRoleReviewersFactory( + reviewer=self.staff[1], submission=self.submissions[0], role=self.roles[0] + ) + AssignedWithRoleReviewersFactory( + reviewer=self.staff[1], submission=self.submissions[1], role=self.roles[0] + ) submissions = self.submissions[0:2] reviewer_roles = [self.staff[0]] self.post_page(data=self.data(reviewer_roles, submissions)) @@ -62,8 +66,12 @@ def test_can_reassign_role_reviewers(self): self.assertEqual(submission.assigned.first().role, self.roles[0]) def test_can_reassign_from_other_role_reviewers(self): - AssignedWithRoleReviewersFactory(reviewer=self.staff[0], submission=self.submissions[0], role=self.roles[1]) - AssignedWithRoleReviewersFactory(reviewer=self.staff[0], submission=self.submissions[1], role=self.roles[1]) + AssignedWithRoleReviewersFactory( + reviewer=self.staff[0], submission=self.submissions[0], role=self.roles[1] + ) + AssignedWithRoleReviewersFactory( + reviewer=self.staff[0], submission=self.submissions[1], role=self.roles[1] + ) submissions = self.submissions[0:2] reviewer_roles = [self.staff[0]] self.post_page(data=self.data(reviewer_roles, submissions)) @@ -73,14 +81,26 @@ def test_can_reassign_from_other_role_reviewers(self): self.assertEqual(submission.assigned.first().role, self.roles[0]) def test_doesnt_remove_if_already_reviewed(self): - AssignedWithRoleReviewersFactory(reviewer=self.staff[1], submission=self.submissions[0], role=self.roles[0]) - ReviewFactory(author__reviewer=self.staff[1], author__staff=True, submission=self.submissions[0], draft=False) - ReviewFactory(author__reviewer=self.staff[1], author__staff=True, submission=self.submissions[1], draft=False) + AssignedWithRoleReviewersFactory( + reviewer=self.staff[1], submission=self.submissions[0], role=self.roles[0] + ) + ReviewFactory( + author__reviewer=self.staff[1], + author__staff=True, + submission=self.submissions[0], + draft=False, + ) + ReviewFactory( + author__reviewer=self.staff[1], + author__staff=True, + submission=self.submissions[1], + draft=False, + ) submissions = self.submissions[0:2] reviewer_roles = [self.staff[0]] self.post_page(data=self.data(reviewer_roles, submissions)) for submission in submissions: self.assertEqual(submission.assigned.count(), 2) - reviewers = submission.assigned.values_list('reviewer', flat=True) + reviewers = submission.assigned.values_list("reviewer", flat=True) self.assertIn(self.staff[0].pk, reviewers) self.assertIn(self.staff[1].pk, reviewers) diff --git a/hypha/apply/funds/tests/views/test_rounds.py b/hypha/apply/funds/tests/views/test_rounds.py index 4607b78fa9..69c68299c9 100644 --- a/hypha/apply/funds/tests/views/test_rounds.py +++ b/hypha/apply/funds/tests/views/test_rounds.py @@ -4,8 +4,8 @@ class BaseAllRoundsViewTestCase(BaseViewTestCase): - url_name = 'funds:rounds:{}' - base_view_name = 'list' + url_name = "funds:rounds:{}" + base_view_name = "list" class TestStaffRoundPage(BaseAllRoundsViewTestCase): @@ -33,14 +33,14 @@ def test_cant_access_page(self): class ByRoundTestCase(BaseViewTestCase): - url_name = 'apply:rounds:{}' - base_view_name = 'detail' + url_name = "apply:rounds:{}" + base_view_name = "detail" def get_kwargs(self, instance): try: - return {'pk': instance.id} + return {"pk": instance.id} except AttributeError: - return {'pk': instance['id']} + return {"pk": instance["id"]} class TestStaffSubmissionByRound(ByRoundTestCase): @@ -63,7 +63,7 @@ def test_cant_access_normal_page(self): self.assertEqual(response.status_code, 404) def test_cant_access_non_existing_page(self): - response = self.get_page({'id': 555}) + response = self.get_page({"id": 555}) self.assertEqual(response.status_code, 404) @@ -87,5 +87,5 @@ def test_cant_access_normal_page(self): self.assertEqual(response.status_code, 403) def test_cant_access_non_existing_page(self): - response = self.get_page({'id': 555}) + response = self.get_page({"id": 555}) self.assertEqual(response.status_code, 403) diff --git a/hypha/apply/funds/urls.py b/hypha/apply/funds/urls.py index d241b31757..87809e3ec2 100644 --- a/hypha/apply/funds/urls.py +++ b/hypha/apply/funds/urls.py @@ -49,82 +49,186 @@ sub_menu_update_status, ) -revision_urls = ([ - path('', RevisionListView.as_view(), name='list'), - path('compare///', RevisionCompareView.as_view(), name='compare'), -], 'revisions') +revision_urls = ( + [ + path("", RevisionListView.as_view(), name="list"), + path( + "compare///", + RevisionCompareView.as_view(), + name="compare", + ), + ], + "revisions", +) -reminders_urls = ([ - path('/delete/', ReminderDeleteView.as_view(), name="delete"), -], 'reminders') +reminders_urls = ( + [ + path("/delete/", ReminderDeleteView.as_view(), name="delete"), + ], + "reminders", +) -app_name = 'funds' +app_name = "funds" -submission_urls = ([ - path('', SubmissionOverviewView.as_view(), name="overview"), - path('all/', SubmissionListView.as_view(), name="list"), - path('all-beta/', submission_all_beta, name="list-beta"), - path('all-beta/bulk_archive/', bulk_archive_submissions, name="bulk-archive"), - path('all-beta/bulk_delete/', bulk_delete_submissions, name="bulk-delete"), - path('all-beta/bulk_update_status/', bulk_update_submissions_status, name="bulk-update-status"), - path('all-beta/submenu/funds/', sub_menu_funds, name="submenu-funds"), - path('all-beta/submenu/leads/', sub_menu_leads, name="submenu-leads"), - path('all-beta/submenu/rounds/', sub_menu_rounds, name="submenu-rounds"), - path('all-beta/submenu/reviewers/', sub_menu_reviewers, name="submenu-reviewers"), - path('all-beta/submenu/meta-terms/', sub_menu_meta_terms, name="submenu-meta-terms"), - path('all-beta/submenu/bulk-update-status/', sub_menu_update_status, name="submenu-update-status"), - path('all-beta/submenu/bulk-update-lead/', sub_menu_bulk_update_lead, name="submenu-bulk-update-lead"), - path('all-beta/submenu/bulk-update-reviewers/', sub_menu_bulk_update_reviewers, name="submenu-bulk-update-reviewers"), - path('all-beta/submenu/category-options/', sub_menu_category_options, name="submenu-category-options"), - path('all-beta/partials/review_decisions/', partial_reviews_decisions, name="partial-reviews-decisions"), - path('summary/', GroupingApplicationsListView.as_view(), name="summary"), - path('result/', SubmissionResultView.as_view(), name="result"), - path('flagged/', include([ - path('', SubmissionUserFlaggedView.as_view(), name="flagged"), - path('staff/', SubmissionStaffFlaggedView.as_view(), name="staff_flagged"), - ])), - path('reviews/', include([ - path('', ReviewerLeaderboard.as_view(), name="reviewer_leaderboard"), - path('/', ReviewerLeaderboardDetail.as_view(), name="reviewer_leaderboard_detail"), - ])), - path('awaiting_review/', AwaitingReviewSubmissionsListView.as_view(), name="awaiting_review"), - path('assignments/', include([ - path('staff/', StaffAssignments.as_view(), name="staff_assignments"), - ])), - path('/', include([ - path('', SubmissionDetailView.as_view(), name="detail"), - path('partial/activities/', partial_submission_activities, name="partial-activities"), - path('partial/reviews-card/', partial_reviews_card, name="partial-reviews-card"), - path('edit/', SubmissionEditView.as_view(), name="edit"), - path('sealed/', SubmissionSealedView.as_view(), name="sealed"), - path('simplified/', SubmissionDetailSimplifiedView.as_view(), name="simplified"), - path('download/', SubmissionDetailPDFView.as_view(), name="download"), - path('delete/', SubmissionDeleteView.as_view(), name="delete"), - path( - 'documents//', - SubmissionPrivateMediaView.as_view(), name='serve_private_media' - ), - ])), - path('/', include([ - path('', include('hypha.apply.review.urls', namespace="reviews")), - path('revisions/', include(revision_urls, namespace="revisions")), - path('reminders/', include(reminders_urls, namespace="reminders")), - ])), - path('', include('hypha.apply.determinations.urls', namespace="determinations")), - path('', include('hypha.apply.flags.urls', namespace="flags")), - path('/', SubmissionsByStatus.as_view(), name='status'), -], 'submissions') +submission_urls = ( + [ + path("", SubmissionOverviewView.as_view(), name="overview"), + path("all/", SubmissionListView.as_view(), name="list"), + path("all-beta/", submission_all_beta, name="list-beta"), + path("all-beta/bulk_archive/", bulk_archive_submissions, name="bulk-archive"), + path("all-beta/bulk_delete/", bulk_delete_submissions, name="bulk-delete"), + path( + "all-beta/bulk_update_status/", + bulk_update_submissions_status, + name="bulk-update-status", + ), + path("all-beta/submenu/funds/", sub_menu_funds, name="submenu-funds"), + path("all-beta/submenu/leads/", sub_menu_leads, name="submenu-leads"), + path("all-beta/submenu/rounds/", sub_menu_rounds, name="submenu-rounds"), + path( + "all-beta/submenu/reviewers/", sub_menu_reviewers, name="submenu-reviewers" + ), + path( + "all-beta/submenu/meta-terms/", + sub_menu_meta_terms, + name="submenu-meta-terms", + ), + path( + "all-beta/submenu/bulk-update-status/", + sub_menu_update_status, + name="submenu-update-status", + ), + path( + "all-beta/submenu/bulk-update-lead/", + sub_menu_bulk_update_lead, + name="submenu-bulk-update-lead", + ), + path( + "all-beta/submenu/bulk-update-reviewers/", + sub_menu_bulk_update_reviewers, + name="submenu-bulk-update-reviewers", + ), + path( + "all-beta/submenu/category-options/", + sub_menu_category_options, + name="submenu-category-options", + ), + path( + "all-beta/partials/review_decisions/", + partial_reviews_decisions, + name="partial-reviews-decisions", + ), + path("summary/", GroupingApplicationsListView.as_view(), name="summary"), + path("result/", SubmissionResultView.as_view(), name="result"), + path( + "flagged/", + include( + [ + path("", SubmissionUserFlaggedView.as_view(), name="flagged"), + path( + "staff/", + SubmissionStaffFlaggedView.as_view(), + name="staff_flagged", + ), + ] + ), + ), + path( + "reviews/", + include( + [ + path( + "", ReviewerLeaderboard.as_view(), name="reviewer_leaderboard" + ), + path( + "/", + ReviewerLeaderboardDetail.as_view(), + name="reviewer_leaderboard_detail", + ), + ] + ), + ), + path( + "awaiting_review/", + AwaitingReviewSubmissionsListView.as_view(), + name="awaiting_review", + ), + path( + "assignments/", + include( + [ + path( + "staff/", StaffAssignments.as_view(), name="staff_assignments" + ), + ] + ), + ), + path( + "/", + include( + [ + path("", SubmissionDetailView.as_view(), name="detail"), + path( + "partial/activities/", + partial_submission_activities, + name="partial-activities", + ), + path( + "partial/reviews-card/", + partial_reviews_card, + name="partial-reviews-card", + ), + path("edit/", SubmissionEditView.as_view(), name="edit"), + path("sealed/", SubmissionSealedView.as_view(), name="sealed"), + path( + "simplified/", + SubmissionDetailSimplifiedView.as_view(), + name="simplified", + ), + path( + "download/", SubmissionDetailPDFView.as_view(), name="download" + ), + path("delete/", SubmissionDeleteView.as_view(), name="delete"), + path( + "documents//", + SubmissionPrivateMediaView.as_view(), + name="serve_private_media", + ), + ] + ), + ), + path( + "/", + include( + [ + path("", include("hypha.apply.review.urls", namespace="reviews")), + path("revisions/", include(revision_urls, namespace="revisions")), + path("reminders/", include(reminders_urls, namespace="reminders")), + ] + ), + ), + path( + "", include("hypha.apply.determinations.urls", namespace="determinations") + ), + path("", include("hypha.apply.flags.urls", namespace="flags")), + path("/", SubmissionsByStatus.as_view(), name="status"), + ], + "submissions", +) -rounds_urls = ([ - path('', RoundListView.as_view(), name="list"), - path('/', SubmissionsByRound.as_view(), name="detail"), - path('export//', ExportSubmissionsByRound.as_view(), name="export"), -], 'rounds') +rounds_urls = ( + [ + path("", RoundListView.as_view(), name="list"), + path("/", SubmissionsByRound.as_view(), name="detail"), + path("export//", ExportSubmissionsByRound.as_view(), name="export"), + ], + "rounds", +) urlpatterns = [ - path('submissions/', include(submission_urls)), - path('rounds/', include(rounds_urls)), - path('projects/', include(projects_urls)), + path("submissions/", include(submission_urls)), + path("rounds/", include(rounds_urls)), + path("projects/", include(projects_urls)), ] diff --git a/hypha/apply/funds/utils.py b/hypha/apply/funds/utils.py index 1cf0fd8377..6acf5f8e80 100644 --- a/hypha/apply/funds/utils.py +++ b/hypha/apply/funds/utils.py @@ -7,8 +7,8 @@ def render_icon(image): if not image: - return '' - filter_spec = 'fill-20x20' + return "" + filter_spec = "fill-20x20" return generate_image_tag(image, filter_spec, html_class="icon mr-2 align-middle") @@ -60,7 +60,7 @@ def model_form_initial(instance, fields=None, exclude=None): opts = instance._meta data = {} for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many): - if not getattr(f, 'editable', False): + if not getattr(f, "editable", False): continue if fields and f.name not in fields: continue diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 81c2139f8c..6d1dfc465a 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -129,12 +129,12 @@ def get_context_data(self, **kwargs): review_my_count = submissions.reviewed_by(self.request.user).count() submission_value = submissions.current().value() - submission_sum = intcomma(submission_value.get('value__sum')) - submission_count = submission_value.get('value__count') + submission_sum = intcomma(submission_value.get("value__sum")) + submission_count = submission_value.get("value__count") submission_accepted = submissions.current_accepted() submission_accepted_value = submission_accepted.value() - submission_accepted_sum = intcomma(submission_accepted_value.get('value__sum')) + submission_accepted_sum = intcomma(submission_accepted_value.get("value__sum")) submission_accepted_count = submission_accepted.count() reviews = Review.objects.submitted() @@ -157,18 +157,16 @@ def get_context_data(self, **kwargs): class BaseAdminSubmissionsTable(SingleTableMixin, FilterView): table_class = AdminSubmissionsTable filterset_class = SubmissionFilterAndSearch - filter_action = '' - search_action = '' + filter_action = "" + search_action = "" paginator_class = LazyPaginator - table_pagination = {'per_page': 25} + table_pagination = {"per_page": 25} excluded_fields = settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS @property def excluded(self): - return { - 'exclude': self.excluded_fields - } + return {"exclude": self.excluded_fields} def get_table_kwargs(self, **kwargs): return {**self.excluded, **kwargs} @@ -180,7 +178,9 @@ def get_filterset_kwargs(self, filterset_class, **kwargs): return new_kwargs def get_queryset(self): - submissions = self.filterset_class._meta.model.objects.current().for_table(self.request.user) + submissions = self.filterset_class._meta.model.objects.current().for_table( + self.request.user + ) if not can_access_drafts(self.request.user): submissions = submissions.exclude_draft() @@ -188,7 +188,7 @@ def get_queryset(self): return submissions def get_context_data(self, **kwargs): - search_term = self.request.GET.get('query') + search_term = self.request.GET.get("query") return super().get_context_data( search_term=search_term, @@ -198,38 +198,40 @@ def get_context_data(self, **kwargs): ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class BatchUpdateLeadView(DelegatedViewMixin, FormView): form_class = BatchUpdateSubmissionLeadForm - context_name = 'batch_lead_form' + context_name = "batch_lead_form" def form_valid(self, form): - new_lead = form.cleaned_data['lead'] - submissions = form.cleaned_data['submissions'] + new_lead = form.cleaned_data["lead"] + submissions = form.cleaned_data["submissions"] services.bulk_update_lead( submissions=submissions, user=self.request.user, lead=new_lead, - request=self.request + request=self.request, ) return super().form_valid(form) def form_invalid(self, form): - messages.error(self.request, mark_safe(_('Sorry something went wrong') + form.errors.as_ul())) + messages.error( + self.request, + mark_safe(_("Sorry something went wrong") + form.errors.as_ul()), + ) return super().form_invalid(form) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class BatchUpdateReviewersView(DelegatedViewMixin, FormView): form_class = BatchUpdateReviewersForm - context_name = 'batch_reviewer_form' + context_name = "batch_reviewer_form" def form_valid(self, form): - submissions = form.cleaned_data['submissions'] - external_reviewers = form.cleaned_data['external_reviewers'] + submissions = form.cleaned_data["submissions"] + external_reviewers = form.cleaned_data["external_reviewers"] assigned_roles = { - role: form.cleaned_data[field] - for field, role in form.role_fields.items() + role: form.cleaned_data[field] for field, role in form.role_fields.items() } services.bulk_update_reviewers( submissions=submissions, @@ -242,17 +244,20 @@ def form_valid(self, form): return super().form_valid(form) def form_invalid(self, form): - messages.error(self.request, mark_safe(_('Sorry something went wrong') + form.errors.as_ul())) + messages.error( + self.request, + mark_safe(_("Sorry something went wrong") + form.errors.as_ul()), + ) return super().form_invalid(form) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class BatchDeleteSubmissionView(DelegatedViewMixin, FormView): form_class = BatchDeleteSubmissionForm - context_name = 'batch_delete_submission_form' + context_name = "batch_delete_submission_form" def form_valid(self, form): - submissions = form.cleaned_data['submissions'] + submissions = form.cleaned_data["submissions"] services.bulk_delete_submissions( submissions=submissions, user=self.request.user, @@ -261,17 +266,20 @@ def form_valid(self, form): return super().form_valid(form) def form_invalid(self, form): - messages.error(self.request, mark_safe(_('Sorry something went wrong') + form.errors.as_ul())) + messages.error( + self.request, + mark_safe(_("Sorry something went wrong") + form.errors.as_ul()), + ) return super().form_invalid(form) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class BatchArchiveSubmissionView(DelegatedViewMixin, FormView): form_class = BatchArchiveSubmissionForm - context_name = 'batch_archive_submission_form' + context_name = "batch_archive_submission_form" def form_valid(self, form): - submissions = form.cleaned_data['submissions'] + submissions = form.cleaned_data["submissions"] services.bulk_archive_submissions( submissions=submissions, user=self.request.user, @@ -280,23 +288,28 @@ def form_valid(self, form): return super().form_valid(form) def form_invalid(self, form): - messages.error(self.request, mark_safe(_('Sorry something went wrong') + form.errors.as_ul())) + messages.error( + self.request, + mark_safe(_("Sorry something went wrong") + form.errors.as_ul()), + ) return super().form_invalid(form) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class BatchProgressSubmissionView(DelegatedViewMixin, FormView): form_class = BatchProgressSubmissionForm - context_name = 'batch_progress_form' + context_name = "batch_progress_form" def form_valid(self, form): - submissions = form.cleaned_data['submissions'] - transitions = form.cleaned_data.get('action') + submissions = form.cleaned_data["submissions"] + transitions = form.cleaned_data.get("action") try: - redirect = BatchDeterminationCreateView.should_redirect(self.request, submissions, transitions) + redirect = BatchDeterminationCreateView.should_redirect( + self.request, submissions, transitions + ) except ValueError as e: - messages.warning(self.request, 'Could not determine: ' + str(e)) + messages.warning(self.request, "Could not determine: " + str(e)) return self.form_invalid(form) else: if redirect: @@ -305,7 +318,10 @@ def form_valid(self, form): failed = [] phase_changes = {} for submission in submissions: - valid_actions = {action for action, _ in submission.get_actions_for_user(self.request.user)} + valid_actions = { + action + for action, _ in submission.get_actions_for_user(self.request.user) + } old_phase = submission.phase try: transition = (valid_actions & set(transitions)).pop() @@ -323,11 +339,13 @@ def form_valid(self, form): if failed: messages.warning( self.request, - _('Failed to update: ') + - ', '.join(str(submission) for submission in failed) + _("Failed to update: ") + + ", ".join(str(submission) for submission in failed), ) - succeeded_submissions = submissions.exclude(id__in=[submission.id for submission in failed]) + succeeded_submissions = submissions.exclude( + id__in=[submission.id for submission in failed] + ) messenger( MESSAGES.BATCH_TRANSITION, user=self.request.user, @@ -336,10 +354,7 @@ def form_valid(self, form): related=phase_changes, ) - ready_for_review = [ - phase for phase in transitions - if phase in review_statuses - ] + ready_for_review = [phase for phase in transitions if phase in review_statuses] if ready_for_review: messenger( MESSAGES.BATCH_READY_FOR_REVIEW, @@ -356,75 +371,91 @@ class BaseReviewerSubmissionsTable(BaseAdminSubmissionsTable): filterset_class = SubmissionReviewerFilterAndSearch def get_queryset(self): - ''' + """ If use_settings variable is set for ReviewerSettings use settings parameters to filter submissions or return only reviewed_by as it was by default. - ''' + """ reviewer_settings = ReviewerSettings.for_request(self.request) if reviewer_settings.use_settings: - return super().get_queryset().for_reviewer_settings( - self.request.user, reviewer_settings - ).order_by('-submit_time') + return ( + super() + .get_queryset() + .for_reviewer_settings(self.request.user, reviewer_settings) + .order_by("-submit_time") + ) return super().get_queryset().reviewed_by(self.request.user) -@method_decorator(login_required, name='dispatch') +@method_decorator(login_required, name="dispatch") class AwaitingReviewSubmissionsListView(SingleTableMixin, ListView): model = ApplicationSubmission table_class = AdminSubmissionsTable - template_name = 'funds/submissions_awaiting_review.html' + template_name = "funds/submissions_awaiting_review.html" paginator_class = LazyPaginator - table_pagination = {'per_page': 25} + table_pagination = {"per_page": 25} excluded_fields = settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS @property def excluded(self): - return { - 'exclude': self.excluded_fields - } + return {"exclude": self.excluded_fields} def get_table_kwargs(self, **kwargs): return {**self.excluded, **kwargs} def get_queryset(self): - submissions = ApplicationSubmission.objects.in_review_for(self.request.user).order_by('-submit_time') + submissions = ApplicationSubmission.objects.in_review_for( + self.request.user + ).order_by("-submit_time") return submissions.for_table(self.request.user) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class SubmissionOverviewView(BaseAdminSubmissionsTable): - template_name = 'funds/submissions_overview.html' + template_name = "funds/submissions_overview.html" table_class = SummarySubmissionsTable table_pagination = False - filter_action = reverse_lazy('funds:submissions:list') - search_action = reverse_lazy('funds:submissions:list') + filter_action = reverse_lazy("funds:submissions:list") + search_action = reverse_lazy("funds:submissions:list") def get_table_data(self): limit = 5 - return super().get_table_data().order_by(F('last_update').desc(nulls_last=True))[:limit] + return ( + super() + .get_table_data() + .order_by(F("last_update").desc(nulls_last=True))[:limit] + ) def get_context_data(self, **kwargs): limit = 6 - base_query = RoundsAndLabs.objects.with_progress().active().order_by('-end_date') + base_query = ( + RoundsAndLabs.objects.with_progress().active().order_by("-end_date") + ) open_rounds = base_query.open()[:limit] - open_query = '?round_state=open' + open_query = "?round_state=open" closed_rounds = base_query.closed()[:limit] - closed_query = '?round_state=closed' - rounds_title = 'All Rounds and Labs' + closed_query = "?round_state=closed" + rounds_title = "All Rounds and Labs" status_counts = dict( - ApplicationSubmission.objects.current().values('status').annotate( - count=Count('status'), - ).values_list('status', 'count') + ApplicationSubmission.objects.current() + .values("status") + .annotate( + count=Count("status"), + ) + .values_list("status", "count") ) grouped_statuses = { status: { - 'name': data['name'], - 'count': sum(status_counts.get(status, 0) for status in data['statuses']), - 'url': reverse_lazy("funds:submissions:status", kwargs={'status': status}) + "name": data["name"], + "count": sum( + status_counts.get(status, 0) for status in data["statuses"] + ), + "url": reverse_lazy( + "funds:submissions:status", kwargs={"status": status} + ), } for status, data in PHASES_MAPPING.items() } @@ -443,18 +474,25 @@ def get_context_data(self, **kwargs): ) def get_staff_flagged(self): - qs = super().get_queryset().flagged_staff().order_by('-submit_time') - row_attrs = dict({'data-flag-type': 'staff'}, **SummarySubmissionsTable._meta.row_attrs) + qs = super().get_queryset().flagged_staff().order_by("-submit_time") + row_attrs = dict( + {"data-flag-type": "staff"}, **SummarySubmissionsTable._meta.row_attrs + ) limit = 5 return { - 'table': SummarySubmissionsTable(qs[:limit], prefix='staff-flagged-', attrs={'class': 'all-submissions-table flagged-table'}, row_attrs=row_attrs), - 'display_more': qs.count() > limit, + "table": SummarySubmissionsTable( + qs[:limit], + prefix="staff-flagged-", + attrs={"class": "all-submissions-table flagged-table"}, + row_attrs=row_attrs, + ), + "display_more": qs.count() > limit, } class SubmissionAdminListView(BaseAdminSubmissionsTable, DelegateableListView): - template_name = 'funds/submissions.html' + template_name = "funds/submissions.html" form_views = [ BatchUpdateLeadView, BatchUpdateReviewersView, @@ -465,17 +503,23 @@ class SubmissionAdminListView(BaseAdminSubmissionsTable, DelegateableListView): def get_filterset_kwargs(self, filterset_class, **kwargs): new_kwargs = super().get_filterset_kwargs(filterset_class) - archived_kwargs = {'archived': self.request.GET.get('archived', 0)} + archived_kwargs = {"archived": self.request.GET.get("archived", 0)} new_kwargs.update(archived_kwargs) new_kwargs.update(kwargs) return new_kwargs def get_queryset(self): - if self.request.GET.get('archived'): + if self.request.GET.get("archived"): # if archived is in param, let archived filter handle the queryset as per its value. - submissions = self.filterset_class._meta.model.objects.include_archive().for_table(self.request.user) + submissions = ( + self.filterset_class._meta.model.objects.include_archive().for_table( + self.request.user + ) + ) else: - submissions = self.filterset_class._meta.model.objects.current().for_table(self.request.user) + submissions = self.filterset_class._meta.model.objects.current().for_table( + self.request.user + ) if not can_access_drafts(self.request.user): submissions = submissions.exclude_draft() @@ -491,16 +535,17 @@ def get_context_data(self, **kwargs): ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class GroupingApplicationsListView(TemplateView): - ''' + """ Template view for grouped submissions - ''' - template_name = 'funds/grouped_application_list.html' + """ + + template_name = "funds/grouped_application_list.html" class SubmissionReviewerListView(BaseReviewerSubmissionsTable): - template_name = 'funds/submissions.html' + template_name = "funds/submissions.html" class SubmissionListView(ViewDispatcher): @@ -508,45 +553,55 @@ class SubmissionListView(ViewDispatcher): reviewer_view = SubmissionReviewerListView -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class SubmissionStaffFlaggedView(BaseAdminSubmissionsTable): - template_name = 'funds/submissions_staff_flagged.html' + template_name = "funds/submissions_staff_flagged.html" def get_queryset(self): - return self.filterset_class._meta.model.objects.current().for_table(self.request.user).flagged_staff().order_by('-submit_time') + return ( + self.filterset_class._meta.model.objects.current() + .for_table(self.request.user) + .flagged_staff() + .order_by("-submit_time") + ) -@method_decorator(login_required, name='dispatch') +@method_decorator(login_required, name="dispatch") class SubmissionUserFlaggedView(UserPassesTestMixin, BaseAdminSubmissionsTable): - template_name = 'funds/submissions_user_flagged.html' + template_name = "funds/submissions_user_flagged.html" def get_queryset(self): - return self.filterset_class._meta.model.objects.current().for_table(self.request.user).flagged_by(self.request.user).order_by('-submit_time') + return ( + self.filterset_class._meta.model.objects.current() + .for_table(self.request.user) + .flagged_by(self.request.user) + .order_by("-submit_time") + ) def test_func(self): return self.request.user.is_apply_staff or self.request.user.is_reviewer -@method_decorator(staff_required, name='dispatch') -class ExportSubmissionsByRound(BaseAdminSubmissionsTable): +@method_decorator(staff_required, name="dispatch") +class ExportSubmissionsByRound(BaseAdminSubmissionsTable): def export_submissions(self, round_id): csv_stream = StringIO() writer = csv.writer(csv_stream) - header_row,values = [],[] + header_row, values = [], [] index = 0 check = False for submission in ApplicationSubmission.objects.filter(round=round_id): for field_id in submission.question_text_field_ids: question_field = submission.serialize(field_id) - field_name = question_field['question'] - field_value = question_field['answer'] + field_name = question_field["question"] + field_value = question_field["answer"] if field_id not in submission.named_blocks: header_row.append(field_name) if not check else header_row values.append(field_value) else: - header_row.insert(index,field_name) if not check else header_row - values.insert(index,field_value) + header_row.insert(index, field_name) if not check else header_row + values.insert(index, field_value) index = index + 1 if not check: @@ -562,7 +617,7 @@ def export_submissions(self, round_id): def get_queryset(self): try: - self.obj = Page.objects.get(pk=self.kwargs.get('pk')).specific + self.obj = Page.objects.get(pk=self.kwargs.get("pk")).specific except Page.DoesNotExist as exc: raise Http404(_("No Round or Lab found matching the query")) from exc @@ -574,12 +629,13 @@ def get(self, request, pk): self.get_queryset() csv_data = self.export_submissions(pk) response = HttpResponse(csv_data.readlines(), content_type="text/csv") - response['Content-Disposition'] = 'inline; filename=' + str(self.obj) + '.csv' + response["Content-Disposition"] = "inline; filename=" + str(self.obj) + ".csv" return response -@method_decorator(staff_required, name='dispatch') + +@method_decorator(staff_required, name="dispatch") class SubmissionsByRound(BaseAdminSubmissionsTable, DelegateableListView): - template_name = 'funds/submissions_by_round.html' + template_name = "funds/submissions_by_round.html" form_views = [ BatchUpdateLeadView, BatchUpdateReviewersView, @@ -588,17 +644,17 @@ class SubmissionsByRound(BaseAdminSubmissionsTable, DelegateableListView): BatchArchiveSubmissionView, ] - excluded_fields = ['round', 'fund'] + settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS + excluded_fields = ["round", "fund"] + settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS def get_form_kwargs(self): kwargs = super().get_form_kwargs() - kwargs['round'] = self.obj + kwargs["round"] = self.obj return kwargs def get_queryset(self): # We want to only show lab or Rounds in this view, their base class is Page try: - self.obj = Page.objects.get(pk=self.kwargs.get('pk')).specific + self.obj = Page.objects.get(pk=self.kwargs.get("pk")).specific except Page.DoesNotExist as e: raise Http404(_("No Round or Lab found matching the query")) from e @@ -610,9 +666,9 @@ def get_context_data(self, **kwargs): return super().get_context_data(object=self.obj, **kwargs) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class SubmissionsByStatus(BaseAdminSubmissionsTable, DelegateableListView): - template_name = 'funds/submissions_by_status.html' + template_name = "funds/submissions_by_status.html" status_mapping = PHASES_MAPPING form_views = [ BatchUpdateLeadView, @@ -623,17 +679,19 @@ class SubmissionsByStatus(BaseAdminSubmissionsTable, DelegateableListView): ] def dispatch(self, request, *args, **kwargs): - self.status = kwargs.get('status') + self.status = kwargs.get("status") try: status_data = self.status_mapping[self.status] except KeyError: raise Http404(_("No statuses match the requested value")) from None - self.status_name = status_data['name'] - self.statuses = status_data['statuses'] + self.status_name = status_data["name"] + self.statuses = status_data["statuses"] return super().dispatch(request, *args, **kwargs) def get_filterset_kwargs(self, filterset_class, **kwargs): - return super().get_filterset_kwargs(filterset_class, limit_statuses=self.statuses, **kwargs) + return super().get_filterset_kwargs( + filterset_class, limit_statuses=self.statuses, **kwargs + ) def get_queryset(self): return super().get_queryset().filter(status__in=self.statuses) @@ -646,24 +704,28 @@ def get_context_data(self, **kwargs): ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ProgressSubmissionView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = ProgressSubmissionForm - context_name = 'progress_form' + context_name = "progress_form" def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) return super(ProgressSubmissionView, self).dispatch(request, *args, **kwargs) def form_valid(self, form): - action = form.cleaned_data.get('action') + action = form.cleaned_data.get("action") # Defer to the determination form for any of the determination transitions - redirect = DeterminationCreateOrUpdateView.should_redirect(self.request, self.object, action) + redirect = DeterminationCreateOrUpdateView.should_redirect( + self.request, self.object, action + ) if redirect: return redirect @@ -671,15 +733,17 @@ def form_valid(self, form): return super().form_valid(form) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class CreateProjectView(DelegatedViewMixin, CreateView): - context_name = 'project_form' + context_name = "project_form" form_class = CreateProjectForm model = Project def dispatch(self, request, *args, **kwargs): submission = self.get_parent_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) @@ -701,19 +765,21 @@ def form_valid(self, form): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['action_message'] = _('Project Created!') + context["action_message"] = _("Project Created!") return context -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ScreeningSubmissionView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = ScreeningSubmissionForm - context_name = 'screening_form' + context_name = "screening_form" def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) @@ -728,16 +794,16 @@ def form_valid(self, form): request=self.request, user=self.request.user, source=self.object, - related=', '.join([s.title for s in old.screening_statuses.all()]), + related=", ".join([s.title for s in old.screening_statuses.all()]), ) return response -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class UnarchiveSubmissionView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = UnarchiveSubmissionForm - context_name = 'unarchive_form' + context_name = "unarchive_form" def form_valid(self, form): response = super().form_valid(form) @@ -746,7 +812,7 @@ def form_valid(self, form): MESSAGES.UNARCHIVE_SUBMISSION, request=self.request, user=self.request.user, - source=self.object + source=self.object, ) return response @@ -754,11 +820,11 @@ def get_success_url(self): return self.object.get_absolute_url() -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ArchiveSubmissionView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = ArchiveSubmissionForm - context_name = 'archive_form' + context_name = "archive_form" def form_valid(self, form): response = super().form_valid(form) @@ -776,15 +842,17 @@ def get_success_url(self): return self.object.get_absolute_url() -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class UpdateLeadView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = UpdateSubmissionLeadForm - context_name = 'lead_form' + context_name = "lead_form" def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) @@ -804,25 +872,24 @@ def form_valid(self, form): return response -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class UpdateReviewersView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = UpdateReviewersForm - context_name = 'reviewer_form' + context_name = "reviewer_form" def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) return super(UpdateReviewersView, self).dispatch(request, *args, **kwargs) def form_valid(self, form): - old_reviewers = { - copy(reviewer) - for reviewer in form.instance.assigned.all() - } + old_reviewers = {copy(reviewer) for reviewer in form.instance.assigned.all()} response = super().form_valid(form) new_reviewers = set(form.instance.assigned.all()) @@ -833,30 +900,30 @@ def form_valid(self, form): MESSAGES.REVIEWERS_UPDATED, request=self.request, user=self.request.user, - source=self.kwargs['object'], + source=self.kwargs["object"], added=added, removed=removed, ) # Update submission status if needed. services.set_status_after_reviewers_assigned( - submission=form.instance, - updated_by=self.request.user, - request=self.request + submission=form.instance, updated_by=self.request.user, request=self.request ) return response -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class UpdatePartnersView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = UpdatePartnersForm - context_name = 'partner_form' + context_name = "partner_form" def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) @@ -874,7 +941,7 @@ def form_valid(self, form): MESSAGES.PARTNERS_UPDATED, request=self.request, user=self.request.user, - source=self.kwargs['object'], + source=self.kwargs["object"], added=added, removed=removed, ) @@ -883,7 +950,7 @@ def form_valid(self, form): MESSAGES.PARTNERS_UPDATED_PARTNER, request=self.request, user=self.request.user, - source=self.kwargs['object'], + source=self.kwargs["object"], added=added, removed=removed, ) @@ -891,30 +958,34 @@ def form_valid(self, form): return response -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class UpdateMetaTermsView(DelegatedViewMixin, UpdateView): model = ApplicationSubmission form_class = UpdateMetaTermsForm - context_name = 'meta_terms_form' + context_name = "meta_terms_form" def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) return super(UpdateMetaTermsView, self).dispatch(request, *args, **kwargs) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ReminderCreateView(DelegatedViewMixin, CreateView): - context_name = 'reminder_form' + context_name = "reminder_form" form_class = CreateReminderForm model = Reminder def dispatch(self, request, *args, **kwargs): submission = self.get_parent_object() - permission, reason = has_permission('submission_edit', request.user, object=submission, raise_exception=False) + permission, reason = has_permission( + "submission_edit", request.user, object=submission, raise_exception=False + ) if not permission: messages.warning(self.request, reason) return HttpResponseRedirect(submission.get_absolute_url()) @@ -934,13 +1005,15 @@ def form_valid(self, form): return response -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ReminderDeleteView(DeleteView): model = Reminder def get_success_url(self): - submission = get_object_or_404(ApplicationSubmission, id=self.kwargs['submission_pk']) - return reverse_lazy('funds:submissions:detail', args=(submission.id,)) + submission = get_object_or_404( + ApplicationSubmission, id=self.kwargs["submission_pk"] + ) + return reverse_lazy("funds:submissions:detail", args=(submission.id,)) def delete(self, request, *args, **kwargs): reminder = self.get_object() @@ -956,7 +1029,7 @@ def delete(self, request, *args, **kwargs): class AdminSubmissionDetailView(ActivityContextMixin, DelegateableView, DetailView): - template_name_suffix = '_admin_detail' + template_name_suffix = "_admin_detail" model = ApplicationSubmission form_views = [ ArchiveSubmissionView, @@ -974,18 +1047,26 @@ class AdminSubmissionDetailView(ActivityContextMixin, DelegateableView, DetailVi def dispatch(self, request, *args, **kwargs): submission = self.get_object() - if submission.status == DRAFT_STATE and not submission.can_view_draft(request.user): + if submission.status == DRAFT_STATE and not submission.can_view_draft( + request.user + ): raise Http404 - permission, _ = has_permission('submission_view', request.user, object=submission, raise_exception=True) + permission, _ = has_permission( + "submission_view", request.user, object=submission, raise_exception=True + ) redirect = SubmissionSealedView.should_redirect(request, submission) return redirect or super().dispatch(request, *args, **kwargs) def get_context_data(self, **kwargs): - other_submissions = self.model.objects.filter(user=self.object.user).current().exclude(id=self.object.id) + other_submissions = ( + self.model.objects.filter(user=self.object.user) + .current() + .exclude(id=self.object.id) + ) if self.object.next: other_submissions = other_submissions.exclude(id=self.object.next.id) - public_page = self.object.get_from_parent('detail')() + public_page = self.object.get_from_parent("detail")() default_screening_statuses = get_default_screening_statues() return super().get_context_data( other_submissions=other_submissions, @@ -996,7 +1077,7 @@ def get_context_data(self, **kwargs): class ReviewerSubmissionDetailView(ActivityContextMixin, DelegateableView, DetailView): - template_name_suffix = '_reviewer_detail' + template_name_suffix = "_reviewer_detail" model = ApplicationSubmission form_views = [CommentFormView] @@ -1009,7 +1090,9 @@ def dispatch(self, request, *args, **kwargs): if submission.status == DRAFT_STATE: raise Http404 - permission, _ = has_permission('submission_view', request.user, object=submission, raise_exception=True) + permission, _ = has_permission( + "submission_view", request.user, object=submission, raise_exception=True + ) reviewer_settings = ReviewerSettings.for_request(request) if reviewer_settings.use_settings: @@ -1032,7 +1115,9 @@ def get_object(self): def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, _ = has_permission('submission_view', request.user, object=submission, raise_exception=True) + permission, _ = has_permission( + "submission_view", request.user, object=submission, raise_exception=True + ) # If the requesting user submitted the application, return the Applicant view. # Partners may sometimes be applicants as well. if submission.user == request.user: @@ -1047,13 +1132,15 @@ def dispatch(self, request, *args, **kwargs): class CommunitySubmissionDetailView(ActivityContextMixin, DelegateableView, DetailView): - template_name_suffix = '_community_detail' + template_name_suffix = "_community_detail" model = ApplicationSubmission form_views = [CommentFormView] def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, _ = has_permission('submission_view', request.user, object=submission, raise_exception=True) + permission, _ = has_permission( + "submission_view", request.user, object=submission, raise_exception=True + ) # If the requesting user submitted the application, return the Applicant view. # Reviewers may sometimes be applicants as well. if submission.user == request.user: @@ -1075,7 +1162,9 @@ def get_object(self): def dispatch(self, request, *args, **kwargs): submission = self.get_object() - permission, _ = has_permission('submission_view', request.user, object=submission, raise_exception=True) + permission, _ = has_permission( + "submission_view", request.user, object=submission, raise_exception=True + ) # This view is only for applicants. if submission.user != request.user: raise PermissionDenied @@ -1090,9 +1179,9 @@ class SubmissionDetailView(ViewDispatcher): applicant_view = ApplicantSubmissionDetailView -@method_decorator(staff_required, 'dispatch') +@method_decorator(staff_required, "dispatch") class SubmissionSealedView(DetailView): - template_name = 'funds/submission_sealed.html' + template_name = "funds/submission_sealed.html" model = ApplicationSubmission def get(self, request, *args, **kwargs): @@ -1108,7 +1197,9 @@ def post(self, request, *args, **kwargs): return self.redirect_detail(submission) def redirect_detail(self, submission): - return HttpResponseRedirect(reverse_lazy('funds:submissions:detail', args=(submission.id,))) + return HttpResponseRedirect( + reverse_lazy("funds:submissions:detail", args=(submission.id,)) + ) def peeked(self, submission): messenger( @@ -1117,7 +1208,7 @@ def peeked(self, submission): user=self.request.user, source=submission, ) - self.request.session.setdefault('peeked', {})[str(submission.id)] = True + self.request.session.setdefault("peeked", {})[str(submission.id)] = True # Dictionary updates do not trigger session saves. Force update self.request.session.modified = True @@ -1140,12 +1231,14 @@ def round_is_sealed(cls, submission): @classmethod def has_peeked(cls, request, submission): - return str(submission.id) in request.session.get('peeked', {}) + return str(submission.id) in request.session.get("peeked", {}) @classmethod def should_redirect(cls, request, submission): if cls.round_is_sealed(submission) and not cls.has_peeked(request, submission): - return HttpResponseRedirect(reverse_lazy('funds:submissions:sealed', args=(submission.id,))) + return HttpResponseRedirect( + reverse_lazy("funds:submissions:sealed", args=(submission.id,)) + ) class BaseSubmissionEditView(UpdateView): @@ -1153,28 +1246,34 @@ class BaseSubmissionEditView(UpdateView): Converts the data held on the submission into an editable format and knows how to save that back to the object. Shortcuts the normal update view save approach """ + model = ApplicationSubmission def dispatch(self, request, *args, **kwargs): - permission, _ = has_permission('submission_edit', request.user, object=self.get_object(), raise_exception=True) + permission, _ = has_permission( + "submission_edit", + request.user, + object=self.get_object(), + raise_exception=True, + ) if not self.get_object().phase.permissions.can_edit(request.user): raise PermissionDenied return super().dispatch(request, *args, **kwargs) def buttons(self): - yield ('submit', 'primary', _('Submit')) - yield ('save', 'white', _('Save draft')) + yield ("submit", "primary", _("Submit")) + yield ("save", "white", _("Save draft")) def get_form_kwargs(self): kwargs = super().get_form_kwargs() - instance = kwargs.pop('instance').from_draft() + instance = kwargs.pop("instance").from_draft() initial = instance.raw_data for field_id in instance.file_field_ids: - initial.pop(field_id + '-uploads', False) + initial.pop(field_id + "-uploads", False) initial[field_id] = self.get_placeholder_file( instance.raw_data.get(field_id) ) - kwargs['initial'] = initial + kwargs["initial"] = initial return kwargs def get_placeholder_file(self, initial_file): @@ -1191,26 +1290,30 @@ def get_context_data(self, **kwargs): return super().get_context_data(buttons=self.buttons(), **kwargs) def get_form_class(self): - draft = self.request.POST.get('save', False) - form_fields = self.object.get_form_fields(draft, self.object.raw_data, user=self.request.user) + draft = self.request.POST.get("save", False) + form_fields = self.object.get_form_fields( + draft, self.object.raw_data, user=self.request.user + ) field_blocks = self.object.get_defined_fields() for field_block in field_blocks: if isinstance(field_block.block, GroupToggleBlock): # Disable group toggle field as it is not supported on edit forms. form_fields[field_block.id].disabled = True - return type('WagtailStreamForm', (self.object.submission_form_class,), form_fields) + return type( + "WagtailStreamForm", (self.object.submission_form_class,), form_fields + ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class AdminSubmissionEditView(BaseSubmissionEditView): def form_valid(self, form): self.object.new_data(form.cleaned_data) - if 'save' in self.request.POST: + if "save" in self.request.POST: self.object.create_revision(draft=True, by=self.request.user) return self.form_invalid(form) - if 'submit' in self.request.POST: + if "submit" in self.request.POST: revision = self.object.create_revision(by=self.request.user) if revision: messenger( @@ -1227,7 +1330,7 @@ def form_valid(self, form): return HttpResponseRedirect(self.get_success_url()) -@method_decorator(login_required, name='dispatch') +@method_decorator(login_required, name="dispatch") class ApplicantSubmissionEditView(BaseSubmissionEditView): def dispatch(self, request, *args, **kwargs): submission = self.get_object() @@ -1237,11 +1340,10 @@ def dispatch(self, request, *args, **kwargs): @property def transitions(self): - transitions = self.object.get_available_user_status_transitions(self.request.user) - return { - transition.name: transition - for transition in transitions - } + transitions = self.object.get_available_user_status_transitions( + self.request.user + ) + return {transition.name: transition for transition in transitions} def get_object_fund_current_round(self): assigned_fund = self.object.round.get_parent().specific @@ -1253,17 +1355,17 @@ def form_valid(self, form): self.object.new_data(form.cleaned_data) # Update submit_time only when application is getting submitted from the Draft State for the first time. - if self.object.status == DRAFT_STATE and 'submit' in self.request.POST: + if self.object.status == DRAFT_STATE and "submit" in self.request.POST: self.object.submit_time = timezone.now() if self.object.round: current_round = self.get_object_fund_current_round() if current_round: self.object.round = current_round - self.object.save(update_fields=['submit_time', 'round']) + self.object.save(update_fields=["submit_time", "round"]) - if 'save' in self.request.POST: + if "save" in self.request.POST: self.object.create_revision(draft=True, by=self.request.user) - messages.success(self.request, _('Submission saved successfully')) + messages.success(self.request, _("Submission saved successfully")) return self.form_invalid(form) revision = self.object.create_revision(by=self.request.user) @@ -1295,7 +1397,8 @@ def form_valid(self, form): transition.target, self.request.user, request=self.request, - notify=not (revision or submitting_proposal) or self.object.status == DRAFT_STATE, # Use the other notification + notify=not (revision or submitting_proposal) + or self.object.status == DRAFT_STATE, # Use the other notification ) # Required for django-file-form: delete temporary files for the new files @@ -1304,7 +1407,7 @@ def form_valid(self, form): return HttpResponseRedirect(self.get_success_url()) -@method_decorator(login_required, name='dispatch') +@method_decorator(login_required, name="dispatch") class PartnerSubmissionEditView(ApplicantSubmissionEditView): def dispatch(self, request, *args, **kwargs): submission = self.get_object() @@ -1313,7 +1416,9 @@ def dispatch(self, request, *args, **kwargs): partner_has_access = submission.partners.filter(pk=request.user.pk).exists() if not partner_has_access and submission.user != request.user: raise PermissionDenied - return super(ApplicantSubmissionEditView, self).dispatch(request, *args, **kwargs) + return super(ApplicantSubmissionEditView, self).dispatch( + request, *args, **kwargs + ) class SubmissionEditView(ViewDispatcher): @@ -1323,12 +1428,14 @@ class SubmissionEditView(ViewDispatcher): partner_view = PartnerSubmissionEditView -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class RevisionListView(ListView): model = ApplicationRevision def get_queryset(self): - self.submission = get_object_or_404(ApplicationSubmission, id=self.kwargs['submission_pk']) + self.submission = get_object_or_404( + ApplicationSubmission, id=self.kwargs["submission_pk"] + ) self.queryset = self.model.objects.filter( submission=self.submission, ).exclude( @@ -1344,11 +1451,11 @@ def get_context_data(self, **kwargs): ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class RevisionCompareView(DetailView): model = ApplicationSubmission - template_name = 'funds/revisions_compare.html' - pk_url_kwarg = 'submission_pk' + template_name = "funds/revisions_compare.html" + pk_url_kwarg = "submission_pk" def compare_revisions(self, from_data, to_data): self.object.form_data = from_data.form_data @@ -1360,27 +1467,30 @@ def compare_revisions(self, from_data, to_data): to_required = self.render_required() required_fields = [ - compare(*fields) - for fields in zip(from_required, to_required, strict=False) + compare(*fields) for fields in zip(from_required, to_required, strict=False) ] stream_fields = [ compare(*fields) - for fields in zip(from_rendered_text_fields, to_rendered_text_fields, strict=False) + for fields in zip( + from_rendered_text_fields, to_rendered_text_fields, strict=False + ) ] return (required_fields, stream_fields) def render_required(self): return [ - getattr(self.object, 'get_{}_display'.format(field))() + getattr(self.object, "get_{}_display".format(field))() for field in self.object.named_blocks ] def get_context_data(self, **kwargs): - from_revision = self.object.revisions.get(id=self.kwargs['from']) - to_revision = self.object.revisions.get(id=self.kwargs['to']) - required_fields, stream_fields = self.compare_revisions(from_revision, to_revision) + from_revision = self.object.revisions.get(id=self.kwargs["from"]) + to_revision = self.object.revisions.get(id=self.kwargs["to"]) + required_fields, stream_fields = self.compare_revisions( + from_revision, to_revision + ) timestamps = (from_revision.timestamp, to_revision.timestamp) return super().get_context_data( timestamps=timestamps, @@ -1390,9 +1500,9 @@ def get_context_data(self, **kwargs): ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class RoundListView(SingleTableMixin, FilterView): - template_name = 'funds/rounds.html' + template_name = "funds/rounds.html" table_class = RoundsTable filterset_class = RoundsFilter @@ -1400,10 +1510,13 @@ def get_queryset(self): return RoundsAndLabs.objects.with_progress() -@method_decorator(permission_required('funds.delete_applicationsubmission', raise_exception=True), name='dispatch') +@method_decorator( + permission_required("funds.delete_applicationsubmission", raise_exception=True), + name="dispatch", +) class SubmissionDeleteView(DeleteView): model = ApplicationSubmission - success_url = reverse_lazy('funds:submissions:list') + success_url = reverse_lazy("funds:submissions:list") def delete(self, request, *args, **kwargs): submission = self.get_object() @@ -1414,54 +1527,60 @@ def delete(self, request, *args, **kwargs): source=submission, ) # delete NEW_SUBMISSION event for this particular submission - Event.objects.filter(type=MESSAGES.NEW_SUBMISSION, object_id=submission.id).delete() + Event.objects.filter( + type=MESSAGES.NEW_SUBMISSION, object_id=submission.id + ).delete() # delete submission response = super().delete(request, *args, **kwargs) return response -@method_decorator(login_required, name='dispatch') +@method_decorator(login_required, name="dispatch") class SubmissionPrivateMediaView(UserPassesTestMixin, PrivateMediaView): raise_exception = True def dispatch(self, *args, **kwargs): - submission_pk = self.kwargs['pk'] + submission_pk = self.kwargs["pk"] self.submission = get_object_or_404(ApplicationSubmission, pk=submission_pk) return super().dispatch(*args, **kwargs) def get_media(self, *args, **kwargs): - field_id = kwargs['field_id'] - file_name = kwargs['file_name'] - path_to_file = generate_submission_file_path(self.submission.pk, field_id, file_name) + field_id = kwargs["field_id"] + file_name = kwargs["file_name"] + path_to_file = generate_submission_file_path( + self.submission.pk, field_id, file_name + ) return self.storage.open(path_to_file) def test_func(self): - permission, _ = has_permission('submission_view', self.request.user, self.submission) + permission, _ = has_permission( + "submission_view", self.request.user, self.submission + ) return permission -@method_decorator(staff_or_finance_required, name='dispatch') +@method_decorator(staff_or_finance_required, name="dispatch") class SubmissionDetailSimplifiedView(DetailView): model = ApplicationSubmission - template_name_suffix = '_simplified_detail' + template_name_suffix = "_simplified_detail" def get_object(self, queryset=None): obj = super().get_object(queryset) - if not hasattr(obj, 'project'): + if not hasattr(obj, "project"): raise Http404 return obj -@method_decorator(staff_or_finance_required, name='dispatch') +@method_decorator(staff_or_finance_required, name="dispatch") class SubmissionDetailPDFView(SingleObjectMixin, View): model = ApplicationSubmission def get_object(self, queryset=None): obj = super().get_object(queryset) - if not hasattr(obj, 'project'): + if not hasattr(obj, "project"): raise Http404 return obj @@ -1469,16 +1588,14 @@ def get_object(self, queryset=None): def get(self, request, *args, **kwargs): self.object = self.get_object() pdf_page_settings = PDFPageSettings.for_request(request) - content = draw_submission_content( - self.object.output_text_answers() - ) + content = draw_submission_content(self.object.output_text_answers()) pdf = make_pdf( title=self.object.title, sections=[ { - 'content': content, - 'title': 'Submission', - 'meta': [ + "content": content, + "title": "Submission", + "meta": [ self.object.stage, self.object.page, self.object.round, @@ -1491,24 +1608,22 @@ def get(self, request, *args, **kwargs): return FileResponse( pdf, as_attachment=True, - filename=self.object.title + '.pdf', + filename=self.object.title + ".pdf", ) -@method_decorator(cache_page(60), name='dispatch') -@method_decorator(staff_required, name='dispatch') +@method_decorator(cache_page(60), name="dispatch") +@method_decorator(staff_required, name="dispatch") class SubmissionResultView(SubmissionStatsMixin, FilterView): - template_name = 'funds/submissions_result.html' + template_name = "funds/submissions_result.html" filterset_class = SubmissionFilterAndSearch - filter_action = '' + filter_action = "" excluded_fields = settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS @property def excluded(self): - return { - 'exclude': self.excluded_fields - } + return {"exclude": self.excluded_fields} def get_filterset_kwargs(self, filterset_class, **kwargs): new_kwargs = super().get_filterset_kwargs(filterset_class) @@ -1520,11 +1635,11 @@ def get_queryset(self): return self.filterset_class._meta.model.objects.current().exclude_draft() def get_context_data(self, **kwargs): - search_term = self.request.GET.get('query') + search_term = self.request.GET.get("query") submission_values = self.object_list.value() - count_values = submission_values.get('value__count') - total_value = intcomma(submission_values.get('value__sum')) - average_value = intcomma(round(submission_values.get('value__avg'))) + count_values = submission_values.get("value__count") + total_value = intcomma(submission_values.get("value__sum")) + average_value = intcomma(round(submission_values.get("value__avg"))) return super().get_context_data( search_term=search_term, @@ -1536,16 +1651,16 @@ def get_context_data(self, **kwargs): ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ReviewerLeaderboard(SingleTableMixin, FilterView): filterset_class = ReviewerLeaderboardFilter - filter_action = '' + filter_action = "" table_class = ReviewerLeaderboardTable table_pagination = False - template_name = 'funds/reviewer_leaderboard.html' + template_name = "funds/reviewer_leaderboard.html" def get_context_data(self, **kwargs): - search_term = self.request.GET.get('query') + search_term = self.request.GET.get("query") return super().get_context_data( search_term=search_term, @@ -1561,43 +1676,65 @@ def get_table_data(self): ninety_days_ago = timezone.now() - timedelta(days=90) this_year = timezone.now().year last_year = timezone.now().year - 1 - return super().get_table_data().annotate( - total=Count('assignedreviewers__review'), - ninety_days=Count('assignedreviewers__review', filter=Q(assignedreviewers__review__created_at__date__gte=ninety_days_ago)), - this_year=Count('assignedreviewers__review', filter=Q(assignedreviewers__review__created_at__year=this_year)), - last_year=Count('assignedreviewers__review', filter=Q(assignedreviewers__review__created_at__year=last_year)), + return ( + super() + .get_table_data() + .annotate( + total=Count("assignedreviewers__review"), + ninety_days=Count( + "assignedreviewers__review", + filter=Q( + assignedreviewers__review__created_at__date__gte=ninety_days_ago + ), + ), + this_year=Count( + "assignedreviewers__review", + filter=Q(assignedreviewers__review__created_at__year=this_year), + ), + last_year=Count( + "assignedreviewers__review", + filter=Q(assignedreviewers__review__created_at__year=last_year), + ), + ) ) -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class ReviewerLeaderboardDetail(SingleTableMixin, ListView): model = Review table_class = ReviewerLeaderboardDetailTable paginator_class = LazyPaginator - table_pagination = {'per_page': 25} - template_name = 'funds/reviewer_leaderboard_detail.html' + table_pagination = {"per_page": 25} + template_name = "funds/reviewer_leaderboard_detail.html" def get_context_data(self, **kwargs): - obj = User.objects.get(pk=self.kwargs.get('pk')) + obj = User.objects.get(pk=self.kwargs.get("pk")) return super().get_context_data(object=obj, **kwargs) def get_table_data(self): - return super().get_table_data().filter(author__reviewer_id=self.kwargs.get('pk')).select_related('submission') + return ( + super() + .get_table_data() + .filter(author__reviewer_id=self.kwargs.get("pk")) + .select_related("submission") + ) class RoleColumn(tables.Column): def render(self, value, record): return AssignedReviewers.objects.filter( - reviewer=record, role=self.verbose_name, submission__status__in=active_statuses + reviewer=record, + role=self.verbose_name, + submission__status__in=active_statuses, ).count() -@method_decorator(staff_required, name='dispatch') +@method_decorator(staff_required, name="dispatch") class StaffAssignments(SingleTableMixin, ListView): model = User table_class = StaffAssignmentsTable table_pagination = False - template_name = 'funds/staff_assignments.html' + template_name = "funds/staff_assignments.html" def get_queryset(self): # Only list staff. @@ -1605,19 +1742,19 @@ def get_queryset(self): def get_table_data(self): table_data = super().get_table_data() - reviewer_roles = ReviewerRole.objects.all().order_by('order') + reviewer_roles = ReviewerRole.objects.all().order_by("order") for data in table_data: for i, _role in enumerate(reviewer_roles): # Only setting column name with dummy value 0. # Actual value will be set in RoleColumn render method. - setattr(data, f'role{i}', 0) + setattr(data, f"role{i}", 0) return table_data def get_table_kwargs(self): - reviewer_roles = ReviewerRole.objects.all().order_by('order') + reviewer_roles = ReviewerRole.objects.all().order_by("order") extra_columns = [] for i, role in enumerate(reviewer_roles): - extra_columns.append((f'role{i}', RoleColumn(verbose_name=role))) + extra_columns.append((f"role{i}", RoleColumn(verbose_name=role))) return { - 'extra_columns': extra_columns, + "extra_columns": extra_columns, } diff --git a/hypha/apply/funds/views_beta.py b/hypha/apply/funds/views_beta.py index 1e24ced2ac..0f1cdb6475 100644 --- a/hypha/apply/funds/views_beta.py +++ b/hypha/apply/funds/views_beta.py @@ -38,42 +38,42 @@ def screening_decision_context(selected_screening_statuses: list) -> dict: screening_options = [ { - 'slug': 'null', - 'title': _('No screening'), - 'selected': 'null' in selected_screening_statuses, + "slug": "null", + "title": _("No screening"), + "selected": "null" in selected_screening_statuses, }, ] + [ { - 'slug': str(item.id), - 'title': item.title, - 'selected': str(item.id) in selected_screening_statuses, + "slug": str(item.id), + "title": item.title, + "selected": str(item.id) in selected_screening_statuses, } for item in ScreeningStatus.objects.filter( id__in=ApplicationSubmission.objects.all() - .values('screening_statuses__id') - .distinct('screening_statuses__id') + .values("screening_statuses__id") + .distinct("screening_statuses__id") ) ] selected_screening_statuses_objects = filter( - lambda x: x['selected'] is True, screening_options + lambda x: x["selected"] is True, screening_options ) return { - 'selected_screening_statuses_objects': selected_screening_statuses_objects, - 'screening_options': screening_options, + "selected_screening_statuses_objects": selected_screening_statuses_objects, + "screening_options": screening_options, } @login_required @user_passes_test(is_apply_staff) def submission_all_beta( - request: HttpRequest, template_name='submissions/all.html' + request: HttpRequest, template_name="submissions/all.html" ) -> HttpResponse: - search_query = request.GET.get('query') or "" + search_query = request.GET.get("query") or "" parsed_query = parse_search_query(search_query) - search_term, search_filters = parsed_query['text'], parsed_query['filters'] + search_term, search_filters = parsed_query["text"], parsed_query["filters"] - show_archived = request.GET.get("archived", False) == 'on' + show_archived = request.GET.get("archived", False) == "on" selected_funds = request.GET.getlist("fund") selected_rounds = request.GET.getlist("round") selected_leads = request.GET.getlist("lead") @@ -111,38 +111,42 @@ def submission_all_beta( qs = qs.exclude_draft() if "submitted" in search_filters: - qs = apply_date_filter(qs=qs, field='submit_time', values=search_filters['submitted']) + qs = apply_date_filter( + qs=qs, field="submit_time", values=search_filters["submitted"] + ) if "updated" in search_filters: - qs = apply_date_filter(qs=qs, field='last_update', values=search_filters['updated']) + qs = apply_date_filter( + qs=qs, field="last_update", values=search_filters["updated"] + ) if "flagged" in search_filters: - if "@me" in search_filters['flagged']: + if "@me" in search_filters["flagged"]: qs = qs.flagged_by(request.user) if "lead" in search_filters: - if "@me" in search_filters['lead']: + if "@me" in search_filters["lead"]: qs = qs.filter(lead=request.user) if "reviewer" in search_filters: - if "@me" in search_filters['reviewer']: + if "@me" in search_filters["reviewer"]: qs = qs.filter(reviewers=request.user) if "id" in search_filters: - qs = qs.filter(id__in=search_filters['id']) + qs = qs.filter(id__in=search_filters["id"]) if "is" in search_filters: - if "archived" in search_filters['is']: + if "archived" in search_filters["is"]: qs = qs.filter(is_archive=True) if search_term: - query = SearchQuery(search_term, search_type='websearch') - rank_annotation = SearchRank(models.F('search_document'), query) + query = SearchQuery(search_term, search_type="websearch") + rank_annotation = SearchRank(models.F("search_document"), query) qs = qs.filter(search_document=query) qs = qs.annotate(rank=rank_annotation) filter_extras = { - 'exclude': settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS, + "exclude": settings.SUBMISSIONS_TABLE_EXCLUDED_FIELDS, } if selected_funds: @@ -157,24 +161,24 @@ def submission_all_beta( # Status Filter Options STATUS_MAP = dict(PHASES) - for row in qs.order_by().values('status').annotate(n=models.Count('status')): - phase = STATUS_MAP[row['status']] + for row in qs.order_by().values("status").annotate(n=models.Count("status")): + phase = STATUS_MAP[row["status"]] display_name = phase.display_name try: - count = status_count_raw[display_name]['count'] + count = status_count_raw[display_name]["count"] except KeyError: count = 0 status_count_raw[display_name] = { - 'count': count + row['n'], - 'title': display_name, - 'bg_color': phase.bg_color, - 'slug': phase.display_slug, - 'selected': phase.display_slug in selected_statuses, + "count": count + row["n"], + "title": display_name, + "bg_color": phase.bg_color, + "slug": phase.display_slug, + "selected": phase.display_slug in selected_statuses, } status_counts = sorted( status_count_raw.values(), - key=lambda t: (t['selected'], t['count']), + key=lambda t: (t["selected"], t["count"]), reverse=True, ) @@ -196,30 +200,30 @@ def submission_all_beta( ) qs = filters.qs - qs = qs.prefetch_related('meta_terms') + qs = qs.prefetch_related("meta_terms") sort_options_raw = { - "submitted-desc": ("-submit_time", _('Newest')), - "submitted-asc": ("submit_time", _('Oldest')), - "comments-desc": ("-comment_count", _('Most Commented')), - "comments-asc": ("comment_count", _('Least Commented')), - "updated-desc": ("-last_update", _('Recently Updated')), - "updated-asc": ("last_update", _('Least Recently Updated')), - "relevance-desc": ("-rank", _('Best Match')), + "submitted-desc": ("-submit_time", _("Newest")), + "submitted-asc": ("submit_time", _("Oldest")), + "comments-desc": ("-comment_count", _("Most Commented")), + "comments-asc": ("comment_count", _("Least Commented")), + "updated-desc": ("-last_update", _("Recently Updated")), + "updated-asc": ("last_update", _("Least Recently Updated")), + "relevance-desc": ("-rank", _("Best Match")), } sort_options = [ - {'name': v[1], 'param': k, 'selected': selected_sort == k} + {"name": v[1], "param": k, "selected": selected_sort == k} for k, v in sort_options_raw.items() ] if selected_sort and selected_sort in sort_options_raw.keys(): - if not search_query and selected_sort == 'relevance-desc': - qs = qs.order_by('-submit_time') + if not search_query and selected_sort == "relevance-desc": + qs = qs.order_by("-submit_time") else: qs = qs.order_by(sort_options_raw[selected_sort][0]) elif search_term: - qs = qs.order_by('-rank') + qs = qs.order_by("-rank") else: qs = qs.order_by("-submit_time") @@ -228,31 +232,31 @@ def submission_all_beta( page = Paginator(qs, per_page=60, orphans=20).page(page) ctx = { - 'base_template': base_template, - 'search_query': search_query, - 'filters': filters, - 'page': page, - 'submissions': page.object_list, - 'submission_ids': [x.id for x in page.object_list], - 'show_archived': show_archived, - 'selected_funds': selected_funds, - 'selected_fund_objects': selected_fund_objects, - 'selected_rounds': selected_rounds, - 'selected_round_objects': selected_round_objects, - 'selected_leads': selected_leads, - 'selected_applicants': selected_applicants, - 'selected_reviewers': selected_reviewers, - 'selected_meta_terms': selected_meta_terms, - 'selected_category_options': selected_category_options, - 'status_counts': status_counts, - 'sort_options': sort_options, - 'selected_sort': selected_sort, - 'selected_statuses': selected_statuses, - 'is_filtered': is_filtered, - 'duration': end - start, - 'can_view_archive': can_view_archives, - 'can_bulk_archive': permissions.can_bulk_archive_submissions(request.user), - 'can_bulk_delete': permissions.can_bulk_delete_submissions(request.user), + "base_template": base_template, + "search_query": search_query, + "filters": filters, + "page": page, + "submissions": page.object_list, + "submission_ids": [x.id for x in page.object_list], + "show_archived": show_archived, + "selected_funds": selected_funds, + "selected_fund_objects": selected_fund_objects, + "selected_rounds": selected_rounds, + "selected_round_objects": selected_round_objects, + "selected_leads": selected_leads, + "selected_applicants": selected_applicants, + "selected_reviewers": selected_reviewers, + "selected_meta_terms": selected_meta_terms, + "selected_category_options": selected_category_options, + "status_counts": status_counts, + "sort_options": sort_options, + "selected_sort": selected_sort, + "selected_statuses": selected_statuses, + "is_filtered": is_filtered, + "duration": end - start, + "can_view_archive": can_view_archives, + "can_bulk_archive": permissions.can_bulk_archive_submissions(request.user), + "can_bulk_delete": permissions.can_bulk_delete_submissions(request.user), } | screening_decision_context(selected_screening_statuses) return render(request, template_name, ctx) @@ -298,10 +302,10 @@ def bulk_delete_submissions(request): @user_passes_test(is_apply_staff) @require_http_methods(["POST"]) def bulk_update_submissions_status(request: HttpRequest) -> HttpResponse: - submission_ids = request.POST.getlist('selectedSubmissionIds') - action = request.POST.get('action') + submission_ids = request.POST.getlist("selectedSubmissionIds") + action = request.POST.get("action") - transitions = get_action_mapping(workflow=None)[action]['transitions'] + transitions = get_action_mapping(workflow=None)[action]["transitions"] submissions = ApplicationSubmission.objects.filter(id__in=submission_ids) @@ -312,7 +316,9 @@ def bulk_update_submissions_status(request: HttpRequest) -> HttpResponse: failed = [] phase_changes = {} for submission in submissions: - valid_actions = {action for action, _ in submission.get_actions_for_user(request.user)} + valid_actions = { + action for action, _ in submission.get_actions_for_user(request.user) + } old_phase = submission.phase try: transition = (valid_actions & set(transitions)).pop() @@ -330,8 +336,8 @@ def bulk_update_submissions_status(request: HttpRequest) -> HttpResponse: if failed: messages.warning( request, - _('Failed to update: ') + - ', '.join(str(submission) for submission in failed) + _("Failed to update: ") + + ", ".join(str(submission) for submission in failed), ) if succeeded_submissions := submissions.exclude(id__in=(s.id for s in failed)): diff --git a/hypha/apply/funds/views_partials.py b/hypha/apply/funds/views_partials.py index 51ec8f1420..7dc9d4758c 100644 --- a/hypha/apply/funds/views_partials.py +++ b/hypha/apply/funds/views_partials.py @@ -30,28 +30,28 @@ @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def sub_menu_funds(request): selected_funds = request.GET.getlist("fund") # Funds Filter Options funds = [ - {'id': f.id, 'selected': str(f.id) in selected_funds, 'title': f.title} + {"id": f.id, "selected": str(f.id) in selected_funds, "title": f.title} for f in Page.objects.filter(applicationsubmission__isnull=False) .order_by("title") .distinct() ] ctx = { - 'funds': funds, - 'selected_funds': selected_funds, + "funds": funds, + "selected_funds": selected_funds, } return render(request, "submissions/submenu/funds.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def sub_menu_leads( request, template_name="submissions/submenu/leads.html" ) -> HttpResponse: @@ -59,10 +59,10 @@ def sub_menu_leads( leads = [ { - 'id': item.id, - 'selected': str(item.id) in selected_leads, - 'title': str(item), - 'slack': item.slack, + "id": item.id, + "selected": str(item.id) in selected_leads, + "title": str(item), + "slack": item.slack, } for item in User.objects.filter(submission_lead__isnull=False) .order_by() @@ -72,20 +72,20 @@ def sub_menu_leads( # show selected and current user first leads = sorted( leads, - key=lambda x: (not x['selected'], x['id'] != request.user.id, x['title']), + key=lambda x: (not x["selected"], x["id"] != request.user.id, x["title"]), reverse=False, ) ctx = { - 'leads': leads, - 'selected_leads': selected_leads, + "leads": leads, + "selected_leads": selected_leads, } return render(request, template_name, ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def sub_menu_rounds(request): selected_rounds = request.GET.getlist("round") selected_fund = request.GET.get("fund") @@ -96,39 +96,39 @@ def sub_menu_rounds(request): qs = Round.objects.child_of(fund) open_rounds = [ - {'id': item.id, 'selected': str(item.id) in selected_rounds, 'title': str(item)} - for item in qs.open().order_by('-end_date').distinct() + {"id": item.id, "selected": str(item.id) in selected_rounds, "title": str(item)} + for item in qs.open().order_by("-end_date").distinct() ] closed_rounds = [ - {'id': item.id, 'selected': str(item.id) in selected_rounds, 'title': str(item)} + {"id": item.id, "selected": str(item.id) in selected_rounds, "title": str(item)} for item in qs.closed() .filter(submissions__isnull=False) - .order_by('-end_date') + .order_by("-end_date") .distinct() ] ctx = { - 'open_rounds': open_rounds, - 'closed_rounds': closed_rounds, - 'selected_rounds': selected_rounds, + "open_rounds": open_rounds, + "closed_rounds": closed_rounds, + "selected_rounds": selected_rounds, } return render(request, "submissions/submenu/rounds.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def sub_menu_reviewers(request): selected_reviewers = request.GET.getlist("reviewers") qs = get_all_reviewers() reviewers = [ { - 'id': item.id, - 'selected': str(item.id) in selected_reviewers, - 'title': str(item), - 'slack': item.slack, + "id": item.id, + "selected": str(item.id) in selected_reviewers, + "title": str(item), + "slack": item.slack, } for item in qs.order_by().distinct() ] @@ -136,88 +136,88 @@ def sub_menu_reviewers(request): # show selected and current user first reviewers = sorted( reviewers, - key=lambda t: t['selected'] or t['id'] == request.user.id, + key=lambda t: t["selected"] or t["id"] == request.user.id, reverse=True, ) ctx = { - 'reviewers': reviewers, - 'selected_reviewers': selected_reviewers, + "reviewers": reviewers, + "selected_reviewers": selected_reviewers, } return render(request, "submissions/submenu/reviewers.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def sub_menu_meta_terms(request): selected_meta_terms = request.GET.getlist("meta_terms") terms_qs = MetaTerm.objects.filter( filter_on_dashboard=True, id__in=ApplicationSubmission.objects.all() - .values('meta_terms__id') - .distinct('meta_terms__id'), + .values("meta_terms__id") + .distinct("meta_terms__id"), ).exclude(depth=1) meta_terms = [ { - 'id': item.id, - 'selected': str(item.id) in selected_meta_terms, - 'title': str(item), - 'depth_range': range((item.depth - 2) * 2), - 'depth': item.depth - 1, + "id": item.id, + "selected": str(item.id) in selected_meta_terms, + "title": str(item), + "depth_range": range((item.depth - 2) * 2), + "depth": item.depth - 1, } for item in terms_qs ] ctx = { - 'meta_terms': meta_terms, - 'selected_meta_terms': selected_meta_terms, + "meta_terms": meta_terms, + "selected_meta_terms": selected_meta_terms, } return render(request, "submissions/submenu/meta-terms.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def sub_menu_category_options(request): selected_category_options = request.GET.getlist("category_options") - qs = Option.objects.filter(category__filter_on_dashboard=True).values('id', 'value') + qs = Option.objects.filter(category__filter_on_dashboard=True).values("id", "value") items = [ { - 'id': item['id'], - 'selected': str(item['id']) in selected_category_options, - 'title': item['value'], + "id": item["id"], + "selected": str(item["id"]) in selected_category_options, + "title": item["value"], } for item in qs ] - items = sorted(items, key=lambda t: t['selected'], reverse=True) + items = sorted(items, key=lambda t: t["selected"], reverse=True) ctx = { - 'category_options': items, - 'selected_category_options': selected_category_options, + "category_options": items, + "selected_category_options": selected_category_options, } return render(request, "submissions/submenu/category.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def partial_submission_activities(request, pk): submission = get_object_or_404(ApplicationSubmission, pk=pk) has_permission( - 'submission_view', request.user, object=submission, raise_exception=True + "submission_view", request.user, object=submission, raise_exception=True ) - ctx = {'actions': get_related_actions_for_user(submission, request.user)} - return render(request, 'activity/include/action_list.html', ctx) + ctx = {"actions": get_related_actions_for_user(submission, request.user)} + return render(request, "activity/include/action_list.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def partial_reviews_card(request: HttpRequest, pk: str) -> HttpResponse: """Returns a partial html for the submission reviews box on the submission detail page and hovercard on the submissison list page. @@ -240,19 +240,19 @@ def partial_reviews_card(request: HttpRequest, pk: str) -> HttpResponse: recommendation = submission.reviews.by_staff().recommendation() ctx = { - 'hidden_types': [REVIEWER_GROUP_NAME], - 'staff_reviewers_exist': assigned_reviewers.staff().exists(), - 'assigned_reviewers': assigned_reviewers, - 'recommendation': recommendation, + "hidden_types": [REVIEWER_GROUP_NAME], + "staff_reviewers_exist": assigned_reviewers.staff().exists(), + "assigned_reviewers": assigned_reviewers, + "recommendation": recommendation, } return render(request, "funds/includes/review_sidebar.html", ctx) @login_required -@require_http_methods(['GET']) +@require_http_methods(["GET"]) def partial_reviews_decisions(request: HttpRequest) -> HttpResponse: - submission_ids = request.GET.get('ids') + submission_ids = request.GET.get("ids") if submission_ids: submission_ids = [x for x in submission_ids.split(",") if x] @@ -260,7 +260,7 @@ def partial_reviews_decisions(request: HttpRequest) -> HttpResponse: qs = annotate_review_recommendation_and_count(qs) ctx = { - 'submissions': qs, + "submissions": qs, } return render( @@ -269,9 +269,9 @@ def partial_reviews_decisions(request: HttpRequest) -> HttpResponse: @login_required -@require_http_methods(['GET', 'POST']) +@require_http_methods(["GET", "POST"]) def sub_menu_update_status(request: HttpRequest) -> HttpResponse: - submission_ids = request.GET.getlist('selectedSubmissionIds') + submission_ids = request.GET.getlist("selectedSubmissionIds") qs = ApplicationSubmission.objects.filter(id__in=submission_ids) list_of_actions_list = [s.get_actions_for_user(request.user) for s in qs] @@ -283,17 +283,17 @@ def sub_menu_update_status(request: HttpRequest) -> HttpResponse: ) ctx = { - 'statuses': {slugify(a): a for a in common_actions}.items(), + "statuses": {slugify(a): a for a in common_actions}.items(), } return render(request, "submissions/submenu/change-status.html", ctx) @login_required -@require_http_methods(['GET', 'POST']) +@require_http_methods(["GET", "POST"]) def sub_menu_bulk_update_lead(request: HttpRequest) -> HttpResponse: - if request.method == 'POST': - submission_ids = request.POST.getlist('selectedSubmissionIds') + if request.method == "POST": + submission_ids = request.POST.getlist("selectedSubmissionIds") lead = request.POST.get("lead") submissions = ApplicationSubmission.objects.filter(id__in=submission_ids) @@ -306,9 +306,9 @@ def sub_menu_bulk_update_lead(request: HttpRequest) -> HttpResponse: leads = [ { - 'id': item.id, - 'title': str(item), - 'slack': item.slack, + "id": item.id, + "title": str(item), + "slack": item.slack, } for item in User.objects.staff() ] @@ -316,29 +316,29 @@ def sub_menu_bulk_update_lead(request: HttpRequest) -> HttpResponse: # sort by lead names and put current user first leads = sorted( leads, - key=lambda x: (x['id'] != request.user.id, x['title']), + key=lambda x: (x["id"] != request.user.id, x["title"]), reverse=False, ) ctx = { - 'leads': leads, + "leads": leads, } return render(request, "submissions/submenu/bulk-update-lead.html", ctx) @login_required -@require_http_methods(['GET', 'POST']) +@require_http_methods(["GET", "POST"]) def sub_menu_bulk_update_reviewers(request: HttpRequest) -> HttpResponse: - if request.method == 'POST': - submission_ids = request.POST.getlist('selectedSubmissionIds') + if request.method == "POST": + submission_ids = request.POST.getlist("selectedSubmissionIds") submissions = ApplicationSubmission.objects.filter(id__in=submission_ids) external_reviewers_ids = request.POST.getlist("external_reviewers") external_reviewers = User.objects.filter(id__in=external_reviewers_ids) assigned_roles = {} for field, value in request.POST.items(): - if field.startswith('role_reviewer_'): + if field.startswith("role_reviewer_"): if value: role = ReviewerRole.objects.get(id=field[14:]) user = User.objects.staff().get(id=value) @@ -354,7 +354,7 @@ def sub_menu_bulk_update_reviewers(request: HttpRequest) -> HttpResponse: ) return HttpResponseClientRefresh() - submission_ids = request.GET.getlist('selectedSubmissionIds') + submission_ids = request.GET.getlist("selectedSubmissionIds") form = BatchUpdateReviewersForm(user=request.user) show_external_reviewers = False @@ -366,8 +366,8 @@ def sub_menu_bulk_update_reviewers(request: HttpRequest) -> HttpResponse: ) ctx = { - 'form': form, - 'show_external_reviewers': show_external_reviewers, + "form": form, + "show_external_reviewers": show_external_reviewers, } return render(request, "submissions/submenu/bulk-update-reviewers.html", ctx) diff --git a/hypha/apply/funds/wagtail_hooks.py b/hypha/apply/funds/wagtail_hooks.py index 31debfeb04..cc00b96d16 100644 --- a/hypha/apply/funds/wagtail_hooks.py +++ b/hypha/apply/funds/wagtail_hooks.py @@ -9,25 +9,31 @@ modeladmin_register(ApplyAdminGroup) -@hooks.register('before_create_page') +@hooks.register("before_create_page") def before_create_page(request, parent_page, page_class): if issubclass(page_class, RoundBase) and request.POST: - if not hasattr(page_class, 'parent_page'): + if not hasattr(page_class, "parent_page"): page_class.parent_page = {} - page_class.parent_page.setdefault(page_class, {})[request.POST['title']] = parent_page + page_class.parent_page.setdefault(page_class, {})[ + request.POST["title"] + ] = parent_page return page_class -@hooks.register('before_copy_page') +@hooks.register("before_copy_page") def before_copy_round_page(request, page): - if isinstance(page.specific, RoundBase) and request.method == 'POST': + if isinstance(page.specific, RoundBase) and request.method == "POST": # Custom view to clear start_date and end_date from the copy being created. return custom_admin_round_copy_view(request, page) -@hooks.register('register_permissions') +@hooks.register("register_permissions") def register_permissions(): return Permission.objects.filter( - content_type__app_label='funds', - codename__in=['add_applicationsubmission', 'change_applicationsubmission', 'delete_applicationsubmission'] + content_type__app_label="funds", + codename__in=[ + "add_applicationsubmission", + "change_applicationsubmission", + "delete_applicationsubmission", + ], ) diff --git a/hypha/apply/funds/widgets.py b/hypha/apply/funds/widgets.py index 964deddaed..6e0b1a916c 100644 --- a/hypha/apply/funds/widgets.py +++ b/hypha/apply/funds/widgets.py @@ -5,34 +5,37 @@ class Select2MultiCheckboxesWidget(Select2MultipleWidget): class Media: js = ( - static('js/select2.multi-checkboxes.js'), - static('js/django_select2-checkboxes.js'), + static("js/select2.multi-checkboxes.js"), + static("js/django_select2-checkboxes.js"), ) def __init__(self, *args, **kwargs): - attrs = kwargs.get('attrs', {}) - attrs.setdefault('data-placeholder', 'items') - kwargs['attrs'] = attrs + attrs = kwargs.get("attrs", {}) + attrs.setdefault("data-placeholder", "items") + kwargs["attrs"] = attrs super().__init__(*args, **kwargs) def build_attrs(self, *args, **kwargs): attrs = super().build_attrs(*args, **kwargs) - attrs['class'] = attrs['class'].replace('django-select2', 'django-select2-checkboxes') + attrs["class"] = attrs["class"].replace( + "django-select2", "django-select2-checkboxes" + ) return attrs class MetaTermSelect2Widget(Select2MultipleWidget): - - def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): + def create_option( + self, name, value, label, selected, index, subindex=None, attrs=None + ): disabled = False if isinstance(label, dict): - label, disabled = label.get('label'), label.get('disabled') + label, disabled = label.get("label"), label.get("disabled") option_dict = super().create_option( name, value, label, selected, index, subindex=subindex, attrs=attrs ) if disabled: - option_dict['attrs']['disabled'] = 'disabled' + option_dict["attrs"]["disabled"] = "disabled" return option_dict diff --git a/hypha/apply/funds/workflow.py b/hypha/apply/funds/workflow.py index 9eaa707c6b..1e0cd724af 100644 --- a/hypha/apply/funds/workflow.py +++ b/hypha/apply/funds/workflow.py @@ -19,19 +19,20 @@ """ PHASE_BG_COLORS = { - 'Draft': 'bg-gray-200', - 'Accepted': 'bg-green-200', - 'Need screening': 'bg-cyan-200', - 'Ready for Determination': 'bg-blue-200', - 'Ready For Discussion': 'bg-blue-100', - 'Invited for Proposal': 'bg-yellow-100', - 'Internal Review': 'bg-yellow-200', - 'External Review': 'bg-yellow-200', - 'More information required': 'bg-rose-200', - 'Accepted but additional info required': 'bg-rose-100', - 'Dismissed': 'bg-red-200', + "Draft": "bg-gray-200", + "Accepted": "bg-green-200", + "Need screening": "bg-cyan-200", + "Ready for Determination": "bg-blue-200", + "Ready For Discussion": "bg-blue-100", + "Invited for Proposal": "bg-yellow-100", + "Internal Review": "bg-yellow-200", + "External Review": "bg-yellow-200", + "More information required": "bg-rose-200", + "Accepted but additional info required": "bg-rose-100", + "Dismissed": "bg-red-200", } + class UserPermissions(Enum): STAFF = 1 ADMIN = 2 @@ -66,7 +67,8 @@ def stepped_phases(self): def phases_for(self, user=None): # Grab the first phase for each step - visible only, the display phase return [ - phase for phase, *_ in self.stepped_phases.values() + phase + for phase, *_ in self.stepped_phases.values() if not user or phase.permissions.can_view(user) ] @@ -75,7 +77,7 @@ def previous_visible(self, current, user): display_phase = self.stepped_phases[current.step][0] phases = self.phases_for() index = phases.index(display_phase) - for phase in phases[index - 1::-1]: + for phase in phases[index - 1 :: -1]: if phase.permissions.can_view(user): return phase @@ -88,7 +90,17 @@ class Phase: future_name = phase_name displayed to applicants if they haven't passed this stage """ - def __init__(self, name, display, stage, permissions, step, public=None, future=None, transitions=None): + def __init__( + self, + name, + display, + stage, + permissions, + step, + public=None, + future=None, + transitions=None, + ): if transitions is None: transitions = {} self.name = name @@ -99,7 +111,7 @@ def __init__(self, name, display, stage, permissions, step, public=None, future= self.public_name = public or self.display_name self.future_name_staff = future or self.display_name - self.bg_color = PHASE_BG_COLORS.get(self.display_name, 'bg-gray-200') + self.bg_color = PHASE_BG_COLORS.get(self.display_name, "bg-gray-200") self.future_name_public = future or self.public_name self.stage = stage self.permissions = Permissions(permissions) @@ -108,27 +120,33 @@ def __init__(self, name, display, stage, permissions, step, public=None, future= # For building transition methods on the parent self.transitions = {} - default_permissions = {UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN} + default_permissions = { + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + } for transition_target, action in transitions.items(): transition = {} try: - transition['display'] = action.get('display') + transition["display"] = action.get("display") except AttributeError: - transition['display'] = action - transition['permissions'] = default_permissions + transition["display"] = action + transition["permissions"] = default_permissions else: - transition['method'] = action.get('method') - conditions = action.get('conditions', '') - transition['conditions'] = conditions.split(',') if conditions else [] - transition['permissions'] = action.get('permissions', default_permissions) + transition["method"] = action.get("method") + conditions = action.get("conditions", "") + transition["conditions"] = conditions.split(",") if conditions else [] + transition["permissions"] = action.get( + "permissions", default_permissions + ) self.transitions[transition_target] = transition def __str__(self): return self.display_name def __repr__(self): - return f'' + return f"" class Stage: @@ -140,7 +158,7 @@ def __str__(self): return self.name def __repr__(self): - return f'' + return f"" class Permissions: @@ -152,13 +170,13 @@ def can_do(self, user, action): return any(check(user) for check in checks) def can_edit(self, user): - return self.can_do(user, 'edit') + return self.can_do(user, "edit") def can_review(self, user): - return self.can_do(user, 'review') + return self.can_do(user, "review") def can_view(self, user): - return self.can_do(user, 'view') + return self.can_do(user, "view") staff_can = lambda user: user.is_apply_staff # NOQA @@ -174,9 +192,15 @@ def can_view(self, user): def make_permissions(edit=None, review=None, view=None): return { - 'edit': edit or [], - 'review': review or [], - 'view': view or [staff_can, applicant_can, reviewer_can, partner_can, ], + "edit": edit or [], + "review": review or [], + "view": view + or [ + staff_can, + applicant_can, + reviewer_can, + partner_can, + ], } @@ -184,154 +208,174 @@ def make_permissions(edit=None, review=None, view=None): default_permissions = make_permissions(edit=[staff_can], review=[staff_can]) -hidden_from_applicant_permissions = make_permissions(edit=[staff_can], review=[staff_can], view=[staff_can, reviewer_can]) +hidden_from_applicant_permissions = make_permissions( + edit=[staff_can], review=[staff_can], view=[staff_can, reviewer_can] +) -reviewer_review_permissions = make_permissions(edit=[staff_can], review=[staff_can, reviewer_can]) +reviewer_review_permissions = make_permissions( + edit=[staff_can], review=[staff_can, reviewer_can] +) -community_review_permissions = make_permissions(edit=[staff_can], review=[staff_can, reviewer_can, community_can]) +community_review_permissions = make_permissions( + edit=[staff_can], review=[staff_can, reviewer_can, community_can] +) -applicant_edit_permissions = make_permissions(edit=[applicant_can, partner_can], review=[staff_can]) +applicant_edit_permissions = make_permissions( + edit=[applicant_can, partner_can], review=[staff_can] +) staff_edit_permissions = make_permissions(edit=[staff_can]) -Request = Stage('Request', False) +Request = Stage("Request", False) -RequestExt = Stage('RequestExt', True) +RequestExt = Stage("RequestExt", True) -RequestCom = Stage('RequestCom', True) +RequestCom = Stage("RequestCom", True) -Concept = Stage('Concept', False) +Concept = Stage("Concept", False) -Proposal = Stage('Proposal', True) +Proposal = Stage("Proposal", True) -DRAFT_STATE = 'draft' +DRAFT_STATE = "draft" -INITIAL_STATE = 'in_discussion' +INITIAL_STATE = "in_discussion" SingleStageDefinition = [ { DRAFT_STATE: { - 'transitions': { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": {UserPermissions.APPLICANT}, + "method": "create_revision", }, }, - 'display': _('Draft'), - 'stage': Request, - 'permissions': applicant_edit_permissions, + "display": _("Draft"), + "stage": Request, + "permissions": applicant_edit_permissions, } }, { INITIAL_STATE: { - 'transitions': { - 'more_info': _('Request More Information'), - 'internal_review': _('Open Review'), - 'determination': _('Ready For Determination'), - 'almost': _('Accept but additional info required'), - 'accepted': _('Accept'), - 'rejected': _('Dismiss'), + "transitions": { + "more_info": _("Request More Information"), + "internal_review": _("Open Review"), + "determination": _("Ready For Determination"), + "almost": _("Accept but additional info required"), + "accepted": _("Accept"), + "rejected": _("Dismiss"), }, - 'display': _('Need screening'), - 'public': _('Application Received'), - 'stage': Request, - 'permissions': default_permissions, + "display": _("Need screening"), + "public": _("Application Received"), + "stage": Request, + "permissions": default_permissions, }, - 'more_info': { - 'transitions': { + "more_info": { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, - 'determination': _('Ready For Determination'), - 'almost': _('Accept but additional info required'), - 'accepted': _('Accept'), - 'rejected': _('Dismiss'), + "determination": _("Ready For Determination"), + "almost": _("Accept but additional info required"), + "accepted": _("Accept"), + "rejected": _("Dismiss"), }, - 'display': _('More information required'), - 'stage': Request, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Request, + "permissions": applicant_edit_permissions, }, }, { - 'internal_review': { - 'transitions': { - 'post_review_discussion': _('Close Review'), - INITIAL_STATE: _('Need screening (revert)'), + "internal_review": { + "transitions": { + "post_review_discussion": _("Close Review"), + INITIAL_STATE: _("Need screening (revert)"), }, - 'display': _('Internal Review'), - 'public': _('{org_short_name} Review').format(org_short_name=settings.ORG_SHORT_NAME), - 'stage': Request, - 'permissions': default_permissions, + "display": _("Internal Review"), + "public": _("{org_short_name} Review").format( + org_short_name=settings.ORG_SHORT_NAME + ), + "stage": Request, + "permissions": default_permissions, }, }, { - 'post_review_discussion': { - 'transitions': { - 'post_review_more_info': _('Request More Information'), - 'determination': _('Ready For Determination'), - 'internal_review': _('Open Review (revert)'), - 'almost': _('Accept but additional info required'), - 'accepted': _('Accept'), - 'rejected': _('Dismiss'), + "post_review_discussion": { + "transitions": { + "post_review_more_info": _("Request More Information"), + "determination": _("Ready For Determination"), + "internal_review": _("Open Review (revert)"), + "almost": _("Accept but additional info required"), + "accepted": _("Accept"), + "rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': Request, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": Request, + "permissions": hidden_from_applicant_permissions, }, - 'post_review_more_info': { - 'transitions': { - 'post_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "post_review_more_info": { + "transitions": { + "post_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, - 'determination': _('Ready For Determination'), - 'almost': _('Accept but additional info required'), - 'accepted': _('Accept'), - 'rejected': _('Dismiss'), + "determination": _("Ready For Determination"), + "almost": _("Accept but additional info required"), + "accepted": _("Accept"), + "rejected": _("Dismiss"), }, - 'display': _('More information required'), - 'stage': Request, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Request, + "permissions": applicant_edit_permissions, }, }, { - 'determination': { - 'transitions': { - 'post_review_discussion': _('Ready For Discussion (revert)'), - 'almost': _('Accept but additional info required'), - 'accepted': _('Accept'), - 'rejected': _('Dismiss'), + "determination": { + "transitions": { + "post_review_discussion": _("Ready For Discussion (revert)"), + "almost": _("Accept but additional info required"), + "accepted": _("Accept"), + "rejected": _("Dismiss"), }, - 'display': _('Ready for Determination'), - 'permissions': hidden_from_applicant_permissions, - 'stage': Request, + "display": _("Ready for Determination"), + "permissions": hidden_from_applicant_permissions, + "stage": Request, }, }, { - 'accepted': { - 'display': _('Accepted'), - 'future': _('Application Outcome'), - 'stage': Request, - 'permissions': staff_edit_permissions, + "accepted": { + "display": _("Accepted"), + "future": _("Application Outcome"), + "stage": Request, + "permissions": staff_edit_permissions, }, - 'almost': { - 'transitions': { - 'accepted': _('Accept'), - 'post_review_discussion': _('Ready For Discussion (revert)'), + "almost": { + "transitions": { + "accepted": _("Accept"), + "post_review_discussion": _("Ready For Discussion (revert)"), }, - 'display': _('Accepted but additional info required'), - 'stage': Request, - 'permissions': applicant_edit_permissions, + "display": _("Accepted but additional info required"), + "stage": Request, + "permissions": applicant_edit_permissions, }, - 'rejected': { - 'display': _('Dismissed'), - 'stage': Request, - 'permissions': no_permissions, + "rejected": { + "display": _("Dismissed"), + "stage": Request, + "permissions": no_permissions, }, }, ] @@ -339,153 +383,174 @@ def make_permissions(edit=None, review=None, view=None): SingleStageExternalDefinition = [ { DRAFT_STATE: { - 'transitions': { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": {UserPermissions.APPLICANT}, + "method": "create_revision", }, }, - 'display': _('Draft'), - 'stage': RequestExt, - 'permissions': applicant_edit_permissions, + "display": _("Draft"), + "stage": RequestExt, + "permissions": applicant_edit_permissions, } }, { INITIAL_STATE: { - 'transitions': { - 'ext_more_info': _('Request More Information'), - 'ext_internal_review': _('Open Review'), - 'ext_determination': _('Ready For Determination'), - 'ext_rejected': _('Dismiss'), + "transitions": { + "ext_more_info": _("Request More Information"), + "ext_internal_review": _("Open Review"), + "ext_determination": _("Ready For Determination"), + "ext_rejected": _("Dismiss"), }, - 'display': _('Need screening'), - 'public': _('Application Received'), - 'stage': RequestExt, - 'permissions': default_permissions, + "display": _("Need screening"), + "public": _("Application Received"), + "stage": RequestExt, + "permissions": default_permissions, }, - 'ext_more_info': { - 'transitions': { + "ext_more_info": { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': RequestExt, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": RequestExt, + "permissions": applicant_edit_permissions, }, }, { - 'ext_internal_review': { - 'transitions': { - 'ext_post_review_discussion': _('Close Review'), - INITIAL_STATE: _('Need screening (revert)'), + "ext_internal_review": { + "transitions": { + "ext_post_review_discussion": _("Close Review"), + INITIAL_STATE: _("Need screening (revert)"), }, - 'display': _('Internal Review'), - 'public': _('{org_short_name} Review').format(org_short_name=settings.ORG_SHORT_NAME), - 'stage': RequestExt, - 'permissions': default_permissions, + "display": _("Internal Review"), + "public": _("{org_short_name} Review").format( + org_short_name=settings.ORG_SHORT_NAME + ), + "stage": RequestExt, + "permissions": default_permissions, }, }, { - 'ext_post_review_discussion': { - 'transitions': { - 'ext_post_review_more_info': _('Request More Information'), - 'ext_external_review': _('Open External Review'), - 'ext_determination': _('Ready For Determination'), - 'ext_internal_review': _('Open Internal Review (revert)'), - 'ext_rejected': _('Dismiss'), + "ext_post_review_discussion": { + "transitions": { + "ext_post_review_more_info": _("Request More Information"), + "ext_external_review": _("Open External Review"), + "ext_determination": _("Ready For Determination"), + "ext_internal_review": _("Open Internal Review (revert)"), + "ext_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': RequestExt, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": RequestExt, + "permissions": hidden_from_applicant_permissions, }, - 'ext_post_review_more_info': { - 'transitions': { - 'ext_post_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "ext_post_review_more_info": { + "transitions": { + "ext_post_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': RequestExt, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": RequestExt, + "permissions": applicant_edit_permissions, }, }, { - 'ext_external_review': { - 'transitions': { - 'ext_post_external_review_discussion': _('Close Review'), - 'ext_post_review_discussion': _('Ready For Discussion (revert)'), + "ext_external_review": { + "transitions": { + "ext_post_external_review_discussion": _("Close Review"), + "ext_post_review_discussion": _("Ready For Discussion (revert)"), }, - 'display': _('External Review'), - 'stage': RequestExt, - 'permissions': reviewer_review_permissions, + "display": _("External Review"), + "stage": RequestExt, + "permissions": reviewer_review_permissions, }, }, { - 'ext_post_external_review_discussion': { - 'transitions': { - 'ext_post_external_review_more_info': _('Request More Information'), - 'ext_determination': _('Ready For Determination'), - 'ext_external_review': _('Open External Review (revert)'), - 'ext_almost': _('Accept but additional info required'), - 'ext_accepted': _('Accept'), - 'ext_rejected': _('Dismiss'), + "ext_post_external_review_discussion": { + "transitions": { + "ext_post_external_review_more_info": _("Request More Information"), + "ext_determination": _("Ready For Determination"), + "ext_external_review": _("Open External Review (revert)"), + "ext_almost": _("Accept but additional info required"), + "ext_accepted": _("Accept"), + "ext_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': RequestExt, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": RequestExt, + "permissions": hidden_from_applicant_permissions, }, - 'ext_post_external_review_more_info': { - 'transitions': { - 'ext_post_external_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "ext_post_external_review_more_info": { + "transitions": { + "ext_post_external_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': RequestExt, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": RequestExt, + "permissions": applicant_edit_permissions, }, }, { - 'ext_determination': { - 'transitions': { - 'ext_post_external_review_discussion': _('Ready For Discussion (revert)'), - 'ext_almost': _('Accept but additional info required'), - 'ext_accepted': _('Accept'), - 'ext_rejected': _('Dismiss'), + "ext_determination": { + "transitions": { + "ext_post_external_review_discussion": _( + "Ready For Discussion (revert)" + ), + "ext_almost": _("Accept but additional info required"), + "ext_accepted": _("Accept"), + "ext_rejected": _("Dismiss"), }, - 'display': _('Ready for Determination'), - 'permissions': hidden_from_applicant_permissions, - 'stage': RequestExt, + "display": _("Ready for Determination"), + "permissions": hidden_from_applicant_permissions, + "stage": RequestExt, }, }, { - 'ext_accepted': { - 'display': _('Accepted'), - 'future': _('Application Outcome'), - 'stage': RequestExt, - 'permissions': staff_edit_permissions, + "ext_accepted": { + "display": _("Accepted"), + "future": _("Application Outcome"), + "stage": RequestExt, + "permissions": staff_edit_permissions, }, - 'ext_almost': { - 'transitions': { - 'ext_accepted': _('Accept'), - 'ext_post_external_review_discussion': _('Ready For Discussion (revert)'), + "ext_almost": { + "transitions": { + "ext_accepted": _("Accept"), + "ext_post_external_review_discussion": _( + "Ready For Discussion (revert)" + ), }, - 'display': _('Accepted but additional info required'), - 'stage': RequestExt, - 'permissions': applicant_edit_permissions, + "display": _("Accepted but additional info required"), + "stage": RequestExt, + "permissions": applicant_edit_permissions, }, - 'ext_rejected': { - 'display': _('Dismissed'), - 'stage': RequestExt, - 'permissions': no_permissions, + "ext_rejected": { + "display": _("Dismissed"), + "stage": RequestExt, + "permissions": no_permissions, }, }, ] @@ -494,177 +559,200 @@ def make_permissions(edit=None, review=None, view=None): SingleStageCommunityDefinition = [ { DRAFT_STATE: { - 'transitions': { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": {UserPermissions.APPLICANT}, + "method": "create_revision", }, }, - 'display': _('Draft'), - 'stage': RequestCom, - 'permissions': applicant_edit_permissions, + "display": _("Draft"), + "stage": RequestCom, + "permissions": applicant_edit_permissions, } }, { INITIAL_STATE: { - 'transitions': { - 'com_more_info': _('Request More Information'), - 'com_open_call': 'Open Call (public)', - 'com_internal_review': _('Open Review'), - 'com_community_review': _('Open Community Review'), - 'com_determination': _('Ready For Determination'), - 'com_rejected': _('Dismiss'), + "transitions": { + "com_more_info": _("Request More Information"), + "com_open_call": "Open Call (public)", + "com_internal_review": _("Open Review"), + "com_community_review": _("Open Community Review"), + "com_determination": _("Ready For Determination"), + "com_rejected": _("Dismiss"), }, - 'display': _('Need screening'), - 'public': _('Application Received'), - 'stage': RequestCom, - 'permissions': default_permissions, + "display": _("Need screening"), + "public": _("Application Received"), + "stage": RequestCom, + "permissions": default_permissions, }, - 'com_more_info': { - 'transitions': { + "com_more_info": { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': RequestCom, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": RequestCom, + "permissions": applicant_edit_permissions, }, - 'com_open_call': { - 'transitions': { - INITIAL_STATE: _('Need screening (revert)'), - 'com_rejected': _('Dismiss'), + "com_open_call": { + "transitions": { + INITIAL_STATE: _("Need screening (revert)"), + "com_rejected": _("Dismiss"), }, - 'display': 'Open Call (public)', - 'stage': RequestCom, - 'permissions': staff_edit_permissions, + "display": "Open Call (public)", + "stage": RequestCom, + "permissions": staff_edit_permissions, }, }, { - 'com_internal_review': { - 'transitions': { - 'com_community_review': _('Open Community Review'), - 'com_post_review_discussion': _('Close Review'), - INITIAL_STATE: _('Need screening (revert)'), - 'com_rejected': _('Dismiss'), + "com_internal_review": { + "transitions": { + "com_community_review": _("Open Community Review"), + "com_post_review_discussion": _("Close Review"), + INITIAL_STATE: _("Need screening (revert)"), + "com_rejected": _("Dismiss"), }, - 'display': _('Internal Review'), - 'public': _('{org_short_name} Review').format(org_short_name=settings.ORG_SHORT_NAME), - 'stage': RequestCom, - 'permissions': default_permissions, + "display": _("Internal Review"), + "public": _("{org_short_name} Review").format( + org_short_name=settings.ORG_SHORT_NAME + ), + "stage": RequestCom, + "permissions": default_permissions, }, - 'com_community_review': { - 'transitions': { - 'com_post_review_discussion': _('Close Review'), - 'com_internal_review': _('Open Internal Review (revert)'), - 'com_rejected': _('Dismiss'), + "com_community_review": { + "transitions": { + "com_post_review_discussion": _("Close Review"), + "com_internal_review": _("Open Internal Review (revert)"), + "com_rejected": _("Dismiss"), }, - 'display': _('Community Review'), - 'public': _('{org_short_name} Review').format(org_short_name=settings.ORG_SHORT_NAME), - 'stage': RequestCom, - 'permissions': community_review_permissions, + "display": _("Community Review"), + "public": _("{org_short_name} Review").format( + org_short_name=settings.ORG_SHORT_NAME + ), + "stage": RequestCom, + "permissions": community_review_permissions, }, }, { - 'com_post_review_discussion': { - 'transitions': { - 'com_post_review_more_info': _('Request More Information'), - 'com_external_review': _('Open External Review'), - 'com_determination': _('Ready For Determination'), - 'com_internal_review': _('Open Internal Review (revert)'), - 'com_rejected': _('Dismiss'), + "com_post_review_discussion": { + "transitions": { + "com_post_review_more_info": _("Request More Information"), + "com_external_review": _("Open External Review"), + "com_determination": _("Ready For Determination"), + "com_internal_review": _("Open Internal Review (revert)"), + "com_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': RequestCom, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": RequestCom, + "permissions": hidden_from_applicant_permissions, }, - 'com_post_review_more_info': { - 'transitions': { - 'com_post_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "com_post_review_more_info": { + "transitions": { + "com_post_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': RequestCom, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": RequestCom, + "permissions": applicant_edit_permissions, }, }, { - 'com_external_review': { - 'transitions': { - 'com_post_external_review_discussion': _('Close Review'), - 'com_post_review_discussion': _('Ready For Discussion (revert)'), + "com_external_review": { + "transitions": { + "com_post_external_review_discussion": _("Close Review"), + "com_post_review_discussion": _("Ready For Discussion (revert)"), }, - 'display': _('External Review'), - 'stage': RequestCom, - 'permissions': reviewer_review_permissions, + "display": _("External Review"), + "stage": RequestCom, + "permissions": reviewer_review_permissions, }, }, { - 'com_post_external_review_discussion': { - 'transitions': { - 'com_post_external_review_more_info': _('Request More Information'), - 'com_determination': _('Ready For Determination'), - 'com_external_review': _('Open External Review (revert)'), - 'com_almost': _('Accept but additional info required'), - 'com_accepted': _('Accept'), - 'com_rejected': _('Dismiss'), + "com_post_external_review_discussion": { + "transitions": { + "com_post_external_review_more_info": _("Request More Information"), + "com_determination": _("Ready For Determination"), + "com_external_review": _("Open External Review (revert)"), + "com_almost": _("Accept but additional info required"), + "com_accepted": _("Accept"), + "com_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': RequestCom, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": RequestCom, + "permissions": hidden_from_applicant_permissions, }, - 'com_post_external_review_more_info': { - 'transitions': { - 'com_post_external_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "com_post_external_review_more_info": { + "transitions": { + "com_post_external_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': RequestCom, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": RequestCom, + "permissions": applicant_edit_permissions, }, }, { - 'com_determination': { - 'transitions': { - 'com_post_external_review_discussion': _('Ready For Discussion (revert)'), - 'com_almost': _('Accept but additional info required'), - 'com_accepted': _('Accept'), - 'com_rejected': _('Dismiss'), + "com_determination": { + "transitions": { + "com_post_external_review_discussion": _( + "Ready For Discussion (revert)" + ), + "com_almost": _("Accept but additional info required"), + "com_accepted": _("Accept"), + "com_rejected": _("Dismiss"), }, - 'display': _('Ready for Determination'), - 'permissions': hidden_from_applicant_permissions, - 'stage': RequestCom, + "display": _("Ready for Determination"), + "permissions": hidden_from_applicant_permissions, + "stage": RequestCom, }, }, { - 'com_accepted': { - 'display': _('Accepted'), - 'future': _('Application Outcome'), - 'stage': RequestCom, - 'permissions': staff_edit_permissions, + "com_accepted": { + "display": _("Accepted"), + "future": _("Application Outcome"), + "stage": RequestCom, + "permissions": staff_edit_permissions, }, - 'com_almost': { - 'transitions': { - 'com_accepted': _('Accept'), - 'com_post_external_review_discussion': _('Ready For Discussion (revert)'), + "com_almost": { + "transitions": { + "com_accepted": _("Accept"), + "com_post_external_review_discussion": _( + "Ready For Discussion (revert)" + ), }, - 'display': _('Accepted but additional info required'), - 'stage': RequestCom, - 'permissions': applicant_edit_permissions, + "display": _("Accepted but additional info required"), + "stage": RequestCom, + "permissions": applicant_edit_permissions, }, - 'com_rejected': { - 'display': _('Dismissed'), - 'stage': RequestCom, - 'permissions': no_permissions, + "com_rejected": { + "display": _("Dismissed"), + "stage": RequestCom, + "permissions": no_permissions, }, }, ] @@ -673,273 +761,310 @@ def make_permissions(edit=None, review=None, view=None): DoubleStageDefinition = [ { DRAFT_STATE: { - 'transitions': { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": {UserPermissions.APPLICANT}, + "method": "create_revision", }, }, - 'display': _('Draft'), - 'stage': Concept, - 'permissions': applicant_edit_permissions, + "display": _("Draft"), + "stage": Concept, + "permissions": applicant_edit_permissions, } }, { INITIAL_STATE: { - 'transitions': { - 'concept_more_info': _('Request More Information'), - 'concept_internal_review': _('Open Review'), - 'concept_determination': _('Ready For Preliminary Determination'), - 'invited_to_proposal': _('Invite to Proposal'), - 'concept_rejected': _('Dismiss'), + "transitions": { + "concept_more_info": _("Request More Information"), + "concept_internal_review": _("Open Review"), + "concept_determination": _("Ready For Preliminary Determination"), + "invited_to_proposal": _("Invite to Proposal"), + "concept_rejected": _("Dismiss"), }, - 'display': _('Need screening'), - 'public': _('Concept Note Received'), - 'stage': Concept, - 'permissions': default_permissions, + "display": _("Need screening"), + "public": _("Concept Note Received"), + "stage": Concept, + "permissions": default_permissions, }, - 'concept_more_info': { - 'transitions': { + "concept_more_info": { + "transitions": { INITIAL_STATE: { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, - 'concept_rejected': _('Dismiss'), - 'invited_to_proposal': _('Invite to Proposal'), - 'concept_determination': _('Ready For Preliminary Determination'), + "concept_rejected": _("Dismiss"), + "invited_to_proposal": _("Invite to Proposal"), + "concept_determination": _("Ready For Preliminary Determination"), }, - 'display': _('More information required'), - 'stage': Concept, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Concept, + "permissions": applicant_edit_permissions, }, }, { - 'concept_internal_review': { - 'transitions': { - 'concept_review_discussion': _('Close Review'), - INITIAL_STATE: _('Need screening (revert)'), - 'invited_to_proposal': _('Invite to Proposal'), + "concept_internal_review": { + "transitions": { + "concept_review_discussion": _("Close Review"), + INITIAL_STATE: _("Need screening (revert)"), + "invited_to_proposal": _("Invite to Proposal"), }, - 'display': _('Internal Review'), - 'public': _('{org_short_name} Review').format(org_short_name=settings.ORG_SHORT_NAME), - 'stage': Concept, - 'permissions': default_permissions, + "display": _("Internal Review"), + "public": _("{org_short_name} Review").format( + org_short_name=settings.ORG_SHORT_NAME + ), + "stage": Concept, + "permissions": default_permissions, }, }, { - 'concept_review_discussion': { - 'transitions': { - 'concept_review_more_info': _('Request More Information'), - 'concept_determination': _('Ready For Preliminary Determination'), - 'concept_internal_review': _('Open Review (revert)'), - 'invited_to_proposal': _('Invite to Proposal'), - 'concept_rejected': _('Dismiss'), + "concept_review_discussion": { + "transitions": { + "concept_review_more_info": _("Request More Information"), + "concept_determination": _("Ready For Preliminary Determination"), + "concept_internal_review": _("Open Review (revert)"), + "invited_to_proposal": _("Invite to Proposal"), + "concept_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': Concept, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": Concept, + "permissions": hidden_from_applicant_permissions, }, - 'concept_review_more_info': { - 'transitions': { - 'concept_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "concept_review_more_info": { + "transitions": { + "concept_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, - 'invited_to_proposal': _('Invite to Proposal'), + "invited_to_proposal": _("Invite to Proposal"), }, - 'display': _('More information required'), - 'stage': Concept, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Concept, + "permissions": applicant_edit_permissions, }, }, { - 'concept_determination': { - 'transitions': { - 'concept_review_discussion': _('Ready For Discussion (revert)'), - 'invited_to_proposal': _('Invite to Proposal'), - 'concept_rejected': _('Dismiss'), + "concept_determination": { + "transitions": { + "concept_review_discussion": _("Ready For Discussion (revert)"), + "invited_to_proposal": _("Invite to Proposal"), + "concept_rejected": _("Dismiss"), }, - 'display': _('Ready for Preliminary Determination'), - 'permissions': hidden_from_applicant_permissions, - 'stage': Concept, + "display": _("Ready for Preliminary Determination"), + "permissions": hidden_from_applicant_permissions, + "stage": Concept, }, }, { - 'invited_to_proposal': { - 'display': _('Concept Accepted'), - 'future': _('Preliminary Determination'), - 'transitions': { - 'draft_proposal': { - 'display': _('Progress'), - 'method': 'progress_application', - 'permissions': {UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'conditions': 'not_progressed', + "invited_to_proposal": { + "display": _("Concept Accepted"), + "future": _("Preliminary Determination"), + "transitions": { + "draft_proposal": { + "display": _("Progress"), + "method": "progress_application", + "permissions": { + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "conditions": "not_progressed", }, }, - 'stage': Concept, - 'permissions': no_permissions, + "stage": Concept, + "permissions": no_permissions, }, - 'concept_rejected': { - 'display': _('Dismissed'), - 'stage': Concept, - 'permissions': no_permissions, + "concept_rejected": { + "display": _("Dismissed"), + "stage": Concept, + "permissions": no_permissions, }, }, { - 'draft_proposal': { - 'transitions': { - 'proposal_discussion': {'display': _('Submit'), 'permissions': {UserPermissions.APPLICANT}, 'method': 'create_revision'}, - 'external_review': _('Open External Review'), - 'proposal_determination': _('Ready For Final Determination'), - 'proposal_rejected': _('Dismiss'), + "draft_proposal": { + "transitions": { + "proposal_discussion": { + "display": _("Submit"), + "permissions": {UserPermissions.APPLICANT}, + "method": "create_revision", + }, + "external_review": _("Open External Review"), + "proposal_determination": _("Ready For Final Determination"), + "proposal_rejected": _("Dismiss"), }, - 'display': _('Invited for Proposal'), - 'stage': Proposal, - 'permissions': applicant_edit_permissions, + "display": _("Invited for Proposal"), + "stage": Proposal, + "permissions": applicant_edit_permissions, }, }, { - 'proposal_discussion': { - 'transitions': { - 'proposal_more_info': _('Request More Information'), - 'proposal_internal_review': _('Open Review'), - 'external_review': _('Open External Review'), - 'proposal_determination': _('Ready For Final Determination'), - 'proposal_rejected': _('Dismiss'), + "proposal_discussion": { + "transitions": { + "proposal_more_info": _("Request More Information"), + "proposal_internal_review": _("Open Review"), + "external_review": _("Open External Review"), + "proposal_determination": _("Ready For Final Determination"), + "proposal_rejected": _("Dismiss"), }, - 'display': _('Proposal Received'), - 'stage': Proposal, - 'permissions': default_permissions, + "display": _("Proposal Received"), + "stage": Proposal, + "permissions": default_permissions, }, - 'proposal_more_info': { - 'transitions': { - 'proposal_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "proposal_more_info": { + "transitions": { + "proposal_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, - 'external_review': _('Open External Review'), - 'proposal_determination': _('Ready For Final Determination'), - 'proposal_rejected': _('Dismiss'), + "external_review": _("Open External Review"), + "proposal_determination": _("Ready For Final Determination"), + "proposal_rejected": _("Dismiss"), }, - 'display': _('More information required'), - 'stage': Proposal, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Proposal, + "permissions": applicant_edit_permissions, }, }, { - 'proposal_internal_review': { - 'transitions': { - 'post_proposal_review_discussion': _('Close Review'), - 'proposal_discussion': _('Proposal Received (revert)'), + "proposal_internal_review": { + "transitions": { + "post_proposal_review_discussion": _("Close Review"), + "proposal_discussion": _("Proposal Received (revert)"), }, - 'display': _('Internal Review'), - 'public': _('{org_short_name} Review').format(org_short_name=settings.ORG_SHORT_NAME), - 'stage': Proposal, - 'permissions': default_permissions, + "display": _("Internal Review"), + "public": _("{org_short_name} Review").format( + org_short_name=settings.ORG_SHORT_NAME + ), + "stage": Proposal, + "permissions": default_permissions, }, }, { - 'post_proposal_review_discussion': { - 'transitions': { - 'post_proposal_review_more_info': _('Request More Information'), - 'external_review': _('Open External Review'), - 'proposal_determination': _('Ready For Final Determination'), - 'proposal_internal_review': _('Open Internal Review (revert)'), - 'proposal_rejected': _('Dismiss'), + "post_proposal_review_discussion": { + "transitions": { + "post_proposal_review_more_info": _("Request More Information"), + "external_review": _("Open External Review"), + "proposal_determination": _("Ready For Final Determination"), + "proposal_internal_review": _("Open Internal Review (revert)"), + "proposal_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': Proposal, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": Proposal, + "permissions": hidden_from_applicant_permissions, }, - 'post_proposal_review_more_info': { - 'transitions': { - 'post_proposal_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "post_proposal_review_more_info": { + "transitions": { + "post_proposal_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, - 'external_review': _('Open External Review'), + "external_review": _("Open External Review"), }, - 'display': _('More information required'), - 'stage': Proposal, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Proposal, + "permissions": applicant_edit_permissions, }, }, { - 'external_review': { - 'transitions': { - 'post_external_review_discussion': _('Close Review'), - 'post_proposal_review_discussion': _('Ready For Discussion (revert)'), + "external_review": { + "transitions": { + "post_external_review_discussion": _("Close Review"), + "post_proposal_review_discussion": _("Ready For Discussion (revert)"), }, - 'display': _('External Review'), - 'stage': Proposal, - 'permissions': reviewer_review_permissions, + "display": _("External Review"), + "stage": Proposal, + "permissions": reviewer_review_permissions, }, }, { - 'post_external_review_discussion': { - 'transitions': { - 'post_external_review_more_info': _('Request More Information'), - 'proposal_determination': _('Ready For Final Determination'), - 'external_review': _('Open External Review (revert)'), - 'proposal_almost': _('Accept but additional info required'), - 'proposal_accepted': _('Accept'), - 'proposal_rejected': _('Dismiss'), + "post_external_review_discussion": { + "transitions": { + "post_external_review_more_info": _("Request More Information"), + "proposal_determination": _("Ready For Final Determination"), + "external_review": _("Open External Review (revert)"), + "proposal_almost": _("Accept but additional info required"), + "proposal_accepted": _("Accept"), + "proposal_rejected": _("Dismiss"), }, - 'display': _('Ready For Discussion'), - 'stage': Proposal, - 'permissions': hidden_from_applicant_permissions, + "display": _("Ready For Discussion"), + "stage": Proposal, + "permissions": hidden_from_applicant_permissions, }, - 'post_external_review_more_info': { - 'transitions': { - 'post_external_review_discussion': { - 'display': _('Submit'), - 'permissions': {UserPermissions.APPLICANT, UserPermissions.STAFF, UserPermissions.LEAD, UserPermissions.ADMIN}, - 'method': 'create_revision', + "post_external_review_more_info": { + "transitions": { + "post_external_review_discussion": { + "display": _("Submit"), + "permissions": { + UserPermissions.APPLICANT, + UserPermissions.STAFF, + UserPermissions.LEAD, + UserPermissions.ADMIN, + }, + "method": "create_revision", }, }, - 'display': _('More information required'), - 'stage': Proposal, - 'permissions': applicant_edit_permissions, + "display": _("More information required"), + "stage": Proposal, + "permissions": applicant_edit_permissions, }, }, { - 'proposal_determination': { - 'transitions': { - 'post_external_review_discussion': _('Ready For Discussion (revert)'), - 'proposal_almost': _('Accept but additional info required'), - 'proposal_accepted': _('Accept'), - 'proposal_rejected': _('Dismiss'), + "proposal_determination": { + "transitions": { + "post_external_review_discussion": _("Ready For Discussion (revert)"), + "proposal_almost": _("Accept but additional info required"), + "proposal_accepted": _("Accept"), + "proposal_rejected": _("Dismiss"), }, - 'display': _('Ready for Final Determination'), - 'permissions': hidden_from_applicant_permissions, - 'stage': Proposal, + "display": _("Ready for Final Determination"), + "permissions": hidden_from_applicant_permissions, + "stage": Proposal, }, }, { - 'proposal_accepted': { - 'display': _('Accepted'), - 'future': _('Final Determination'), - 'stage': Proposal, - 'permissions': staff_edit_permissions, + "proposal_accepted": { + "display": _("Accepted"), + "future": _("Final Determination"), + "stage": Proposal, + "permissions": staff_edit_permissions, }, - 'proposal_almost': { - 'transitions': { - 'proposal_accepted': _('Accept'), - 'post_external_review_discussion': _('Ready For Discussion (revert)'), + "proposal_almost": { + "transitions": { + "proposal_accepted": _("Accept"), + "post_external_review_discussion": _("Ready For Discussion (revert)"), }, - 'display': _('Accepted but additional info required'), - 'stage': Proposal, - 'permissions': applicant_edit_permissions, + "display": _("Accepted but additional info required"), + "stage": Proposal, + "permissions": applicant_edit_permissions, }, - 'proposal_rejected': { - 'display': _('Dismissed'), - 'stage': Proposal, - 'permissions': no_permissions, + "proposal_rejected": { + "display": _("Dismissed"), + "stage": Proposal, + "permissions": no_permissions, }, }, ] @@ -958,13 +1083,23 @@ def phase_data(phases): } -Request = Workflow('Request', 'single', **phase_data(SingleStageDefinition)) +Request = Workflow("Request", "single", **phase_data(SingleStageDefinition)) -RequestExternal = Workflow('Request with external review', 'single_ext', **phase_data(SingleStageExternalDefinition)) +RequestExternal = Workflow( + "Request with external review", + "single_ext", + **phase_data(SingleStageExternalDefinition), +) -RequestCommunity = Workflow('Request with community review', 'single_com', **phase_data(SingleStageCommunityDefinition)) +RequestCommunity = Workflow( + "Request with community review", + "single_com", + **phase_data(SingleStageCommunityDefinition), +) -ConceptProposal = Workflow('Concept & Proposal', 'double', **phase_data(DoubleStageDefinition)) +ConceptProposal = Workflow( + "Concept & Proposal", "double", **phase_data(DoubleStageDefinition) +) WORKFLOWS = { @@ -977,7 +1112,9 @@ def phase_data(phases): # This is not a dictionary as the keys will clash for the first phase of each workflow # We cannot find the transitions for the first stage in this instance -PHASES = list(itertools.chain.from_iterable(workflow.items() for workflow in WORKFLOWS.values())) +PHASES = list( + itertools.chain.from_iterable(workflow.items() for workflow in WORKFLOWS.values()) +) def get_stage_change_actions(): @@ -1001,8 +1138,9 @@ def get_stage_change_actions(): STATUSES[value.display_name].add(key) active_statuses = [ - status for status, _ in PHASES - if 'accepted' not in status and 'rejected' not in status and 'invited' not in status + status + for status, _ in PHASES + if "accepted" not in status and "rejected" not in status and "invited" not in status ] @@ -1022,7 +1160,7 @@ def get_review_statuses(user=None): reviews = set() for phase_name, phase in PHASES: - if 'review' in phase_name and 'discussion' not in phase_name: + if "review" in phase_name and "discussion" not in phase_name: if user is None: reviews.add(phase_name) elif phase.permissions.can_review(user): @@ -1034,7 +1172,7 @@ def get_ext_review_statuses(): reviews = set() for phase_name, _phase in PHASES: - if phase_name.endswith('external_review'): + if phase_name.endswith("external_review"): reviews.add(phase_name) return reviews @@ -1049,7 +1187,7 @@ def get_ext_or_higher_statuses(): for workflow in WORKFLOWS.values(): step = None for phase in workflow.values(): - if phase.name.endswith('external_review'): + if phase.name.endswith("external_review"): # Update the step for this workflow as External review state step = phase.step @@ -1063,7 +1201,7 @@ def get_ext_or_higher_statuses(): def get_accepted_statuses(): accepted_statuses = set() for phase_name, phase in PHASES: - if phase.display_name == 'Accepted': + if phase.display_name == "Accepted": accepted_statuses.add(phase_name) return accepted_statuses @@ -1071,7 +1209,7 @@ def get_accepted_statuses(): def get_dismissed_statuses(): dismissed_statuses = set() for phase_name, phase in PHASES: - if phase.display_name == 'Dismissed': + if phase.display_name == "Dismissed": dismissed_statuses.add(phase_name) return dismissed_statuses @@ -1082,13 +1220,15 @@ def get_dismissed_statuses(): accepted_statuses = get_accepted_statuses() dismissed_statuses = get_dismissed_statuses() -DETERMINATION_PHASES = [phase_name for phase_name, _ in PHASES if '_discussion' in phase_name] +DETERMINATION_PHASES = [ + phase_name for phase_name, _ in PHASES if "_discussion" in phase_name +] DETERMINATION_RESPONSE_PHASES = [ - 'post_review_discussion', - 'concept_review_discussion', - 'post_external_review_discussion', - 'ext_post_external_review_discussion', - 'com_post_external_review_discussion', + "post_review_discussion", + "concept_review_discussion", + "post_external_review_discussion", + "ext_post_external_review_discussion", + "com_post_external_review_discussion", ] @@ -1096,31 +1236,31 @@ def get_determination_transitions(): transitions = {} for _phase_name, phase in PHASES: for transition_name in phase.transitions: - if 'accepted' in transition_name: - transitions[transition_name] = 'accepted' - elif 'rejected' in transition_name: - transitions[transition_name] = 'rejected' - elif 'more_info' in transition_name: - transitions[transition_name] = 'more_info' - elif 'invited_to_proposal' in transition_name: - transitions[transition_name] = 'accepted' + if "accepted" in transition_name: + transitions[transition_name] = "accepted" + elif "rejected" in transition_name: + transitions[transition_name] = "rejected" + elif "more_info" in transition_name: + transitions[transition_name] = "more_info" + elif "invited_to_proposal" in transition_name: + transitions[transition_name] = "accepted" return transitions def get_action_mapping(workflow): # Maps action names to the phase they originate from - transitions = defaultdict(lambda: {'display': '', 'transitions': []}) + transitions = defaultdict(lambda: {"display": "", "transitions": []}) if workflow: phases = workflow.items() else: phases = PHASES for _phase_name, phase in phases: for transition_name, transition in phase.transitions.items(): - transition_display = transition['display'] + transition_display = transition["display"] transition_key = slugify(transition_display) - transitions[transition_key]['transitions'].append(transition_name) - transitions[transition_key]['display'] = transition_display + transitions[transition_key]["transitions"].append(transition_name) + transitions[transition_key]["display"] = transition_display return transitions @@ -1132,54 +1272,57 @@ def phases_matching(phrase, exclude=None): if exclude is None: exclude = [] return [ - status for status, _ in PHASES + status + for status, _ in PHASES if status.endswith(phrase) and status not in exclude ] PHASES_MAPPING = { - 'received': { - 'name': _('Received'), - 'statuses': [INITIAL_STATE, 'proposal_discussion'], + "received": { + "name": _("Received"), + "statuses": [INITIAL_STATE, "proposal_discussion"], }, - 'internal-review': { - 'name': _('Internal Review'), - 'statuses': phases_matching('internal_review'), + "internal-review": { + "name": _("Internal Review"), + "statuses": phases_matching("internal_review"), }, - 'in-discussion': { - 'name': _('Ready for Discussion'), - 'statuses': phases_matching('discussion', exclude=[INITIAL_STATE, 'proposal_discussion']), + "in-discussion": { + "name": _("Ready for Discussion"), + "statuses": phases_matching( + "discussion", exclude=[INITIAL_STATE, "proposal_discussion"] + ), }, - 'more-information': { - 'name': _('More Information Requested'), - 'statuses': phases_matching('more_info'), + "more-information": { + "name": _("More Information Requested"), + "statuses": phases_matching("more_info"), }, - 'invited-for-proposal': { - 'name': _('Invited for Proposal'), - 'statuses': ['draft_proposal'], + "invited-for-proposal": { + "name": _("Invited for Proposal"), + "statuses": ["draft_proposal"], }, - 'external-review': { - 'name': _('External Review'), - 'statuses': phases_matching('external_review'), + "external-review": { + "name": _("External Review"), + "statuses": phases_matching("external_review"), }, - 'ready-for-determination': { - 'name': _('Ready for Determination'), - 'statuses': phases_matching('determination'), + "ready-for-determination": { + "name": _("Ready for Determination"), + "statuses": phases_matching("determination"), }, - 'accepted': { - 'name': _('Accepted'), - 'statuses': phases_matching('accepted'), + "accepted": { + "name": _("Accepted"), + "statuses": phases_matching("accepted"), }, - 'dismissed': { - 'name': _('Dismissed'), - 'statuses': phases_matching('rejected'), + "dismissed": { + "name": _("Dismissed"), + "statuses": phases_matching("rejected"), }, } OPEN_CALL_PHASES = [ - 'com_open_call', + "com_open_call", ] COMMUNITY_REVIEW_PHASES = [ - 'com_community_review', + "com_community_review", ] diff --git a/hypha/apply/home/apps.py b/hypha/apply/home/apps.py index 7c48ce212d..371d57ffc0 100644 --- a/hypha/apply/home/apps.py +++ b/hypha/apply/home/apps.py @@ -2,5 +2,5 @@ class HomeConfig(AppConfig): - name = 'hypha.apply.home' - label = 'apply_home' + name = "hypha.apply.home" + label = "apply_home" diff --git a/hypha/apply/home/factories.py b/hypha/apply/home/factories.py index bd18111c0b..0a6219b676 100644 --- a/hypha/apply/home/factories.py +++ b/hypha/apply/home/factories.py @@ -5,12 +5,12 @@ class ApplySiteFactory(wagtail_factories.SiteFactory): class Meta: - django_get_or_create = ('hostname',) + django_get_or_create = ("hostname",) class ApplyHomePageFactory(wagtail_factories.PageFactory): title = "Apply Home" - slug = 'apply' + slug = "apply" class Meta: model = ApplyHomePage @@ -19,6 +19,6 @@ class Meta: def _create(cls, model_class, *args, **kwargs): try: # We cant use "django_get_or_create" in meta as wagtail factories wont respect it - return model_class.objects.get(slug=kwargs['slug']) + return model_class.objects.get(slug=kwargs["slug"]) except model_class.DoesNotExist: return super()._create(model_class, *args, **kwargs) diff --git a/hypha/apply/home/migrations/0001_initial.py b/hypha/apply/home/migrations/0001_initial.py index 01f1ecb8ad..932d09eddf 100644 --- a/hypha/apply/home/migrations/0001_initial.py +++ b/hypha/apply/home/migrations/0001_initial.py @@ -7,23 +7,32 @@ class Migration(migrations.Migration): - initial = True dependencies = [ - ('wagtailcore', '0040_page_draft_title'), + ("wagtailcore", "0040_page_draft_title"), ] operations = [ migrations.CreateModel( - name='ApplyHomePage', + name="ApplyHomePage", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), - ('strapline', models.CharField(blank=True, max_length=255)), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.Page", + ), + ), + ("strapline", models.CharField(blank=True, max_length=255)), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('wagtailcore.page',), + bases=("wagtailcore.page",), ), ] diff --git a/hypha/apply/home/migrations/0002_add_apply_homepage.py b/hypha/apply/home/migrations/0002_add_apply_homepage.py index 2c8493a368..e89e2545e5 100644 --- a/hypha/apply/home/migrations/0002_add_apply_homepage.py +++ b/hypha/apply/home/migrations/0002_add_apply_homepage.py @@ -6,40 +6,41 @@ def create_homepage(apps, schema_editor): # Get models - ContentType = apps.get_model('contenttypes.ContentType') - Site = apps.get_model('wagtailcore.Site') - ApplyHomePage = apps.get_model('apply_home.ApplyHomePage') + ContentType = apps.get_model("contenttypes.ContentType") + Site = apps.get_model("wagtailcore.Site") + ApplyHomePage = apps.get_model("apply_home.ApplyHomePage") # Create content type for homepage model homepage_content_type, created = ContentType.objects.get_or_create( - model='applyhomepage', app_label='apply_home') + model="applyhomepage", app_label="apply_home" + ) # Create a new homepage applyhomepage = ApplyHomePage.objects.create( title="Apply Homepage", draft_title="Apply Homepage", - slug='apply', + slug="apply", content_type=homepage_content_type, - path='00010002', + path="00010002", depth=2, numchild=0, - url_path='/apply/', + url_path="/apply/", ) # Create a site with the new homepage set as the root Site.objects.create( - hostname='apply.localhost', root_page=applyhomepage, is_default_site=False) + hostname="apply.localhost", root_page=applyhomepage, is_default_site=False + ) class Migration(migrations.Migration): - run_before = [ - ('wagtailcore', '0053_locale_model'), # added for Wagtail 2.11 compatibility + ("wagtailcore", "0053_locale_model"), # added for Wagtail 2.11 compatibility ] dependencies = [ - ('funds', '0001_initial'), - ('apply_home', '0001_initial'), + ("funds", "0001_initial"), + ("apply_home", "0001_initial"), ] operations = [ diff --git a/hypha/apply/home/models.py b/hypha/apply/home/models.py index 207c1cdb5b..b629afe54c 100644 --- a/hypha/apply/home/models.py +++ b/hypha/apply/home/models.py @@ -9,31 +9,33 @@ from hypha.apply.funds.models import ApplicationBase, LabBase -@method_decorator(cache_page, name='serve') +@method_decorator(cache_page, name="serve") class ApplyHomePage(WagtailCacheMixin, Page): # Only allow creating HomePages at the root level - parent_page_types = ['wagtailcore.Page'] - subpage_types = ['funds.FundType', 'funds.LabType', 'funds.RequestForPartners'] + parent_page_types = ["wagtailcore.Page"] + subpage_types = ["funds.FundType", "funds.LabType", "funds.RequestForPartners"] strapline = models.CharField(blank=True, max_length=255) search_fields = Page.search_fields + [ - index.SearchField('strapline'), + index.SearchField("strapline"), ] content_panels = Page.content_panels + [ - FieldPanel('strapline'), + FieldPanel("strapline"), ] def cache_control(self): - return f'public, s-maxage={settings.CACHE_CONTROL_S_MAXAGE}' + return f"public, s-maxage={settings.CACHE_CONTROL_S_MAXAGE}" def get_context(self, *args, **kwargs): context = super().get_context(*args, **kwargs) - context['open_funds'] = ApplicationBase.objects.order_by_end_date().prefetch_related( - 'application_public' - ).specific() - context['open_labs'] = LabBase.objects.public().live().prefetch_related( - 'lab_public' - ).specific() + context["open_funds"] = ( + ApplicationBase.objects.order_by_end_date() + .prefetch_related("application_public") + .specific() + ) + context["open_labs"] = ( + LabBase.objects.public().live().prefetch_related("lab_public").specific() + ) return context diff --git a/hypha/apply/home/templates/apply_home/apply_home_page.html b/hypha/apply/home/templates/apply_home/apply_home_page.html index 6f93c09690..b8ddabc587 100644 --- a/hypha/apply/home/templates/apply_home/apply_home_page.html +++ b/hypha/apply/home/templates/apply_home/apply_home_page.html @@ -6,26 +6,26 @@ {% block header_modifier %}header--light-bg{% endblock %} {% block content %} -
    - {% if page.strapline %} -

    {{ page.strapline }}

    - {% endif %} +
    + {% if page.strapline %} +

    {{ page.strapline }}

    + {% endif %} -
    - -
    +
    + +
    -
    - {% for fund in open_funds %} - {% include "apply_home/includes/apply_listing.html" with page=fund %} - {% endfor %} - {% for lab in open_labs %} - {% include "apply_home/includes/apply_listing.html" with page=lab %} - {% endfor %} -
    +
    + {% for fund in open_funds %} + {% include "apply_home/includes/apply_listing.html" with page=fund %} + {% endfor %} + {% for lab in open_labs %} + {% include "apply_home/includes/apply_listing.html" with page=lab %} + {% endfor %} +
    -
    - +
    + +
    -
    {% endblock %} diff --git a/hypha/apply/home/templates/apply_home/includes/apply_listing.html b/hypha/apply/home/templates/apply_home/includes/apply_listing.html index 83648ae4b4..81427c5a09 100644 --- a/hypha/apply/home/templates/apply_home/includes/apply_listing.html +++ b/hypha/apply/home/templates/apply_home/includes/apply_listing.html @@ -1,32 +1,32 @@ {% load i18n wagtailcore_tags %} {% with details=page.detail %} -{% if page.open_round %} - -{% endif %} + {% if details.listing_summary or details.introduction %} +
    {{ details.listing_summary|default:details.introduction|truncatechars_html:120 }}
    + {% endif %} +
    + {% trans "Apply" %} + + {% endif %} {% endwith %} diff --git a/hypha/apply/home/wagtail_hooks.py b/hypha/apply/home/wagtail_hooks.py index e20cd2c4eb..2987a90540 100644 --- a/hypha/apply/home/wagtail_hooks.py +++ b/hypha/apply/home/wagtail_hooks.py @@ -5,7 +5,7 @@ from .models import ApplyHomePage -@hooks.register('construct_explorer_page_queryset') +@hooks.register("construct_explorer_page_queryset") def exclude_fund_pages(parent_page, pages, request): # Don't allow editors to access the Apply pages in the explorer unless they know whats up if not request.user.is_superuser: @@ -14,10 +14,10 @@ def exclude_fund_pages(parent_page, pages, request): return pages -@hooks.register('construct_main_menu') +@hooks.register("construct_main_menu") def hide_explorer_menu_item_from_frank(request, menu_items): if not request.user.is_superuser: groups = list(request.user.groups.all()) # If the user is only in the staff group they should never see the explorer menu item if len(groups) == 1 and groups[0].name == STAFF_GROUP_NAME: - menu_items[:] = [item for item in menu_items if item.name != 'explorer'] + menu_items[:] = [item for item in menu_items if item.name != "explorer"] diff --git a/hypha/apply/middleware.py b/hypha/apply/middleware.py index 4ea682451e..dcea249bc1 100644 --- a/hypha/apply/middleware.py +++ b/hypha/apply/middleware.py @@ -15,7 +15,9 @@ def process_exception(self, request, exception): if isinstance(exception, ProtectedError): messages.error( request, - _('The object you are trying to delete is used somewhere. Please remove any usages and try again!.'), + _( + "The object you are trying to delete is used somewhere. Please remove any usages and try again!." + ), ) return HttpResponseRedirect(request.path) @@ -35,7 +37,7 @@ def middleware(request): site = Site.find_for_request(request) homepage = site.root_page.specific if isinstance(homepage, ApplyHomePage): - request.urlconf = 'hypha.apply.urls' + request.urlconf = "hypha.apply.urls" response = get_response(request) return response diff --git a/hypha/apply/projects/admin.py b/hypha/apply/projects/admin.py index a93bf2145c..a435351ccf 100644 --- a/hypha/apply/projects/admin.py +++ b/hypha/apply/projects/admin.py @@ -21,41 +21,53 @@ class DocumentCategoryAdmin(ModelAdmin): model = DocumentCategory - menu_icon = 'doc-full' - list_display = ('name', 'required',) + menu_icon = "doc-full" + list_display = ( + "name", + "required", + ) class ContractDocumentCategoryAdmin(ModelAdmin): model = ContractDocumentCategory - menu_icon = 'doc-full' - list_display = ('name', 'required',) + menu_icon = "doc-full" + list_display = ( + "name", + "required", + ) class ProjectApprovalFormAdmin(ListRelatedMixin, ModelAdmin): model = ProjectApprovalForm - menu_label = 'Approval Forms' - menu_icon = 'form' - list_display = ('name', 'used_by',) + menu_label = "Approval Forms" + menu_icon = "form" + list_display = ( + "name", + "used_by", + ) create_view_class = CreateProjectApprovalFormView edit_view_class = EditProjectApprovalFormView related_models = [ - ('applicationbaseprojectapprovalform', 'application'), - ('labbaseprojectapprovalform', 'lab'), + ("applicationbaseprojectapprovalform", "application"), + ("labbaseprojectapprovalform", "lab"), ] class ProjectSOWFormAdmin(ListRelatedMixin, ModelAdmin): model = ProjectSOWForm - menu_label = 'SOW Forms' - menu_icon = 'form' - list_display = ('name', 'used_by',) + menu_label = "SOW Forms" + menu_icon = "form" + list_display = ( + "name", + "used_by", + ) create_view_class = CreateProjectSOWFormView edit_view_class = EditProjectSOWFormView related_models = [ - ('applicationbaseprojectsowform', 'application'), - ('labbaseprojectsowform', 'lab'), + ("applicationbaseprojectsowform", "application"), + ("labbaseprojectsowform", "lab"), ] @@ -68,8 +80,8 @@ class VendorFormSettingsAdmin(SettingModelAdmin): class ProjectAdminGroup(ModelAdminGroup): - menu_label = 'Projects' - menu_icon = 'duplicate' + menu_label = "Projects" + menu_icon = "duplicate" items = ( ContractDocumentCategoryAdmin, DocumentCategoryAdmin, diff --git a/hypha/apply/projects/admin_views.py b/hypha/apply/projects/admin_views.py index 16299278ec..5dcc4c04d8 100644 --- a/hypha/apply/projects/admin_views.py +++ b/hypha/apply/projects/admin_views.py @@ -4,14 +4,12 @@ class CreateProjectApprovalFormView(CreateView): - def form_invalid(self, form): show_admin_form_error_messages(self.request, form) return self.render_to_response(self.get_context_data(form=form)) class EditProjectApprovalFormView(EditView): - def form_invalid(self, form): show_admin_form_error_messages(self.request, form) return self.render_to_response(self.get_context_data(form=form)) diff --git a/hypha/apply/projects/apps.py b/hypha/apply/projects/apps.py index 7a1e1771b3..2858cc3a69 100644 --- a/hypha/apply/projects/apps.py +++ b/hypha/apply/projects/apps.py @@ -2,5 +2,5 @@ class ProjectsConfig(AppConfig): - name = 'hypha.apply.projects' - label = 'application_projects' + name = "hypha.apply.projects" + label = "application_projects" diff --git a/hypha/apply/projects/context_processors.py b/hypha/apply/projects/context_processors.py index b04840afcf..17fc8cba12 100644 --- a/hypha/apply/projects/context_processors.py +++ b/hypha/apply/projects/context_processors.py @@ -2,4 +2,4 @@ def projects_enabled(request): - return {'PROJECTS_ENABLED': settings.PROJECTS_ENABLED} + return {"PROJECTS_ENABLED": settings.PROJECTS_ENABLED} diff --git a/hypha/apply/projects/filters.py b/hypha/apply/projects/filters.py index b31a29fab0..31a561c0e6 100644 --- a/hypha/apply/projects/filters.py +++ b/hypha/apply/projects/filters.py @@ -28,40 +28,58 @@ def get_project_leads(request): class InvoiceListFilter(filters.FilterSet): - fund = Select2ModelMultipleChoiceFilter(label=_('Funds'), queryset=get_used_funds, field_name='project__submission__page') - status = Select2MultipleChoiceFilter(label=_('Status'), choices=INVOICE_STATUS_CHOICES) - lead = Select2ModelMultipleChoiceFilter(label=_('Lead'), queryset=get_project_leads, field_name='project__lead') + fund = Select2ModelMultipleChoiceFilter( + label=_("Funds"), + queryset=get_used_funds, + field_name="project__submission__page", + ) + status = Select2MultipleChoiceFilter( + label=_("Status"), choices=INVOICE_STATUS_CHOICES + ) + lead = Select2ModelMultipleChoiceFilter( + label=_("Lead"), queryset=get_project_leads, field_name="project__lead" + ) class Meta: - fields = ['lead', 'fund', 'status'] + fields = ["lead", "fund", "status"] model = Invoice class ProjectListFilter(filters.FilterSet): REPORTING_CHOICES = ( - (0, 'Up to date'), - (1, 'Behind schedule'), + (0, "Up to date"), + (1, "Behind schedule"), ) - project_fund = Select2ModelMultipleChoiceFilter(field_name="submission__page", label=_('Funds'), queryset=get_used_funds) - project_lead = Select2ModelMultipleChoiceFilter(field_name="lead", label=_('Lead'), queryset=get_project_leads) - project_status = Select2MultipleChoiceFilter(field_name="status", label=_('Status'), choices=PROJECT_STATUS_CHOICES) - query = filters.CharFilter(field_name='title', lookup_expr="icontains", widget=forms.HiddenInput) + project_fund = Select2ModelMultipleChoiceFilter( + field_name="submission__page", label=_("Funds"), queryset=get_used_funds + ) + project_lead = Select2ModelMultipleChoiceFilter( + field_name="lead", label=_("Lead"), queryset=get_project_leads + ) + project_status = Select2MultipleChoiceFilter( + field_name="status", label=_("Status"), choices=PROJECT_STATUS_CHOICES + ) + query = filters.CharFilter( + field_name="title", lookup_expr="icontains", widget=forms.HiddenInput + ) reporting = filters.ChoiceFilter( choices=REPORTING_CHOICES, method="filter_reporting", - widget=Select2Widget(attrs={ - 'data-placeholder': 'Reporting', - 'data-minimum-results-for-search': -1, - }), + widget=Select2Widget( + attrs={ + "data-placeholder": "Reporting", + "data-minimum-results-for-search": -1, + } + ), ) class Meta: - fields = ['project_status', 'project_lead', 'project_fund'] + fields = ["project_status", "project_lead", "project_fund"] model = Project def filter_reporting(self, queryset, name, value): - if value == '1': + if value == "1": return queryset.filter(outstanding_reports__gt=0) return queryset.filter( Q(outstanding_reports__lt=1) | Q(outstanding_reports__isnull=True), @@ -70,8 +88,8 @@ def filter_reporting(self, queryset, name, value): class DateRangeInputWidget(filters.widgets.SuffixedMultiWidget): - template_name = 'application_projects/filters/widgets/date_range_input_widget.html' - suffixes = ['after', 'before'] + template_name = "application_projects/filters/widgets/date_range_input_widget.html" + suffixes = ["after", "before"] def __init__(self, attrs=None): widgets = (forms.DateInput, forms.DateInput) @@ -85,7 +103,7 @@ def decompress(self, value): class ReportListFilter(filters.FilterSet): reporting_period = filters.DateFromToRangeFilter( - label=_('Reporting Period'), + label=_("Reporting Period"), method="filter_reporting_period", widget=DateRangeInputWidget, ) @@ -93,14 +111,14 @@ class ReportListFilter(filters.FilterSet): class Meta: model = Report - fields = ['submitted'] + fields = ["submitted"] def filter_reporting_period(self, queryset, name, value): after, before = value.start, value.stop q = {} if after: - q['start__gte'] = after + q["start__gte"] = after if before: - q['end_date__lte'] = before + q["end_date__lte"] = before return queryset.filter(**q) diff --git a/hypha/apply/projects/forms/__init__.py b/hypha/apply/projects/forms/__init__.py index aab0d7c6d7..2514a9b340 100644 --- a/hypha/apply/projects/forms/__init__.py +++ b/hypha/apply/projects/forms/__init__.py @@ -34,33 +34,33 @@ ) __all__ = [ - 'SelectDocumentForm', - 'SubmitContractDocumentsForm', - 'ApproveContractForm', - 'ApproversForm', - 'AssignApproversForm', - 'ChangePAFStatusForm', - 'ChangeProjectStatusForm', - 'CreateProjectForm', - 'ProjectApprovalForm', - 'ProjectSOWForm', - 'RemoveDocumentForm', - 'RemoveContractDocumentForm', - 'SetPendingForm', - 'UploadContractForm', - 'UploadContractDocumentForm', - 'StaffUploadContractForm', - 'UploadDocumentForm', - 'UpdateProjectLeadForm', - 'ReportEditForm', - 'ReportFrequencyForm', - 'CreateVendorFormStep1', - 'CreateVendorFormStep2', - 'CreateVendorFormStep3', - 'CreateVendorFormStep4', - 'CreateVendorFormStep5', - 'CreateVendorFormStep6', - 'CreateInvoiceForm', - 'ChangeInvoiceStatusForm', - 'EditInvoiceForm', + "SelectDocumentForm", + "SubmitContractDocumentsForm", + "ApproveContractForm", + "ApproversForm", + "AssignApproversForm", + "ChangePAFStatusForm", + "ChangeProjectStatusForm", + "CreateProjectForm", + "ProjectApprovalForm", + "ProjectSOWForm", + "RemoveDocumentForm", + "RemoveContractDocumentForm", + "SetPendingForm", + "UploadContractForm", + "UploadContractDocumentForm", + "StaffUploadContractForm", + "UploadDocumentForm", + "UpdateProjectLeadForm", + "ReportEditForm", + "ReportFrequencyForm", + "CreateVendorFormStep1", + "CreateVendorFormStep2", + "CreateVendorFormStep3", + "CreateVendorFormStep4", + "CreateVendorFormStep5", + "CreateVendorFormStep6", + "CreateInvoiceForm", + "ChangeInvoiceStatusForm", + "EditInvoiceForm", ] diff --git a/hypha/apply/projects/forms/payment.py b/hypha/apply/projects/forms/payment.py index 76a6fe224e..ceb6fe68fa 100644 --- a/hypha/apply/projects/forms/payment.py +++ b/hypha/apply/projects/forms/payment.py @@ -30,75 +30,98 @@ def filter_request_choices(choices, user_choices): - return [(k, v) for k, v in INVOICE_STATUS_CHOICES if k in choices and k in user_choices] + return [ + (k, v) for k, v in INVOICE_STATUS_CHOICES if k in choices and k in user_choices + ] class ChangeInvoiceStatusForm(forms.ModelForm): - name_prefix = 'change_invoice_status_form' + name_prefix = "change_invoice_status_form" class Meta: - fields = ['status', 'comment'] + fields = ["status", "comment"] model = Invoice def __init__(self, instance, user, *args, **kwargs): super().__init__(*args, **kwargs, instance=instance) - self.initial['comment'] = '' - status_field = self.fields['status'] + self.initial["comment"] = "" + status_field = self.fields["status"] user_choices = invoice_status_user_choices(user) possible_status_transitions_lut = { - SUBMITTED: filter_request_choices([CHANGES_REQUESTED_BY_STAFF, APPROVED_BY_STAFF, DECLINED], user_choices), - RESUBMITTED: filter_request_choices([CHANGES_REQUESTED_BY_STAFF, APPROVED_BY_STAFF, DECLINED], user_choices), - CHANGES_REQUESTED_BY_STAFF: filter_request_choices([DECLINED], user_choices), + SUBMITTED: filter_request_choices( + [CHANGES_REQUESTED_BY_STAFF, APPROVED_BY_STAFF, DECLINED], user_choices + ), + RESUBMITTED: filter_request_choices( + [CHANGES_REQUESTED_BY_STAFF, APPROVED_BY_STAFF, DECLINED], user_choices + ), + CHANGES_REQUESTED_BY_STAFF: filter_request_choices( + [DECLINED], user_choices + ), APPROVED_BY_STAFF: filter_request_choices( [ - CHANGES_REQUESTED_BY_FINANCE_1, APPROVED_BY_FINANCE_1, + CHANGES_REQUESTED_BY_FINANCE_1, + APPROVED_BY_FINANCE_1, ], - user_choices + user_choices, + ), + CHANGES_REQUESTED_BY_FINANCE_1: filter_request_choices( + [CHANGES_REQUESTED_BY_STAFF, DECLINED], user_choices ), - CHANGES_REQUESTED_BY_FINANCE_1: filter_request_choices([CHANGES_REQUESTED_BY_STAFF, DECLINED], user_choices), APPROVED_BY_FINANCE_1: filter_request_choices([PAID], user_choices), } if settings.INVOICE_EXTENDED_WORKFLOW: - possible_status_transitions_lut.update({ - CHANGES_REQUESTED_BY_FINANCE_2: filter_request_choices( - [ - CHANGES_REQUESTED_BY_FINANCE_1, APPROVED_BY_FINANCE_1, - ], - user_choices - ), - APPROVED_BY_FINANCE_1: filter_request_choices([CHANGES_REQUESTED_BY_FINANCE_2, APPROVED_BY_FINANCE_2], - user_choices), - APPROVED_BY_FINANCE_2: filter_request_choices([PAID], user_choices), - }) + possible_status_transitions_lut.update( + { + CHANGES_REQUESTED_BY_FINANCE_2: filter_request_choices( + [ + CHANGES_REQUESTED_BY_FINANCE_1, + APPROVED_BY_FINANCE_1, + ], + user_choices, + ), + APPROVED_BY_FINANCE_1: filter_request_choices( + [CHANGES_REQUESTED_BY_FINANCE_2, APPROVED_BY_FINANCE_2], + user_choices, + ), + APPROVED_BY_FINANCE_2: filter_request_choices([PAID], user_choices), + } + ) status_field.choices = possible_status_transitions_lut.get(instance.status, []) class InvoiceBaseForm(forms.ModelForm): class Meta: - fields = ['invoice_number', 'invoice_amount', 'document', 'message_for_pm'] + fields = ["invoice_number", "invoice_amount", "document", "message_for_pm"] model = Invoice def __init__(self, user=None, *args, **kwargs): super().__init__(*args, **kwargs) - self.initial['message_for_pm'] = '' + self.initial["message_for_pm"] = "" class CreateInvoiceForm(FileFormMixin, InvoiceBaseForm): document = SingleFileField( - label='Invoice File', required=True, - help_text=_('The invoice must be a PDF.') + label="Invoice File", required=True, help_text=_("The invoice must be a PDF.") ) supporting_documents = MultiFileField( required=False, - help_text=_('Files that are related to the invoice. They could be xls, microsoft office documents, open office documents, pdfs, txt files.') + help_text=_( + "Files that are related to the invoice. They could be xls, microsoft office documents, open office documents, pdfs, txt files." + ), ) - field_order = ['invoice_number', 'invoice_amount', 'document', 'supporting_documents', 'message_for_pm'] + field_order = [ + "invoice_number", + "invoice_amount", + "document", + "supporting_documents", + "message_for_pm", + ] def save(self, commit=True): invoice = super().save(commit=commit) - supporting_documents = self.cleaned_data['supporting_documents'] or [] + supporting_documents = self.cleaned_data["supporting_documents"] or [] SupportingDocument.objects.bulk_create( SupportingDocument(invoice=invoice, document=document) @@ -109,16 +132,23 @@ def save(self, commit=True): class EditInvoiceForm(FileFormMixin, InvoiceBaseForm): - document = SingleFileField(label=_('Invoice File'), required=True) + document = SingleFileField(label=_("Invoice File"), required=True) supporting_documents = MultiFileField(required=False) - field_order = ['invoice_number', 'invoice_amount', 'document', 'supporting_documents', 'message_for_pm'] + field_order = [ + "invoice_number", + "invoice_amount", + "document", + "supporting_documents", + "message_for_pm", + ] @transaction.atomic def save(self, commit=True): invoice = super().save(commit=commit) not_deleted_original_filenames = [ - file['name'] for file in json.loads(self.cleaned_data['supporting_documents-uploads']) + file["name"] + for file in json.loads(self.cleaned_data["supporting_documents-uploads"]) ] for f in invoice.supporting_documents.all(): if f.document.name not in not_deleted_original_filenames: @@ -136,13 +166,12 @@ def save(self, commit=True): class SelectDocumentForm(forms.ModelForm): document = forms.ChoiceField( - label="Document", - widget=forms.Select(attrs={'id': 'from_submission'}) + label="Document", widget=forms.Select(attrs={"id": "from_submission"}) ) class Meta: model = PacketFile - fields = ['category', 'document'] + fields = ["category", "document"] def __init__(self, existing_files, *args, **kwargs): super().__init__(*args, **kwargs) @@ -151,16 +180,16 @@ def __init__(self, existing_files, *args, **kwargs): choices = [(f.url, f.filename) for f in self.files] - self.fields['document'].choices = choices + self.fields["document"].choices = choices def clean_document(self): - file_url = self.cleaned_data['document'] + file_url = self.cleaned_data["document"] for file in self.files: if file.url == file_url: new_file = ContentFile(file.read()) new_file.name = file.filename return new_file - raise forms.ValidationError(_('File not found on submission')) + raise forms.ValidationError(_("File not found on submission")) @transaction.atomic() def save(self, *args, **kwargs): diff --git a/hypha/apply/projects/forms/project.py b/hypha/apply/projects/forms/project.py index cd3ebfd518..93ffb6be5c 100644 --- a/hypha/apply/projects/forms/project.py +++ b/hypha/apply/projects/forms/project.py @@ -36,7 +36,7 @@ def filter_request_choices(choices): def get_latest_project_paf_approval_via_roles(project, roles): # exact match the roles with paf approval's reviewer roles paf_approvals = project.paf_approvals.annotate( - roles_count=Count('paf_reviewer_role__user_roles') + roles_count=Count("paf_reviewer_role__user_roles") ).filter(roles_count=len(list(roles)), approved=False) for role in roles: @@ -51,18 +51,22 @@ def __init__(self, instance, *args, **kwargs): super().__init__(*args, **kwargs) self.instance = instance if instance: - self.fields['id'].initial = instance.id + self.fields["id"].initial = instance.id def clean_id(self): if self.has_changed(): - raise forms.ValidationError(_('Something changed before your approval please re-review')) + raise forms.ValidationError( + _("Something changed before your approval please re-review") + ) def clean(self): if not self.instance: - raise forms.ValidationError(_('The contract you were trying to approve has already been approved')) + raise forms.ValidationError( + _("The contract you were trying to approve has already been approved") + ) if not self.instance.signed_by_applicant: - raise forms.ValidationError(_('You can only approve a signed contract')) + raise forms.ValidationError(_("You can only approve a signed contract")) super().clean() @@ -77,30 +81,32 @@ class CreateProjectForm(forms.Form): widget=forms.HiddenInput(), ) - project_lead = forms.ModelChoiceField(label=_('Select Project Lead'), queryset=User.objects.all()) + project_lead = forms.ModelChoiceField( + label=_("Select Project Lead"), queryset=User.objects.all() + ) def __init__(self, instance=None, user=None, *args, **kwargs): super().__init__(*args, **kwargs) if instance: - self.fields['submission'].initial = instance.id + self.fields["submission"].initial = instance.id # Update lead field queryset - lead_field = self.fields['project_lead'] + lead_field = self.fields["project_lead"] qwargs = Q(groups__name=STAFF_GROUP_NAME) | Q(is_superuser=True) - lead_field.queryset = (lead_field.queryset.filter(qwargs).distinct()) + lead_field.queryset = lead_field.queryset.filter(qwargs).distinct() if instance: lead_field.initial = instance.lead def clean_project_lead(self): - project_lead = self.cleaned_data['project_lead'] + project_lead = self.cleaned_data["project_lead"] if not project_lead: - raise forms.ValidationError(_('Project lead is a required field')) + raise forms.ValidationError(_("Project lead is a required field")) return project_lead def save(self, *args, **kwargs): - submission = self.cleaned_data['submission'] - lead = self.cleaned_data['project_lead'] + submission = self.cleaned_data["submission"] + lead = self.cleaned_data["project_lead"] return Project.create_from_submission(submission, lead=lead) @@ -111,19 +117,17 @@ class MixedMetaClass(type(StreamBaseForm), type(forms.ModelForm)): class ProjectApprovalForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMetaClass): class Meta: fields = [ - 'title', + "title", ] model = Project - widgets = { - 'title': forms.HiddenInput() - } + widgets = {"title": forms.HiddenInput()} def __init__(self, *args, extra_fields=None, **kwargs): super().__init__(*args, **kwargs) def clean(self): cleaned_data = super().clean() - cleaned_data['form_data'] = { + cleaned_data["form_data"] = { key: value for key, value in cleaned_data.items() if key not in self._meta.fields @@ -131,7 +135,7 @@ def clean(self): return cleaned_data def save(self, *args, **kwargs): - self.instance.form_fields = kwargs.pop('paf_form_fields', {}) + self.instance.form_fields = kwargs.pop("paf_form_fields", {}) self.instance.form_data = { field: self.cleaned_data[field] for field in self.instance.question_field_ids @@ -145,19 +149,17 @@ def save(self, *args, **kwargs): class ProjectSOWForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMetaClass): class Meta: fields = [ - 'project', + "project", ] model = ProjectSOW - widgets = { - 'project': forms.HiddenInput() - } + widgets = {"project": forms.HiddenInput()} def __init__(self, *args, extra_fields=None, **kwargs): super().__init__(*args, **kwargs) def clean(self): cleaned_data = super().clean() - cleaned_data['form_data'] = { + cleaned_data["form_data"] = { key: value for key, value in cleaned_data.items() if key not in self._meta.fields @@ -165,8 +167,10 @@ def clean(self): return cleaned_data def save(self, *args, **kwargs): - self.instance, _ = self._meta.model.objects.get_or_create(project=kwargs.pop('project', None)) - self.instance.form_fields = kwargs.pop('sow_form_fields', {}) + self.instance, _ = self._meta.model.objects.get_or_create( + project=kwargs.pop("project", None) + ) + self.instance.form_fields = kwargs.pop("sow_form_fields", {}) self.instance.form_data = { field: self.cleaned_data[field] for field in self.instance.question_field_ids @@ -177,30 +181,32 @@ def save(self, *args, **kwargs): class ChangePAFStatusForm(forms.ModelForm): - name_prefix = 'change_paf_status_form' - paf_status = forms.ChoiceField(label="PAF status", choices=PAF_STATUS_CHOICES, widget=forms.RadioSelect()) + name_prefix = "change_paf_status_form" + paf_status = forms.ChoiceField( + label="PAF status", choices=PAF_STATUS_CHOICES, widget=forms.RadioSelect() + ) comment = forms.CharField(required=False, widget=forms.Textarea) class Meta: - fields = ['paf_status', 'comment'] + fields = ["paf_status", "comment"] model = Project def __init__(self, instance, user, *args, **kwargs): super().__init__(*args, **kwargs, instance=instance) - self.fields['paf_status'].widget.attrs['class'] = 'grid--status-update' + self.fields["paf_status"].widget.attrs["class"] = "grid--status-update" class ChangeProjectStatusForm(forms.ModelForm): - name_prefix = 'change_project_status_form' + name_prefix = "change_project_status_form" comment = forms.CharField(required=False, widget=forms.Textarea) class Meta: - fields = ['status', 'comment'] + fields = ["status", "comment"] model = Project def __init__(self, instance, user, *args, **kwargs): super().__init__(*args, **kwargs, instance=instance) - status_field = self.fields['status'] + status_field = self.fields["status"] possible_status_transitions = { INVOICING_AND_REPORTING: filter_request_choices([CLOSING, COMPLETE]), CLOSING: filter_request_choices([INVOICING_AND_REPORTING, COMPLETE]), @@ -213,7 +219,7 @@ class RemoveDocumentForm(forms.ModelForm): id = forms.IntegerField(widget=forms.HiddenInput()) class Meta: - fields = ['id'] + fields = ["id"] model = PacketFile def __init__(self, user=None, *args, **kwargs): @@ -224,7 +230,7 @@ class RemoveContractDocumentForm(forms.ModelForm): id = forms.IntegerField(widget=forms.HiddenInput()) class Meta: - fields = ['id'] + fields = ["id"] model = ContractPacketFile def __init__(self, user=None, *args, **kwargs): @@ -233,17 +239,22 @@ def __init__(self, user=None, *args, **kwargs): class ApproversForm(forms.ModelForm): class Meta: - fields = ['id'] + fields = ["id"] model = Project - widgets = {'id': forms.HiddenInput()} + widgets = {"id": forms.HiddenInput()} def __init__(self, user=None, *args, **kwargs): from hypha.apply.activity.adapters.utils import get_users_for_groups + super().__init__(*args, **kwargs) for paf_reviewer_role in PAFReviewersRole.objects.all(): - users = get_users_for_groups(list(paf_reviewer_role.user_roles.all()), exact_match=True) - approval = PAFApprovals.objects.filter(project=self.instance, paf_reviewer_role=paf_reviewer_role) + users = get_users_for_groups( + list(paf_reviewer_role.user_roles.all()), exact_match=True + ) + approval = PAFApprovals.objects.filter( + project=self.instance, paf_reviewer_role=paf_reviewer_role + ) if approval: initial_user = approval.first().user self.fields[slugify(paf_reviewer_role.label)] = forms.ModelChoiceField( @@ -260,7 +271,9 @@ def save(self, commit=True): # add users as PAFApprovals for paf_reviewer_role in PAFReviewersRole.objects.all(): assigned_user = self.cleaned_data[slugify(paf_reviewer_role.label)] - paf_approvals = PAFApprovals.objects.filter(project=self.instance, paf_reviewer_role=paf_reviewer_role) + paf_approvals = PAFApprovals.objects.filter( + project=self.instance, paf_reviewer_role=paf_reviewer_role + ) if not paf_approvals.exists(): PAFApprovals.objects.create( project=self.instance, @@ -278,7 +291,9 @@ def save(self, commit=True): class SetPendingForm(ApproversForm): def clean(self): if self.instance.status != DRAFT: - raise forms.ValidationError(_('A Project can only be sent for Approval when Drafted.')) + raise forms.ValidationError( + _("A Project can only be sent for Approval when Drafted.") + ) # :todo: we should have a check form contains enough data to create PAF Approvals cleaned_data = super().clean() @@ -287,23 +302,30 @@ def clean(self): class AssignApproversForm(forms.ModelForm): class Meta: - fields = ['id'] + fields = ["id"] model = Project - widgets = {'id': forms.HiddenInput()} + widgets = {"id": forms.HiddenInput()} def __init__(self, user=None, *args, **kwargs): from hypha.apply.activity.adapters.utils import get_users_for_groups + super().__init__(*args, **kwargs) self.user = user - paf_approval = get_latest_project_paf_approval_via_roles(project=self.instance, roles=user.groups.all()) + paf_approval = get_latest_project_paf_approval_via_roles( + project=self.instance, roles=user.groups.all() + ) if paf_approval: current_paf_reviewer_role = paf_approval.paf_reviewer_role - users = get_users_for_groups(list(current_paf_reviewer_role.user_roles.all()), exact_match=True) + users = get_users_for_groups( + list(current_paf_reviewer_role.user_roles.all()), exact_match=True + ) - self.fields[slugify(current_paf_reviewer_role.label)] = forms.ModelChoiceField( + self.fields[ + slugify(current_paf_reviewer_role.label) + ] = forms.ModelChoiceField( queryset=users, required=False, blank=True, @@ -313,7 +335,9 @@ def __init__(self, user=None, *args, **kwargs): ) def save(self, commit=True): - paf_approval = get_latest_project_paf_approval_via_roles(project=self.instance, roles=self.user.groups.all()) + paf_approval = get_latest_project_paf_approval_via_roles( + project=self.instance, roles=self.user.groups.all() + ) current_paf_reviewer_role = paf_approval.paf_reviewer_role assigned_user = self.cleaned_data[slugify(current_paf_reviewer_role.label)] @@ -327,39 +351,39 @@ def save(self, commit=True): class SubmitContractDocumentsForm(forms.ModelForm): class Meta: - fields = ['id'] + fields = ["id"] model = Project - widgets = {'id': forms.HiddenInput()} + widgets = {"id": forms.HiddenInput()} def __init__(self, user=None, *args, **kwargs): super().__init__(*args, **kwargs) class UploadContractForm(FileFormMixin, forms.ModelForm): - file = SingleFileField(label=_('Contract'), required=True) + file = SingleFileField(label=_("Contract"), required=True) class Meta: - fields = ['file'] + fields = ["file"] model = Contract def save(self, commit=True): - self.instance.file = self.cleaned_data.get('file') + self.instance.file = self.cleaned_data.get("file") return super().save(commit=True) class StaffUploadContractForm(FileFormMixin, forms.ModelForm): - file = SingleFileField(label=_('Contract'), required=True) + file = SingleFileField(label=_("Contract"), required=True) class Meta: - fields = ['file', 'signed_by_applicant'] + fields = ["file", "signed_by_applicant"] model = Contract class UploadDocumentForm(FileFormMixin, forms.ModelForm): - document = SingleFileField(label=_('Document'), required=True) + document = SingleFileField(label=_("Document"), required=True) class Meta: - fields = ['category', 'document'] + fields = ["category", "document"] model = PacketFile def __init__(self, user=None, instance=None, *args, **kwargs): @@ -371,10 +395,10 @@ def save(self, commit=True): class UploadContractDocumentForm(FileFormMixin, forms.ModelForm): - document = SingleFileField(label=_('Contract Document'), required=True) + document = SingleFileField(label=_("Contract Document"), required=True) class Meta: - fields = ['category', 'document'] + fields = ["category", "document"] model = ContractPacketFile def __init__(self, user=None, instance=None, *args, **kwargs): @@ -387,16 +411,20 @@ def save(self, commit=True): class UpdateProjectLeadForm(forms.ModelForm): class Meta: - fields = ['lead'] + fields = ["lead"] model = Project def __init__(self, user=None, *args, **kwargs): super().__init__(*args, **kwargs) - lead_field = self.fields['lead'] - lead_field.label = _('Update lead from {lead} to').format(lead=self.instance.lead) + lead_field = self.fields["lead"] + lead_field.label = _("Update lead from {lead} to").format( + lead=self.instance.lead + ) qwargs = Q(groups__name=STAFF_GROUP_NAME) | Q(is_superuser=True) - lead_field.queryset = (lead_field.queryset.exclude(pk=self.instance.lead_id) - .filter(qwargs) - .distinct()) + lead_field.queryset = ( + lead_field.queryset.exclude(pk=self.instance.lead_id) + .filter(qwargs) + .distinct() + ) diff --git a/hypha/apply/projects/forms/report.py b/hypha/apply/projects/forms/report.py index fb83d29fef..1a4d2c7f9d 100644 --- a/hypha/apply/projects/forms/report.py +++ b/hypha/apply/projects/forms/report.py @@ -12,57 +12,61 @@ class ReportEditForm(FileFormMixin, forms.ModelForm): public_content = RichTextField( - help_text=_('This section of the report will be shared with the broader community.') + help_text=_( + "This section of the report will be shared with the broader community." + ) ) private_content = RichTextField( - help_text=_('This section of the report will be shared with staff only.') + help_text=_("This section of the report will be shared with staff only.") ) file_list = forms.ModelMultipleChoiceField( - widget=forms.CheckboxSelectMultiple(attrs={'class': 'delete'}), + widget=forms.CheckboxSelectMultiple(attrs={"class": "delete"}), queryset=ReportPrivateFiles.objects.all(), required=False, - label='Files' + label="Files", ) - files = MultiFileField(required=False, label='') + files = MultiFileField(required=False, label="") class Meta: model = Report fields = ( - 'public_content', - 'private_content', - 'file_list', - 'files', + "public_content", + "private_content", + "file_list", + "files", ) def __init__(self, *args, user=None, initial=None, **kwargs): if initial is None: initial = {} self.report_files = initial.pop( - 'file_list', + "file_list", ReportPrivateFiles.objects.none(), ) super().__init__(*args, initial=initial, **kwargs) - self.fields['file_list'].queryset = self.report_files + self.fields["file_list"].queryset = self.report_files self.user = user def clean(self): cleaned_data = super().clean() - public = cleaned_data['public_content'] - private = cleaned_data['private_content'] + public = cleaned_data["public_content"] + private = cleaned_data["private_content"] if not private and not public: - missing_content = _('Must include either public or private content when submitting a report.') - self.add_error('public_content', missing_content) - self.add_error('private_content', missing_content) + missing_content = _( + "Must include either public or private content when submitting a report." + ) + self.add_error("public_content", missing_content) + self.add_error("private_content", missing_content) return cleaned_data @transaction.atomic def save(self, commit=True): - is_draft = 'save' in self.data + is_draft = "save" in self.data version = ReportVersion.objects.create( report=self.instance, - public_content=self.cleaned_data['public_content'], - private_content=self.cleaned_data['private_content'], + public_content=self.cleaned_data["public_content"], + private_content=self.cleaned_data["private_content"], submitted=timezone.now(), draft=is_draft, author=self.user, @@ -80,14 +84,14 @@ def save(self, commit=True): instance = super().save(commit) - removed_files = self.cleaned_data['file_list'] + removed_files = self.cleaned_data["file_list"] ReportPrivateFiles.objects.bulk_create( ReportPrivateFiles(report=version, document=file.document) for file in self.report_files if file not in removed_files ) - added_files = self.cleaned_data['files'] + added_files = self.cleaned_data["files"] if added_files: ReportPrivateFiles.objects.bulk_create( ReportPrivateFiles(report=version, document=file) @@ -98,17 +102,17 @@ def save(self, commit=True): class ReportFrequencyForm(forms.ModelForm): - start = forms.DateField(label='Report on:', required=False) + start = forms.DateField(label="Report on:", required=False) class Meta: model = ReportConfig - fields = ('start', 'occurrence', 'frequency', 'does_not_repeat') + fields = ("start", "occurrence", "frequency", "does_not_repeat") labels = { - 'occurrence': '', - 'frequency': '', + "occurrence": "", + "frequency": "", } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields['occurrence'].required = False - self.fields['frequency'].required = False + self.fields["occurrence"].required = False + self.fields["frequency"].required = False diff --git a/hypha/apply/projects/forms/vendor.py b/hypha/apply/projects/forms/vendor.py index 2c72cd5972..e3792d2f48 100644 --- a/hypha/apply/projects/forms/vendor.py +++ b/hypha/apply/projects/forms/vendor.py @@ -16,7 +16,7 @@ def get_active_currencies(): active_currencies = [] - territories = get_global('territory_currencies').keys() + territories = get_global("territory_currencies").keys() for territory in territories: currencies = get_territory_currencies(territory, datetime.date.today()) if currencies: @@ -35,11 +35,13 @@ def __init__(self, site=None, *args, **kwargs): def apply_form_settings(self, fields): for field in fields: try: - self.fields[field].label = getattr(self.form_settings, f'{field}_label') + self.fields[field].label = getattr(self.form_settings, f"{field}_label") except AttributeError: pass try: - self.fields[field].help_text = getattr(self.form_settings, f'{field}_help_text') + self.fields[field].help_text = getattr( + self.form_settings, f"{field}_help_text" + ) except AttributeError: pass return fields @@ -47,13 +49,15 @@ def apply_form_settings(self, fields): class CreateVendorFormStep1(BaseVendorForm, forms.Form): TYPE_CHOICES = [ - ('organization', _('Yes, the account belongs to the organisation above')), - ('personal', _('No, it is a personal bank account')), + ("organization", _("Yes, the account belongs to the organisation above")), + ("personal", _("No, it is a personal bank account")), ] name = forms.CharField(required=True) contractor_name = forms.CharField(required=True) - type = forms.ChoiceField(choices=TYPE_CHOICES, required=True, widget=forms.RadioSelect) + type = forms.ChoiceField( + choices=TYPE_CHOICES, required=True, widget=forms.RadioSelect + ) def __init__(self, *args, **kwargs): super(CreateVendorFormStep1, self).__init__(*args, **kwargs) @@ -62,10 +66,10 @@ def __init__(self, *args, **kwargs): class CreateVendorFormStep2(BaseVendorForm, forms.Form): required_to_pay_taxes = forms.TypedChoiceField( - choices=((False, 'No'), (True, 'Yes')), - coerce=lambda x: x == 'True', + choices=((False, "No"), (True, "Yes")), + coerce=lambda x: x == "True", widget=forms.RadioSelect, - required=True + required=True, ) def __init__(self, *args, **kwargs): @@ -83,7 +87,10 @@ def __init__(self, *args, **kwargs): class CreateVendorFormStep4(BaseVendorForm, forms.Form): CURRENCY_CHOICES = [ - (currency, f'{get_currency_name(currency, locale=settings.CURRENCY_LOCALE)} - {currency}') + ( + currency, + f"{get_currency_name(currency, locale=settings.CURRENCY_LOCALE)} - {currency}", + ) for currency in get_active_currencies() ] @@ -93,7 +100,7 @@ class CreateVendorFormStep4(BaseVendorForm, forms.Form): account_currency = forms.ChoiceField( choices=sorted(CURRENCY_CHOICES, key=itemgetter(1)), required=True, - initial='USD' + initial="USD", ) def __init__(self, *args, **kwargs): @@ -103,10 +110,10 @@ def __init__(self, *args, **kwargs): class CreateVendorFormStep5(BaseVendorForm, forms.Form): need_extra_info = forms.TypedChoiceField( - choices=((False, _('No')), (True, _('Yes'))), - coerce=lambda x: x == 'True', + choices=((False, _("No")), (True, _("Yes"))), + coerce=lambda x: x == "True", widget=forms.RadioSelect, - required=True + required=True, ) def __init__(self, *args, **kwargs): @@ -116,7 +123,10 @@ def __init__(self, *args, **kwargs): class CreateVendorFormStep6(BaseVendorForm, forms.Form): CURRENCY_CHOICES = [ - (currency, f'{get_currency_name(currency, locale=settings.CURRENCY_LOCALE)} - {currency}') + ( + currency, + f"{get_currency_name(currency, locale=settings.CURRENCY_LOCALE)} - {currency}", + ) for currency in get_active_currencies() ] branch_address = AddressField() @@ -125,7 +135,7 @@ class CreateVendorFormStep6(BaseVendorForm, forms.Form): ib_account_currency = forms.ChoiceField( choices=sorted(CURRENCY_CHOICES, key=itemgetter(1)), required=False, - initial='USD' + initial="USD", ) ib_branch_address = AddressField() nid_type = forms.CharField(required=False) diff --git a/hypha/apply/projects/management/commands/notify_report_due.py b/hypha/apply/projects/management/commands/notify_report_due.py index b02f05f302..c316710365 100644 --- a/hypha/apply/projects/management/commands/notify_report_due.py +++ b/hypha/apply/projects/management/commands/notify_report_due.py @@ -12,32 +12,31 @@ class Command(BaseCommand): - help = 'Notify users that they have a report due soon' + help = "Notify users that they have a report due soon" def add_arguments(self, parser): - parser.add_argument('days_before', type=int) + parser.add_argument("days_before", type=int) def handle(self, *args, **options): site = ApplyHomePage.objects.first().get_site() - set_urlconf('hypha.apply.urls') + set_urlconf("hypha.apply.urls") # Mock a HTTPRequest in order to pass the site settings into the # templates request = HttpRequest() - request.META['SERVER_NAME'] = site.hostname - request.META['SERVER_PORT'] = site.port - request.META[settings.SECURE_PROXY_SSL_HEADER] = 'https' + request.META["SERVER_NAME"] = site.hostname + request.META["SERVER_PORT"] = site.port + request.META[settings.SECURE_PROXY_SSL_HEADER] = "https" request.session = {} request._messages = FallbackStorage(request) today = timezone.now().date() - due_date = today + relativedelta(days=options['days_before']) + due_date = today + relativedelta(days=options["days_before"]) for project in Project.objects.in_progress(): next_report = project.report_config.current_due_report() due_soon = next_report.end_date == due_date not_notified_today = ( - not next_report.notified or - next_report.notified.date() != today + not next_report.notified or next_report.notified.date() != today ) if due_soon and not_notified_today: messenger( @@ -50,6 +49,4 @@ def handle(self, *args, **options): # Notify about the due report next_report.notified = timezone.now() next_report.save() - self.stdout.write( - self.style.SUCCESS(f'Notified project: {project.id}') - ) + self.stdout.write(self.style.SUCCESS(f"Notified project: {project.id}")) diff --git a/hypha/apply/projects/migrations/0001_initial.py b/hypha/apply/projects/migrations/0001_initial.py index 76e3451ce5..a573789f86 100644 --- a/hypha/apply/projects/migrations/0001_initial.py +++ b/hypha/apply/projects/migrations/0001_initial.py @@ -5,20 +5,33 @@ class Migration(migrations.Migration): - initial = True dependencies = [ - ('funds', '0064_group_toggle_end_block'), + ("funds", "0064_group_toggle_end_block"), ] operations = [ migrations.CreateModel( - name='Project', + name="Project", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.TextField()), - ('submission', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationSubmission')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.TextField()), + ( + "submission", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="funds.ApplicationSubmission", + ), + ), ], ), ] diff --git a/hypha/apply/projects/migrations/0002_add_submission_fields_to_project.py b/hypha/apply/projects/migrations/0002_add_submission_fields_to_project.py index a8856252fe..25f56e7125 100644 --- a/hypha/apply/projects/migrations/0002_add_submission_fields_to_project.py +++ b/hypha/apply/projects/migrations/0002_add_submission_fields_to_project.py @@ -4,30 +4,29 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0001_initial'), + ("application_projects", "0001_initial"), ] operations = [ migrations.AddField( - model_name='project', - name='contact_address', - field=models.TextField(default=''), + model_name="project", + name="contact_address", + field=models.TextField(default=""), ), migrations.AddField( - model_name='project', - name='contact_email', - field=models.TextField(default=''), + model_name="project", + name="contact_email", + field=models.TextField(default=""), ), migrations.AddField( - model_name='project', - name='contact_legal_name', - field=models.TextField(default=''), + model_name="project", + name="contact_legal_name", + field=models.TextField(default=""), ), migrations.AddField( - model_name='project', - name='value', + model_name="project", + name="value", field=models.DecimalField(decimal_places=2, default=0, max_digits=10), ), ] diff --git a/hypha/apply/projects/migrations/0003_add_project_lead.py b/hypha/apply/projects/migrations/0003_add_project_lead.py index 2699ce4b68..4d7a15fe39 100644 --- a/hypha/apply/projects/migrations/0003_add_project_lead.py +++ b/hypha/apply/projects/migrations/0003_add_project_lead.py @@ -6,16 +6,19 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0002_add_submission_fields_to_project'), + ("application_projects", "0002_add_submission_fields_to_project"), ] operations = [ migrations.AddField( - model_name='project', - name='lead', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + model_name="project", + name="lead", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/projects/migrations/0004_project_rename_name_to_title.py b/hypha/apply/projects/migrations/0004_project_rename_name_to_title.py index 2e735813cb..9f6624db67 100644 --- a/hypha/apply/projects/migrations/0004_project_rename_name_to_title.py +++ b/hypha/apply/projects/migrations/0004_project_rename_name_to_title.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0003_add_project_lead'), + ("application_projects", "0003_add_project_lead"), ] operations = [ migrations.RenameField( - model_name='project', - old_name='name', - new_name='title', + model_name="project", + old_name="name", + new_name="title", ), ] diff --git a/hypha/apply/projects/migrations/0005_add_user_to_project.py b/hypha/apply/projects/migrations/0005_add_user_to_project.py index b403e5f14d..290e5a1f7b 100644 --- a/hypha/apply/projects/migrations/0005_add_user_to_project.py +++ b/hypha/apply/projects/migrations/0005_add_user_to_project.py @@ -6,21 +6,30 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0004_project_rename_name_to_title'), + ("application_projects", "0004_project_rename_name_to_title"), ] operations = [ migrations.AddField( - model_name='project', - name='user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='owned_projects', to=settings.AUTH_USER_MODEL), + model_name="project", + name="user", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="owned_projects", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='project', - name='lead', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='lead_projects', to=settings.AUTH_USER_MODEL), + model_name="project", + name="lead", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="lead_projects", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/projects/migrations/0006_add_project_paf_fields.py b/hypha/apply/projects/migrations/0006_add_project_paf_fields.py index fd61f3cb20..970f71bd30 100644 --- a/hypha/apply/projects/migrations/0006_add_project_paf_fields.py +++ b/hypha/apply/projects/migrations/0006_add_project_paf_fields.py @@ -4,45 +4,46 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0005_add_user_to_project'), + ("application_projects", "0005_add_user_to_project"), ] operations = [ migrations.AddField( - model_name='project', - name='contact_phone', - field=models.TextField(default='', verbose_name='Phone'), + model_name="project", + name="contact_phone", + field=models.TextField(default="", verbose_name="Phone"), ), migrations.AddField( - model_name='project', - name='proposed_end', - field=models.DateTimeField(null=True, verbose_name='Proposed Start Date'), + model_name="project", + name="proposed_end", + field=models.DateTimeField(null=True, verbose_name="Proposed Start Date"), ), migrations.AddField( - model_name='project', - name='proposed_start', - field=models.DateTimeField(null=True, verbose_name='Proposed Start Date'), + model_name="project", + name="proposed_start", + field=models.DateTimeField(null=True, verbose_name="Proposed Start Date"), ), migrations.AddField( - model_name='project', - name='user_has_updated_details', + model_name="project", + name="user_has_updated_details", field=models.BooleanField(default=False), ), migrations.AlterField( - model_name='project', - name='contact_address', - field=models.TextField(default='', verbose_name='Address'), + model_name="project", + name="contact_address", + field=models.TextField(default="", verbose_name="Address"), ), migrations.AlterField( - model_name='project', - name='contact_email', - field=models.TextField(default='', verbose_name='Email'), + model_name="project", + name="contact_email", + field=models.TextField(default="", verbose_name="Email"), ), migrations.AlterField( - model_name='project', - name='contact_legal_name', - field=models.TextField(default='', verbose_name='Person or Organisation name'), + model_name="project", + name="contact_legal_name", + field=models.TextField( + default="", verbose_name="Person or Organisation name" + ), ), ] diff --git a/hypha/apply/projects/migrations/0007_fix_proposed_end_date_verbose_name.py b/hypha/apply/projects/migrations/0007_fix_proposed_end_date_verbose_name.py index 3dae6c5a1a..f3d1c90920 100644 --- a/hypha/apply/projects/migrations/0007_fix_proposed_end_date_verbose_name.py +++ b/hypha/apply/projects/migrations/0007_fix_proposed_end_date_verbose_name.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0006_add_project_paf_fields'), + ("application_projects", "0006_add_project_paf_fields"), ] operations = [ migrations.AlterField( - model_name='project', - name='proposed_end', - field=models.DateTimeField(null=True, verbose_name='Proposed End Date'), + model_name="project", + name="proposed_end", + field=models.DateTimeField(null=True, verbose_name="Proposed End Date"), ), ] diff --git a/hypha/apply/projects/migrations/0008_add_value_validator.py b/hypha/apply/projects/migrations/0008_add_value_validator.py index 27c2506895..8726a8e1eb 100644 --- a/hypha/apply/projects/migrations/0008_add_value_validator.py +++ b/hypha/apply/projects/migrations/0008_add_value_validator.py @@ -6,15 +6,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0007_fix_proposed_end_date_verbose_name'), + ("application_projects", "0007_fix_proposed_end_date_verbose_name"), ] operations = [ migrations.AlterField( - model_name='project', - name='value', - field=models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))]), + model_name="project", + name="value", + field=models.DecimalField( + decimal_places=2, + default=0, + max_digits=10, + validators=[django.core.validators.MinValueValidator(Decimal("0.01"))], + ), ), ] diff --git a/hypha/apply/projects/migrations/0009_add_approval.py b/hypha/apply/projects/migrations/0009_add_approval.py index 92b0c41572..79fb2bdd37 100644 --- a/hypha/apply/projects/migrations/0009_add_approval.py +++ b/hypha/apply/projects/migrations/0009_add_approval.py @@ -7,44 +7,71 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0009_documentcategory'), + ("application_projects", "0009_documentcategory"), ] operations = [ migrations.CreateModel( - name='Approval', + name="Approval", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("created_at", models.DateTimeField(auto_now_add=True)), + ( + "by", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.AddField( - model_name='project', - name='created_at', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + model_name="project", + name="created_at", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), preserve_default=False, ), migrations.AddField( - model_name='project', - name='is_locked', + model_name="project", + name="is_locked", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='project', - name='status', - field=models.TextField(choices=[('committed', 'Committed'), ('contracting', 'Contracting'), ('in_progress', 'In Progress'), ('closing', 'Closing'), ('complete', 'Complete')], default='committed'), + model_name="project", + name="status", + field=models.TextField( + choices=[ + ("committed", "Committed"), + ("contracting", "Contracting"), + ("in_progress", "In Progress"), + ("closing", "Closing"), + ("complete", "Complete"), + ], + default="committed", + ), ), migrations.AddField( - model_name='approval', - name='project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='application_projects.Project'), + model_name="approval", + name="project", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="application_projects.Project", + ), ), migrations.AlterUniqueTogether( - name='approval', - unique_together={('project', 'by')}, + name="approval", + unique_together={("project", "by")}, ), ] diff --git a/hypha/apply/projects/migrations/0009_documentcategory.py b/hypha/apply/projects/migrations/0009_documentcategory.py index 6925bcfa68..a49aed4925 100644 --- a/hypha/apply/projects/migrations/0009_documentcategory.py +++ b/hypha/apply/projects/migrations/0009_documentcategory.py @@ -4,22 +4,29 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0008_add_value_validator'), + ("application_projects", "0008_add_value_validator"), ] operations = [ migrations.CreateModel( - name='DocumentCategory', + name="DocumentCategory", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=254)), - ('recommended_minimum', models.PositiveIntegerField()), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=254)), + ("recommended_minimum", models.PositiveIntegerField()), ], options={ - 'ordering': ('name',), - 'verbose_name_plural': 'Document Categories', + "ordering": ("name",), + "verbose_name_plural": "Document Categories", }, ), ] diff --git a/hypha/apply/projects/migrations/0010_add_related_names_to_approval_fks.py b/hypha/apply/projects/migrations/0010_add_related_names_to_approval_fks.py index 8bae011649..f349d14d99 100644 --- a/hypha/apply/projects/migrations/0010_add_related_names_to_approval_fks.py +++ b/hypha/apply/projects/migrations/0010_add_related_names_to_approval_fks.py @@ -6,20 +6,27 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0009_add_approval'), + ("application_projects", "0009_add_approval"), ] operations = [ migrations.AlterField( - model_name='approval', - name='by', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='approvals', to=settings.AUTH_USER_MODEL), + model_name="approval", + name="by", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="approvals", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( - model_name='approval', - name='project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='approvals', to='application_projects.Project'), + model_name="approval", + name="project", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="approvals", + to="application_projects.Project", + ), ), ] diff --git a/hypha/apply/projects/migrations/0011_add_packet_file.py b/hypha/apply/projects/migrations/0011_add_packet_file.py index 2091a75cc5..71f5284d37 100644 --- a/hypha/apply/projects/migrations/0011_add_packet_file.py +++ b/hypha/apply/projects/migrations/0011_add_packet_file.py @@ -6,20 +6,47 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0010_add_related_names_to_approval_fks'), + ("application_projects", "0010_add_related_names_to_approval_fks"), ] operations = [ migrations.CreateModel( - name='PacketFile', + name="PacketFile", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.TextField()), - ('document', models.FileField(upload_to=hypha.apply.projects.models.project.document_path)), - ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='packet_files', to='application_projects.DocumentCategory')), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='packet_files', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.TextField()), + ( + "document", + models.FileField( + upload_to=hypha.apply.projects.models.project.document_path + ), + ), + ( + "category", + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="packet_files", + to="application_projects.DocumentCategory", + ), + ), + ( + "project", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="packet_files", + to="application_projects.Project", + ), + ), ], ), ] diff --git a/hypha/apply/projects/migrations/0012_adjust_storage_class.py b/hypha/apply/projects/migrations/0012_adjust_storage_class.py index 2014f5fad6..cc55a33aa7 100644 --- a/hypha/apply/projects/migrations/0012_adjust_storage_class.py +++ b/hypha/apply/projects/migrations/0012_adjust_storage_class.py @@ -6,15 +6,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0011_add_packet_file'), + ("application_projects", "0011_add_packet_file"), ] operations = [ migrations.AlterField( - model_name='packetfile', - name='document', - field=models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.project.document_path), + model_name="packetfile", + name="document", + field=models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.project.document_path, + ), ), ] diff --git a/hypha/apply/projects/migrations/0013_add_contract.py b/hypha/apply/projects/migrations/0013_add_contract.py index 7bc8973d77..504d1b665c 100644 --- a/hypha/apply/projects/migrations/0013_add_contract.py +++ b/hypha/apply/projects/migrations/0013_add_contract.py @@ -7,22 +7,49 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0012_adjust_storage_class'), + ("application_projects", "0012_adjust_storage_class"), ] operations = [ migrations.CreateModel( - name='Contract', + name="Contract", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('file', models.FileField(upload_to=hypha.apply.projects.models.project.contract_path)), - ('is_signed', models.BooleanField('Signed?', default=False)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('approver', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contracts', to=settings.AUTH_USER_MODEL)), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contracts', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "file", + models.FileField( + upload_to=hypha.apply.projects.models.project.contract_path + ), + ), + ("is_signed", models.BooleanField("Signed?", default=False)), + ("created_at", models.DateTimeField(auto_now_add=True)), + ( + "approver", + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="contracts", + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "project", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="contracts", + to="application_projects.Project", + ), + ), ], ), ] diff --git a/hypha/apply/projects/migrations/0014_add_payment_related_models.py b/hypha/apply/projects/migrations/0014_add_payment_related_models.py index 6d250951a2..30b4e21f45 100644 --- a/hypha/apply/projects/migrations/0014_add_payment_related_models.py +++ b/hypha/apply/projects/migrations/0014_add_payment_related_models.py @@ -9,51 +9,135 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0013_add_contract'), + ("application_projects", "0013_add_contract"), ] operations = [ migrations.CreateModel( - name='PaymentApproval', + name="PaymentApproval", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_approvals', to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("created_at", models.DateTimeField(auto_now_add=True)), + ( + "by", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="payment_approvals", + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.CreateModel( - name='PaymentReceipt', + name="PaymentReceipt", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('file', models.FileField(storage=django.core.files.storage.FileSystemStorage())), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "file", + models.FileField( + storage=django.core.files.storage.FileSystemStorage() + ), + ), ], ), migrations.CreateModel( - name='PaymentRequest', + name="PaymentRequest", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('invoice', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.payment.invoice_path)), - ('value', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])), - ('requested_at', models.DateTimeField(auto_now_add=True)), - ('date_from', models.DateTimeField()), - ('date_to', models.DateTimeField()), - ('comment', models.TextField()), - ('status', models.TextField(choices=[('submitted', 'Submitted'), ('under_review', 'Under Review'), ('paid', 'Paid'), ('declined', 'Declined')], default='submitted')), - ('by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_requests', to=settings.AUTH_USER_MODEL)), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_requests', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "invoice", + models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.payment.invoice_path, + ), + ), + ( + "value", + models.DecimalField( + decimal_places=2, + default=0, + max_digits=10, + validators=[ + django.core.validators.MinValueValidator(Decimal("0.01")) + ], + ), + ), + ("requested_at", models.DateTimeField(auto_now_add=True)), + ("date_from", models.DateTimeField()), + ("date_to", models.DateTimeField()), + ("comment", models.TextField()), + ( + "status", + models.TextField( + choices=[ + ("submitted", "Submitted"), + ("under_review", "Under Review"), + ("paid", "Paid"), + ("declined", "Declined"), + ], + default="submitted", + ), + ), + ( + "by", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="payment_requests", + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "project", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="payment_requests", + to="application_projects.Project", + ), + ), ], ), migrations.AddField( - model_name='paymentreceipt', - name='payment_request', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='receipts', to='application_projects.PaymentRequest'), + model_name="paymentreceipt", + name="payment_request", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="receipts", + to="application_projects.PaymentRequest", + ), ), migrations.AddField( - model_name='paymentapproval', - name='request', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='approvals', to='application_projects.PaymentRequest'), + model_name="paymentapproval", + name="request", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="approvals", + to="application_projects.PaymentRequest", + ), ), ] diff --git a/hypha/apply/projects/migrations/0015_add_payment_request_changes_requested.py b/hypha/apply/projects/migrations/0015_add_payment_request_changes_requested.py index 3d11bdabdb..05eb915064 100644 --- a/hypha/apply/projects/migrations/0015_add_payment_request_changes_requested.py +++ b/hypha/apply/projects/migrations/0015_add_payment_request_changes_requested.py @@ -4,15 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0014_add_payment_related_models'), + ("application_projects", "0014_add_payment_related_models"), ] operations = [ migrations.AlterField( - model_name='paymentrequest', - name='status', - field=models.TextField(choices=[('submitted', 'Submitted'), ('changes_requested', 'Changes Requested'), ('under_review', 'Under Review'), ('paid', 'Paid'), ('declined', 'Declined')], default='submitted'), + model_name="paymentrequest", + name="status", + field=models.TextField( + choices=[ + ("submitted", "Submitted"), + ("changes_requested", "Changes Requested"), + ("under_review", "Under Review"), + ("paid", "Paid"), + ("declined", "Declined"), + ], + default="submitted", + ), ), ] diff --git a/hypha/apply/projects/migrations/0016_add_project_settings.py b/hypha/apply/projects/migrations/0016_add_project_settings.py index fcd5b8ae0e..83af5d23f5 100644 --- a/hypha/apply/projects/migrations/0016_add_project_settings.py +++ b/hypha/apply/projects/migrations/0016_add_project_settings.py @@ -5,22 +5,36 @@ class Migration(migrations.Migration): - dependencies = [ - ('wagtailcore', '0040_page_draft_title'), - ('application_projects', '0015_add_payment_request_changes_requested'), + ("wagtailcore", "0040_page_draft_title"), + ("application_projects", "0015_add_payment_request_changes_requested"), ] operations = [ migrations.CreateModel( - name='ProjectSettings', + name="ProjectSettings", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('compliance_email', models.TextField(verbose_name='Compliance Email')), - ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("compliance_email", models.TextField(verbose_name="Compliance Email")), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Site", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, ), ] diff --git a/hypha/apply/projects/migrations/0017_add_sent_to_compliance_at.py b/hypha/apply/projects/migrations/0017_add_sent_to_compliance_at.py index 157528c414..247b0e979e 100644 --- a/hypha/apply/projects/migrations/0017_add_sent_to_compliance_at.py +++ b/hypha/apply/projects/migrations/0017_add_sent_to_compliance_at.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0016_add_project_settings'), + ("application_projects", "0016_add_project_settings"), ] operations = [ migrations.AddField( - model_name='project', - name='sent_to_compliance_at', + model_name="project", + name="sent_to_compliance_at", field=models.DateTimeField(null=True), ), ] diff --git a/hypha/apply/projects/migrations/0018_projectapprovalform.py b/hypha/apply/projects/migrations/0018_projectapprovalform.py index 917a0de13e..a1c277de5a 100644 --- a/hypha/apply/projects/migrations/0018_projectapprovalform.py +++ b/hypha/apply/projects/migrations/0018_projectapprovalform.py @@ -7,18 +7,455 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0017_add_sent_to_compliance_at'), + ("application_projects", "0017_add_sent_to_compliance_at"), ] operations = [ migrations.CreateModel( - name='ProjectApprovalForm', + name="ProjectApprovalForm", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('form_fields', wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))])), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), + ( + "form_fields", + wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Checkbox" + ) + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock( + required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Choice" + ), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ] + ), + ), ], ), ] diff --git a/hypha/apply/projects/migrations/0019_add_form_to_projects.py b/hypha/apply/projects/migrations/0019_add_form_to_projects.py index 694b73b112..225a63ae93 100644 --- a/hypha/apply/projects/migrations/0019_add_form_to_projects.py +++ b/hypha/apply/projects/migrations/0019_add_form_to_projects.py @@ -9,20 +9,441 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0018_projectapprovalform'), + ("application_projects", "0018_projectapprovalform"), ] operations = [ migrations.AddField( - model_name='project', - name='form_data', - field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder), + model_name="project", + name="form_data", + field=django.contrib.postgres.fields.jsonb.JSONField( + default=dict, + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder, + ), ), migrations.AddField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + ), ), ] diff --git a/hypha/apply/projects/migrations/0020_rename_value_to_requested_value.py b/hypha/apply/projects/migrations/0020_rename_value_to_requested_value.py index d3006c6ad3..3d636b2ab7 100644 --- a/hypha/apply/projects/migrations/0020_rename_value_to_requested_value.py +++ b/hypha/apply/projects/migrations/0020_rename_value_to_requested_value.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0019_add_form_to_projects'), + ("application_projects", "0019_add_form_to_projects"), ] operations = [ migrations.RenameField( - model_name='paymentrequest', - old_name='value', - new_name='requested_value', + model_name="paymentrequest", + old_name="value", + new_name="requested_value", ), ] diff --git a/hypha/apply/projects/migrations/0021_add_paid_value.py b/hypha/apply/projects/migrations/0021_add_paid_value.py index a24f1cb74f..05dbf666fa 100644 --- a/hypha/apply/projects/migrations/0021_add_paid_value.py +++ b/hypha/apply/projects/migrations/0021_add_paid_value.py @@ -6,15 +6,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0020_rename_value_to_requested_value'), + ("application_projects", "0020_rename_value_to_requested_value"), ] operations = [ migrations.AddField( - model_name='paymentrequest', - name='paid_value', - field=models.DecimalField(decimal_places=2, max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))]), + model_name="paymentrequest", + name="paid_value", + field=models.DecimalField( + decimal_places=2, + max_digits=10, + null=True, + validators=[django.core.validators.MinValueValidator(Decimal("0.01"))], + ), ), ] diff --git a/hypha/apply/projects/migrations/0022_update_field_definitions_for_forms.py b/hypha/apply/projects/migrations/0022_update_field_definitions_for_forms.py index 1dc0859652..1ad3c40a76 100644 --- a/hypha/apply/projects/migrations/0022_update_field_definitions_for_forms.py +++ b/hypha/apply/projects/migrations/0022_update_field_definitions_for_forms.py @@ -7,20 +7,1024 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0021_add_paid_value'), + ("application_projects", "0021_add_paid_value"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + ), ), migrations.AlterField( - model_name='projectapprovalform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))]), + model_name="projectapprovalform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ] + ), ), ] diff --git a/hypha/apply/projects/migrations/0023_ensure_contracts_uses_private_storage.py b/hypha/apply/projects/migrations/0023_ensure_contracts_uses_private_storage.py index bd26175228..12cffdf7c0 100644 --- a/hypha/apply/projects/migrations/0023_ensure_contracts_uses_private_storage.py +++ b/hypha/apply/projects/migrations/0023_ensure_contracts_uses_private_storage.py @@ -6,15 +6,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0022_update_field_definitions_for_forms'), + ("application_projects", "0022_update_field_definitions_for_forms"), ] operations = [ migrations.AlterField( - model_name='contract', - name='file', - field=models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.project.contract_path), + model_name="contract", + name="file", + field=models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.project.contract_path, + ), ), ] diff --git a/hypha/apply/projects/migrations/0024_allow_no_comments_on_pr.py b/hypha/apply/projects/migrations/0024_allow_no_comments_on_pr.py index a694b4d960..1b8c13f1f6 100644 --- a/hypha/apply/projects/migrations/0024_allow_no_comments_on_pr.py +++ b/hypha/apply/projects/migrations/0024_allow_no_comments_on_pr.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0023_ensure_contracts_uses_private_storage'), + ("application_projects", "0023_ensure_contracts_uses_private_storage"), ] operations = [ migrations.AlterField( - model_name='paymentrequest', - name='comment', + model_name="paymentrequest", + name="comment", field=models.TextField(blank=True), ), ] diff --git a/hypha/apply/projects/migrations/0025_add_report_models.py b/hypha/apply/projects/migrations/0025_add_report_models.py index 1c3069de3b..b13205a149 100644 --- a/hypha/apply/projects/migrations/0025_add_report_models.py +++ b/hypha/apply/projects/migrations/0025_add_report_models.py @@ -7,58 +7,127 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0024_allow_no_comments_on_pr'), + ("application_projects", "0024_allow_no_comments_on_pr"), ] operations = [ migrations.CreateModel( - name='Report', + name="Report", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('public', models.BooleanField(default=True)), - ('end_date', models.DateField()), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("public", models.BooleanField(default=True)), + ("end_date", models.DateField()), + ( + "project", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="reports", + to="application_projects.Project", + ), + ), ], options={ - 'ordering': ('-end_date',), + "ordering": ("-end_date",), }, ), migrations.CreateModel( - name='ReportConfig', + name="ReportConfig", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('schedule_start', models.DateField(null=True)), - ('occurrence', models.PositiveSmallIntegerField(default=1)), - ('frequency', models.CharField(choices=[('week', 'Weeks'), ('month', 'Months')], default='month', max_length=5)), - ('project', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='report_config', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("schedule_start", models.DateField(null=True)), + ("occurrence", models.PositiveSmallIntegerField(default=1)), + ( + "frequency", + models.CharField( + choices=[("week", "Weeks"), ("month", "Months")], + default="month", + max_length=5, + ), + ), + ( + "project", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name="report_config", + to="application_projects.Project", + ), + ), ], ), migrations.CreateModel( - name='ReportPrivateFiles', + name="ReportPrivateFiles", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('document', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.report.report_path)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "document", + models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.report.report_path, + ), + ), ], ), migrations.CreateModel( - name='ReportVersion', + name="ReportVersion", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('submitted', models.DateTimeField()), - ('content', models.TextField()), - ('report', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='application_projects.Report')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("submitted", models.DateTimeField()), + ("content", models.TextField()), + ( + "report", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="versions", + to="application_projects.Report", + ), + ), ], ), migrations.AddField( - model_name='contract', - name='approved_at', + model_name="contract", + name="approved_at", field=models.DateTimeField(null=True), ), migrations.AddField( - model_name='reportprivatefiles', - name='report', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='application_projects.ReportVersion'), + model_name="reportprivatefiles", + name="report", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="files", + to="application_projects.ReportVersion", + ), ), ] diff --git a/hypha/apply/projects/migrations/0026_data_contract_approved_date.py b/hypha/apply/projects/migrations/0026_data_contract_approved_date.py index 92ba2db6c1..c66bc1d27d 100644 --- a/hypha/apply/projects/migrations/0026_data_contract_approved_date.py +++ b/hypha/apply/projects/migrations/0026_data_contract_approved_date.py @@ -5,14 +5,13 @@ def copy_submitted_date(apps, schema_editor): - Contract = apps.get_model('application_projects', 'Contract') - Contract.objects.all().update(approved_at=F('created_at')) + Contract = apps.get_model("application_projects", "Contract") + Contract.objects.all().update(approved_at=F("created_at")) class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0025_add_report_models'), + ("application_projects", "0025_add_report_models"), ] operations = [ diff --git a/hypha/apply/projects/migrations/0027_report_current.py b/hypha/apply/projects/migrations/0027_report_current.py index 5337aa8ba9..3d22a521d9 100644 --- a/hypha/apply/projects/migrations/0027_report_current.py +++ b/hypha/apply/projects/migrations/0027_report_current.py @@ -5,15 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0026_data_contract_approved_date'), + ("application_projects", "0026_data_contract_approved_date"), ] operations = [ migrations.AddField( - model_name='report', - name='current', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='live_for_report', to='application_projects.ReportVersion'), + model_name="report", + name="current", + field=models.OneToOneField( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="live_for_report", + to="application_projects.ReportVersion", + ), ), ] diff --git a/hypha/apply/projects/migrations/0028_report_draft.py b/hypha/apply/projects/migrations/0028_report_draft.py index 8ff7c23512..25fc1bacb9 100644 --- a/hypha/apply/projects/migrations/0028_report_draft.py +++ b/hypha/apply/projects/migrations/0028_report_draft.py @@ -6,27 +6,36 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0027_report_current'), + ("application_projects", "0027_report_current"), ] operations = [ migrations.AddField( - model_name='report', - name='draft', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='draft_for_report', to='application_projects.ReportVersion'), + model_name="report", + name="draft", + field=models.OneToOneField( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="draft_for_report", + to="application_projects.ReportVersion", + ), ), migrations.AddField( - model_name='reportversion', - name='draft', + model_name="reportversion", + name="draft", field=models.BooleanField(default=False), preserve_default=False, ), migrations.AddField( - model_name='reportversion', - name='author', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reports', to=settings.AUTH_USER_MODEL), + model_name="reportversion", + name="author", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="reports", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/projects/migrations/0029_report_submitted.py b/hypha/apply/projects/migrations/0029_report_submitted.py index 635f0b796f..a3d79fdd28 100644 --- a/hypha/apply/projects/migrations/0029_report_submitted.py +++ b/hypha/apply/projects/migrations/0029_report_submitted.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0028_report_draft'), + ("application_projects", "0028_report_draft"), ] operations = [ migrations.AddField( - model_name='report', - name='submitted', + model_name="report", + name="submitted", field=models.DateTimeField(null=True), ), ] diff --git a/hypha/apply/projects/migrations/0030_report_skipped.py b/hypha/apply/projects/migrations/0030_report_skipped.py index 103f0df3f5..9bac08dc02 100644 --- a/hypha/apply/projects/migrations/0030_report_skipped.py +++ b/hypha/apply/projects/migrations/0030_report_skipped.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0029_report_submitted'), + ("application_projects", "0029_report_submitted"), ] operations = [ migrations.AddField( - model_name='report', - name='skipped', + model_name="report", + name="skipped", field=models.BooleanField(default=False), ), ] diff --git a/hypha/apply/projects/migrations/0031_add_public_private_content.py b/hypha/apply/projects/migrations/0031_add_public_private_content.py index c4af728a87..5b5849ef95 100644 --- a/hypha/apply/projects/migrations/0031_add_public_private_content.py +++ b/hypha/apply/projects/migrations/0031_add_public_private_content.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0030_report_skipped'), + ("application_projects", "0030_report_skipped"), ] operations = [ migrations.RenameField( - model_name='reportversion', - old_name='content', - new_name='public_content', + model_name="reportversion", + old_name="content", + new_name="public_content", ), migrations.RemoveField( - model_name='report', - name='public', + model_name="report", + name="public", ), migrations.AddField( - model_name='reportversion', - name='private_content', - field=models.TextField(default=''), + model_name="reportversion", + name="private_content", + field=models.TextField(default=""), preserve_default=False, ), ] diff --git a/hypha/apply/projects/migrations/0032_report_notified.py b/hypha/apply/projects/migrations/0032_report_notified.py index ec7ae7bf0c..929daece20 100644 --- a/hypha/apply/projects/migrations/0032_report_notified.py +++ b/hypha/apply/projects/migrations/0032_report_notified.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0031_add_public_private_content'), + ("application_projects", "0031_add_public_private_content"), ] operations = [ migrations.AddField( - model_name='report', - name='notified', + model_name="report", + name="notified", field=models.DateTimeField(null=True), ), ] diff --git a/hypha/apply/projects/migrations/0033_add_word_limit_to_text_blocks.py b/hypha/apply/projects/migrations/0033_add_word_limit_to_text_blocks.py index acc961900c..05b27abe4b 100644 --- a/hypha/apply/projects/migrations/0033_add_word_limit_to_text_blocks.py +++ b/hypha/apply/projects/migrations/0033_add_word_limit_to_text_blocks.py @@ -7,20 +7,1036 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0032_report_notified'), + ("application_projects", "0032_report_notified"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + ), ), migrations.AlterField( - model_name='projectapprovalform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))]), + model_name="projectapprovalform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ] + ), ), ] diff --git a/hypha/apply/projects/migrations/0034_multi_input_char_block.py b/hypha/apply/projects/migrations/0034_multi_input_char_block.py index e823e76f9a..a1a7b2f0fd 100644 --- a/hypha/apply/projects/migrations/0034_multi_input_char_block.py +++ b/hypha/apply/projects/migrations/0034_multi_input_char_block.py @@ -7,20 +7,1148 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0033_add_word_limit_to_text_blocks'), + ("application_projects", "0033_add_word_limit_to_text_blocks"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + ), ), migrations.AlterField( - model_name='projectapprovalform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text/header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))]), + model_name="projectapprovalform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text/header" + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ] + ), ), ] diff --git a/hypha/apply/projects/migrations/0035_add_heading_block_to_form_fields_block.py b/hypha/apply/projects/migrations/0035_add_heading_block_to_form_fields_block.py index 582cde4cea..5a0b074549 100644 --- a/hypha/apply/projects/migrations/0035_add_heading_block_to_form_fields_block.py +++ b/hypha/apply/projects/migrations/0035_add_heading_block_to_form_fields_block.py @@ -7,20 +7,1198 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0034_multi_input_char_block'), + ("application_projects", "0034_multi_input_char_block"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + ), ), migrations.AlterField( - model_name='projectapprovalform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required')), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))]), + model_name="projectapprovalform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required" + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ] + ), ), ] diff --git a/hypha/apply/projects/migrations/0036_add_vendor.py b/hypha/apply/projects/migrations/0036_add_vendor.py index ee7aa31374..4d9d77c1a1 100644 --- a/hypha/apply/projects/migrations/0036_add_vendor.py +++ b/hypha/apply/projects/migrations/0036_add_vendor.py @@ -8,123 +8,460 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0035_add_heading_block_to_form_fields_block'), + ("application_projects", "0035_add_heading_block_to_form_fields_block"), ] operations = [ migrations.CreateModel( - name='BankInformation', + name="BankInformation", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('account_holder_name', models.CharField(max_length=150)), - ('account_routing_number', models.CharField(max_length=10)), - ('account_number', models.CharField(max_length=20)), - ('account_currency', models.CharField(max_length=10)), - ('need_extra_info', models.BooleanField(default=False)), - ('branch_address', models.TextField(blank=True, verbose_name='Address')), - ('nid_type', models.CharField(blank=True, max_length=25, verbose_name='National Identity Document Type')), - ('nid_number', models.CharField(blank=True, max_length=20, verbose_name='National Identity Document Number')), - ('iba_info', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bank_info', to='application_projects.BankInformation', verbose_name='Intermediary Bank Account Information')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("account_holder_name", models.CharField(max_length=150)), + ("account_routing_number", models.CharField(max_length=10)), + ("account_number", models.CharField(max_length=20)), + ("account_currency", models.CharField(max_length=10)), + ("need_extra_info", models.BooleanField(default=False)), + ( + "branch_address", + models.TextField(blank=True, verbose_name="Address"), + ), + ( + "nid_type", + models.CharField( + blank=True, + max_length=25, + verbose_name="National Identity Document Type", + ), + ), + ( + "nid_number", + models.CharField( + blank=True, + max_length=20, + verbose_name="National Identity Document Number", + ), + ), + ( + "iba_info", + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="bank_info", + to="application_projects.BankInformation", + verbose_name="Intermediary Bank Account Information", + ), + ), ], ), migrations.RemoveField( - model_name='project', - name='contact_address', + model_name="project", + name="contact_address", ), migrations.RemoveField( - model_name='project', - name='contact_email', + model_name="project", + name="contact_email", ), migrations.RemoveField( - model_name='project', - name='contact_legal_name', + model_name="project", + name="contact_legal_name", ), migrations.RemoveField( - model_name='project', - name='contact_phone', + model_name="project", + name="contact_phone", ), migrations.AddField( - model_name='projectsettings', - name='vendor_setup_required', + model_name="projectsettings", + name="vendor_setup_required", field=models.BooleanField(default=True), ), migrations.CreateModel( - name='VendorFormSettings', + name="VendorFormSettings", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name_label', models.TextField(default='1. What is the name of the person/organisation on the contract?', verbose_name='label')), - ('name_help_text', wagtail.fields.RichTextField(blank=True, default='This is the party name in the contract.', verbose_name='help text')), - ('contractor_name_label', models.TextField(default="2. What is the individual's name who is signing the contract?", verbose_name='label')), - ('contractor_name_help_text', wagtail.fields.RichTextField(blank=True, default='This person is is authorised to sign contract on behalf of the person or organization named above.', verbose_name='help text')), - ('type_label', models.TextField(default='3. Is the bank account owned by the person or organisation in the Question 1 above?', verbose_name='label')), - ('type_help_text', wagtail.fields.RichTextField(blank=True, default='The name of the bank account must be the same as on the contract.', verbose_name='help text')), - ('required_to_pay_taxes_label', models.TextField(default='Is the organisation required to pay US taxes?', verbose_name='label')), - ('required_to_pay_taxes_help_text', wagtail.fields.RichTextField(blank=True, default='', verbose_name='help text')), - ('due_diligence_documents_label', models.TextField(default='Due Diligence Documents', verbose_name='label')), - ('due_diligence_documents_help_text', wagtail.fields.RichTextField(blank=True, default='Upload Due Diligence Documents. E.g. w8/w9 forms.', verbose_name='help text')), - ('account_holder_name_label', models.TextField(default='Bank Account Holder name', verbose_name='label')), - ('account_holder_name_help_text', wagtail.fields.RichTextField(blank=True, default='This name must be same as the person or organisation that signed the contract. This person is authorised to sign contracts on behalf of the person or organisation named above.', verbose_name='help text')), - ('account_routing_number_label', models.TextField(default='Bank Account Routing number', verbose_name='label')), - ('account_routing_number_help_text', wagtail.fields.RichTextField(blank=True, default='Depending on your country, this might be called the ACH, SWIFT, BIC or ABA number.', verbose_name='help text')), - ('account_number_label', models.TextField(default='Bank Account Number', verbose_name='label')), - ('account_number_help_text', wagtail.fields.RichTextField(blank=True, default='Depending on your country, this might be called the account number, IBAN, or BBAN number.', verbose_name='help text')), - ('account_currency_label', models.TextField(default='Bank Account Currency', verbose_name='label')), - ('account_currency_help_text', wagtail.fields.RichTextField(blank=True, default='This is the currency of this bank account.', verbose_name='help text')), - ('need_extra_info_label', models.TextField(default='Do you need to provide us with extra information?', verbose_name='label')), - ('need_extra_info_help_text', wagtail.fields.RichTextField(blank=True, default='', verbose_name='help text')), - ('branch_address_label', models.TextField(default='Bank Account Branch Address', verbose_name='label')), - ('branch_address_help_text', models.TextField(blank=True, default='The address of the bank branch where you have the bank account located(not the bank account holder address)', verbose_name='help text')), - ('ib_account_routing_number_label', models.TextField(default='Intermediary Bank Account Routing Number', verbose_name='label')), - ('ib_account_routing_number_help_text', wagtail.fields.RichTextField(blank=True, default='Depending on your country, this might be called ACH, SWIFT, BIC or ABA number', verbose_name='help text')), - ('ib_account_number_label', models.TextField(default='Intermediary Bank Account Number', verbose_name='label')), - ('ib_account_number_help_text', wagtail.fields.RichTextField(blank=True, default='Depending on your country, this might be called the account number, IBAN, or BBAN number', verbose_name='help text')), - ('ib_account_currency_label', models.TextField(default='Intermediary Bank Account Currency', verbose_name='label')), - ('ib_account_currency_help_text', wagtail.fields.RichTextField(blank=True, default='This is the currency of this bank account', verbose_name='help text')), - ('ib_branch_address_label', models.TextField(default='Intermediary Bank Branch Address', verbose_name='label')), - ('ib_branch_address_help_text', wagtail.fields.RichTextField(blank=True, default='Bank branch address(not the bank account holder address)', verbose_name='help text')), - ('nid_type_label', models.TextField(default='Account Holder National Identity Document Type', verbose_name='label')), - ('nid_type_help_text', wagtail.fields.RichTextField(blank=True, default='This could be a passport, a National Identity number, or other national identity document.', verbose_name='help text')), - ('nid_number_label', models.TextField(default='Account Holder National Identity Document Number', verbose_name='label')), - ('nid_number_help_text', wagtail.fields.RichTextField(blank=True, default='', verbose_name='help text')), - ('other_info_label', models.TextField(default='Other Information', verbose_name='label')), - ('other_info_help_text', wagtail.fields.RichTextField(blank=True, default='If you need to include other information not listed above, provide it here.', verbose_name='help text')), - ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "name_label", + models.TextField( + default="1. What is the name of the person/organisation on the contract?", + verbose_name="label", + ), + ), + ( + "name_help_text", + wagtail.fields.RichTextField( + blank=True, + default="This is the party name in the contract.", + verbose_name="help text", + ), + ), + ( + "contractor_name_label", + models.TextField( + default="2. What is the individual's name who is signing the contract?", + verbose_name="label", + ), + ), + ( + "contractor_name_help_text", + wagtail.fields.RichTextField( + blank=True, + default="This person is is authorised to sign contract on behalf of the person or organization named above.", + verbose_name="help text", + ), + ), + ( + "type_label", + models.TextField( + default="3. Is the bank account owned by the person or organisation in the Question 1 above?", + verbose_name="label", + ), + ), + ( + "type_help_text", + wagtail.fields.RichTextField( + blank=True, + default="The name of the bank account must be the same as on the contract.", + verbose_name="help text", + ), + ), + ( + "required_to_pay_taxes_label", + models.TextField( + default="Is the organisation required to pay US taxes?", + verbose_name="label", + ), + ), + ( + "required_to_pay_taxes_help_text", + wagtail.fields.RichTextField( + blank=True, default="", verbose_name="help text" + ), + ), + ( + "due_diligence_documents_label", + models.TextField( + default="Due Diligence Documents", verbose_name="label" + ), + ), + ( + "due_diligence_documents_help_text", + wagtail.fields.RichTextField( + blank=True, + default="Upload Due Diligence Documents. E.g. w8/w9 forms.", + verbose_name="help text", + ), + ), + ( + "account_holder_name_label", + models.TextField( + default="Bank Account Holder name", verbose_name="label" + ), + ), + ( + "account_holder_name_help_text", + wagtail.fields.RichTextField( + blank=True, + default="This name must be same as the person or organisation that signed the contract. This person is authorised to sign contracts on behalf of the person or organisation named above.", + verbose_name="help text", + ), + ), + ( + "account_routing_number_label", + models.TextField( + default="Bank Account Routing number", verbose_name="label" + ), + ), + ( + "account_routing_number_help_text", + wagtail.fields.RichTextField( + blank=True, + default="Depending on your country, this might be called the ACH, SWIFT, BIC or ABA number.", + verbose_name="help text", + ), + ), + ( + "account_number_label", + models.TextField( + default="Bank Account Number", verbose_name="label" + ), + ), + ( + "account_number_help_text", + wagtail.fields.RichTextField( + blank=True, + default="Depending on your country, this might be called the account number, IBAN, or BBAN number.", + verbose_name="help text", + ), + ), + ( + "account_currency_label", + models.TextField( + default="Bank Account Currency", verbose_name="label" + ), + ), + ( + "account_currency_help_text", + wagtail.fields.RichTextField( + blank=True, + default="This is the currency of this bank account.", + verbose_name="help text", + ), + ), + ( + "need_extra_info_label", + models.TextField( + default="Do you need to provide us with extra information?", + verbose_name="label", + ), + ), + ( + "need_extra_info_help_text", + wagtail.fields.RichTextField( + blank=True, default="", verbose_name="help text" + ), + ), + ( + "branch_address_label", + models.TextField( + default="Bank Account Branch Address", verbose_name="label" + ), + ), + ( + "branch_address_help_text", + models.TextField( + blank=True, + default="The address of the bank branch where you have the bank account located(not the bank account holder address)", + verbose_name="help text", + ), + ), + ( + "ib_account_routing_number_label", + models.TextField( + default="Intermediary Bank Account Routing Number", + verbose_name="label", + ), + ), + ( + "ib_account_routing_number_help_text", + wagtail.fields.RichTextField( + blank=True, + default="Depending on your country, this might be called ACH, SWIFT, BIC or ABA number", + verbose_name="help text", + ), + ), + ( + "ib_account_number_label", + models.TextField( + default="Intermediary Bank Account Number", verbose_name="label" + ), + ), + ( + "ib_account_number_help_text", + wagtail.fields.RichTextField( + blank=True, + default="Depending on your country, this might be called the account number, IBAN, or BBAN number", + verbose_name="help text", + ), + ), + ( + "ib_account_currency_label", + models.TextField( + default="Intermediary Bank Account Currency", + verbose_name="label", + ), + ), + ( + "ib_account_currency_help_text", + wagtail.fields.RichTextField( + blank=True, + default="This is the currency of this bank account", + verbose_name="help text", + ), + ), + ( + "ib_branch_address_label", + models.TextField( + default="Intermediary Bank Branch Address", verbose_name="label" + ), + ), + ( + "ib_branch_address_help_text", + wagtail.fields.RichTextField( + blank=True, + default="Bank branch address(not the bank account holder address)", + verbose_name="help text", + ), + ), + ( + "nid_type_label", + models.TextField( + default="Account Holder National Identity Document Type", + verbose_name="label", + ), + ), + ( + "nid_type_help_text", + wagtail.fields.RichTextField( + blank=True, + default="This could be a passport, a National Identity number, or other national identity document.", + verbose_name="help text", + ), + ), + ( + "nid_number_label", + models.TextField( + default="Account Holder National Identity Document Number", + verbose_name="label", + ), + ), + ( + "nid_number_help_text", + wagtail.fields.RichTextField( + blank=True, default="", verbose_name="help text" + ), + ), + ( + "other_info_label", + models.TextField(default="Other Information", verbose_name="label"), + ), + ( + "other_info_help_text", + wagtail.fields.RichTextField( + blank=True, + default="If you need to include other information not listed above, provide it here.", + verbose_name="help text", + ), + ), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.Site", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, ), migrations.CreateModel( - name='Vendor', + name="Vendor", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Creation time')), - ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Update time')), - ('name', models.CharField(blank=True, max_length=150)), - ('contractor_name', models.CharField(blank=True, max_length=150)), - ('address', models.TextField(blank=True, verbose_name='Address')), - ('type', models.CharField(blank=True, choices=[('organization', 'Yes, the account belongs to the organisation above'), ('personal', 'No, it is a personal bank account')], max_length=15)), - ('required_to_pay_taxes', models.BooleanField(default=False)), - ('other_info', models.TextField(blank=True)), - ('user_has_updated_details', models.BooleanField(default=False)), - ('bank_info', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='application_projects.BankInformation')), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, related_name='vendor', to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "created_at", + models.DateTimeField( + auto_now_add=True, verbose_name="Creation time" + ), + ), + ( + "updated_at", + models.DateTimeField(auto_now=True, verbose_name="Update time"), + ), + ("name", models.CharField(blank=True, max_length=150)), + ("contractor_name", models.CharField(blank=True, max_length=150)), + ("address", models.TextField(blank=True, verbose_name="Address")), + ( + "type", + models.CharField( + blank=True, + choices=[ + ( + "organization", + "Yes, the account belongs to the organisation above", + ), + ("personal", "No, it is a personal bank account"), + ], + max_length=15, + ), + ), + ("required_to_pay_taxes", models.BooleanField(default=False)), + ("other_info", models.TextField(blank=True)), + ("user_has_updated_details", models.BooleanField(default=False)), + ( + "bank_info", + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="application_projects.BankInformation", + ), + ), + ( + "user", + models.OneToOneField( + on_delete=django.db.models.deletion.PROTECT, + related_name="vendor", + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.CreateModel( - name='DueDiligenceDocument', + name="DueDiligenceDocument", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('document', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to='due_diligence_documents')), - ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='due_diligence_documents', to='application_projects.Vendor')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "document", + models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to="due_diligence_documents", + ), + ), + ( + "vendor", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="due_diligence_documents", + to="application_projects.Vendor", + ), + ), ], ), migrations.AddField( - model_name='project', - name='vendor', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='projects', to='application_projects.Vendor'), + model_name="project", + name="vendor", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="projects", + to="application_projects.Vendor", + ), ), ] diff --git a/hypha/apply/projects/migrations/0037_add_project_invoicing.py b/hypha/apply/projects/migrations/0037_add_project_invoicing.py index 996bb3761d..e56c5fe793 100644 --- a/hypha/apply/projects/migrations/0037_add_project_invoicing.py +++ b/hypha/apply/projects/migrations/0037_add_project_invoicing.py @@ -10,36 +10,116 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0036_add_vendor'), + ("application_projects", "0036_add_vendor"), ] operations = [ migrations.CreateModel( - name='Invoice', + name="Invoice", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date_from', models.DateTimeField()), - ('date_to', models.DateTimeField()), - ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])), - ('paid_value', models.DecimalField(decimal_places=2, max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])), - ('document', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.payment.invoice_path)), - ('requested_at', models.DateTimeField(auto_now_add=True)), - ('message_for_pm', models.TextField(blank=True)), - ('comment', models.TextField(blank=True)), - ('status', models.TextField(choices=[('submitted', 'Submitted'), ('changes_requested', 'Changes Requested'), ('under_review', 'Under Review'), ('paid', 'Paid'), ('declined', 'Declined')], default='submitted')), - ('by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to=settings.AUTH_USER_MODEL)), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("date_from", models.DateTimeField()), + ("date_to", models.DateTimeField()), + ( + "amount", + models.DecimalField( + decimal_places=2, + default=0, + max_digits=10, + validators=[ + django.core.validators.MinValueValidator(Decimal("0.01")) + ], + ), + ), + ( + "paid_value", + models.DecimalField( + decimal_places=2, + max_digits=10, + null=True, + validators=[ + django.core.validators.MinValueValidator(Decimal("0.01")) + ], + ), + ), + ( + "document", + models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.payment.invoice_path, + ), + ), + ("requested_at", models.DateTimeField(auto_now_add=True)), + ("message_for_pm", models.TextField(blank=True)), + ("comment", models.TextField(blank=True)), + ( + "status", + models.TextField( + choices=[ + ("submitted", "Submitted"), + ("changes_requested", "Changes Requested"), + ("under_review", "Under Review"), + ("paid", "Paid"), + ("declined", "Declined"), + ], + default="submitted", + ), + ), + ( + "by", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="invoices", + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "project", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="invoices", + to="application_projects.Project", + ), + ), ], ), migrations.CreateModel( - name='SupportingDocument', + name="SupportingDocument", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('document', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to='supporting_documents')), - ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='supporting_documents', to='application_projects.Invoice')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "document", + models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to="supporting_documents", + ), + ), + ( + "invoice", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="supporting_documents", + to="application_projects.Invoice", + ), + ), ], ), ] diff --git a/hypha/apply/projects/migrations/0038_project_translateble.py b/hypha/apply/projects/migrations/0038_project_translateble.py index 7748e2e84a..058c7d94e9 100644 --- a/hypha/apply/projects/migrations/0038_project_translateble.py +++ b/hypha/apply/projects/migrations/0038_project_translateble.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0037_add_project_invoicing'), + ("application_projects", "0037_add_project_invoicing"), ] operations = [ migrations.AlterField( - model_name='invoice', - name='message_for_pm', - field=models.TextField(blank=True, verbose_name='Message'), + model_name="invoice", + name="message_for_pm", + field=models.TextField(blank=True, verbose_name="Message"), ), ] diff --git a/hypha/apply/projects/migrations/0039_add_deliverables.py b/hypha/apply/projects/migrations/0039_add_deliverables.py index 7fb5075207..2bfff8f03b 100644 --- a/hypha/apply/projects/migrations/0039_add_deliverables.py +++ b/hypha/apply/projects/migrations/0039_add_deliverables.py @@ -7,34 +7,86 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0038_project_translateble'), + ("application_projects", "0038_project_translateble"), ] operations = [ migrations.CreateModel( - name='Deliverable', + name="Deliverable", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.TextField()), - ('available_to_invoice', models.IntegerField(default=1)), - ('invoice_quantity', models.IntegerField(default=0, help_text='Quantity Selected on an Invoice')), - ('unit_price', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])), - ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deliverables', to='application_projects.Project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.TextField()), + ("available_to_invoice", models.IntegerField(default=1)), + ( + "invoice_quantity", + models.IntegerField( + default=0, help_text="Quantity Selected on an Invoice" + ), + ), + ( + "unit_price", + models.DecimalField( + decimal_places=2, + max_digits=10, + validators=[ + django.core.validators.MinValueValidator(Decimal("0.01")) + ], + ), + ), + ( + "project", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="deliverables", + to="application_projects.Project", + ), + ), ], ), migrations.CreateModel( - name='InvoiceDeliverable', + name="InvoiceDeliverable", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('quantity', models.IntegerField(default=0, help_text='Quantity Selected on an Invoice')), - ('deliverable', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='deliverables', to='application_projects.Deliverable')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "quantity", + models.IntegerField( + default=0, help_text="Quantity Selected on an Invoice" + ), + ), + ( + "deliverable", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="deliverables", + to="application_projects.Deliverable", + ), + ), ], ), migrations.AddField( - model_name='invoice', - name='deliverables', - field=models.ManyToManyField(related_name='invoices', to='application_projects.InvoiceDeliverable'), + model_name="invoice", + name="deliverables", + field=models.ManyToManyField( + related_name="invoices", to="application_projects.InvoiceDeliverable" + ), ), ] diff --git a/hypha/apply/projects/migrations/0040_remove_deliverable_invoice_quantity.py b/hypha/apply/projects/migrations/0040_remove_deliverable_invoice_quantity.py index 2f6fcb31dc..cc149e2af0 100644 --- a/hypha/apply/projects/migrations/0040_remove_deliverable_invoice_quantity.py +++ b/hypha/apply/projects/migrations/0040_remove_deliverable_invoice_quantity.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0039_add_deliverables'), + ("application_projects", "0039_add_deliverables"), ] operations = [ migrations.RemoveField( - model_name='deliverable', - name='invoice_quantity', + model_name="deliverable", + name="invoice_quantity", ), ] diff --git a/hypha/apply/projects/migrations/0041_payment_requests_cleanup.py b/hypha/apply/projects/migrations/0041_payment_requests_cleanup.py index 0663a83cfb..95cec9ef45 100644 --- a/hypha/apply/projects/migrations/0041_payment_requests_cleanup.py +++ b/hypha/apply/projects/migrations/0041_payment_requests_cleanup.py @@ -4,31 +4,30 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0040_remove_deliverable_invoice_quantity'), + ("application_projects", "0040_remove_deliverable_invoice_quantity"), ] operations = [ migrations.RemoveField( - model_name='paymentreceipt', - name='payment_request', + model_name="paymentreceipt", + name="payment_request", ), migrations.RemoveField( - model_name='paymentrequest', - name='by', + model_name="paymentrequest", + name="by", ), migrations.RemoveField( - model_name='paymentrequest', - name='project', + model_name="paymentrequest", + name="project", ), migrations.DeleteModel( - name='PaymentApproval', + name="PaymentApproval", ), migrations.DeleteModel( - name='PaymentReceipt', + name="PaymentReceipt", ), migrations.DeleteModel( - name='PaymentRequest', + name="PaymentRequest", ), ] diff --git a/hypha/apply/projects/migrations/0042_delete_project_approval_form.py b/hypha/apply/projects/migrations/0042_delete_project_approval_form.py index b4fe159b4d..0f8eb0621f 100644 --- a/hypha/apply/projects/migrations/0042_delete_project_approval_form.py +++ b/hypha/apply/projects/migrations/0042_delete_project_approval_form.py @@ -9,9 +9,8 @@ def migrate_label_and_relations(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0041_payment_requests_cleanup'), + ("application_projects", "0041_payment_requests_cleanup"), ] operations = [ diff --git a/hypha/apply/projects/migrations/0043_remove_project_approval_form.py b/hypha/apply/projects/migrations/0043_remove_project_approval_form.py index 35df01fee5..889468d36d 100644 --- a/hypha/apply/projects/migrations/0043_remove_project_approval_form.py +++ b/hypha/apply/projects/migrations/0043_remove_project_approval_form.py @@ -4,13 +4,12 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0042_delete_project_approval_form'), + ("application_projects", "0042_delete_project_approval_form"), ] operations = [ migrations.DeleteModel( - name='ProjectApprovalForm', + name="ProjectApprovalForm", ), ] diff --git a/hypha/apply/projects/migrations/0044_add_resubmitted_status.py b/hypha/apply/projects/migrations/0044_add_resubmitted_status.py index bde6ad06cc..3c58f3746e 100644 --- a/hypha/apply/projects/migrations/0044_add_resubmitted_status.py +++ b/hypha/apply/projects/migrations/0044_add_resubmitted_status.py @@ -4,15 +4,26 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0043_remove_project_approval_form'), + ("application_projects", "0043_remove_project_approval_form"), ] operations = [ migrations.AlterField( - model_name='invoice', - name='status', - field=models.TextField(choices=[('submitted', 'Submitted'), ('changes_requested', 'Changes Requested'), ('approved_by_staff', 'Approved by staff'), ('approved_by_finance1', 'Approved By Finance 1'), ('approved_by_finance2', 'Approved By Finance 2'), ('resubmitted', 'Resubmitted'), ('paid', 'Paid'), ('declined', 'Declined')], default='submitted'), + model_name="invoice", + name="status", + field=models.TextField( + choices=[ + ("submitted", "Submitted"), + ("changes_requested", "Changes Requested"), + ("approved_by_staff", "Approved by staff"), + ("approved_by_finance1", "Approved By Finance 1"), + ("approved_by_finance2", "Approved By Finance 2"), + ("resubmitted", "Resubmitted"), + ("paid", "Paid"), + ("declined", "Declined"), + ], + default="submitted", + ), ), ] diff --git a/hypha/apply/projects/migrations/0045_use_fsm_field_for_status.py b/hypha/apply/projects/migrations/0045_use_fsm_field_for_status.py index 7043630bb3..a206e44b21 100644 --- a/hypha/apply/projects/migrations/0045_use_fsm_field_for_status.py +++ b/hypha/apply/projects/migrations/0045_use_fsm_field_for_status.py @@ -5,15 +5,29 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0044_add_resubmitted_status'), + ("application_projects", "0044_add_resubmitted_status"), ] operations = [ migrations.AlterField( - model_name='invoice', - name='status', - field=django_fsm.FSMField(choices=[('submitted', 'Submitted'), ('resubmitted', 'Resubmitted'), ('changes_requested_staff', 'Changes Requested by Staff'), ('changes_requested_finance_1', 'Changes Requested by Finance 1'), ('changes_requested_finance_2', 'Changes Requested by Finance 2'), ('approved_by_staff', 'Approved by Staff'), ('approved_by_finance_1', 'Approved by Finance 1'), ('approved_by_finance_2', 'Approved by Finance 2'), ('paid', 'Paid'), ('declined', 'Declined')], default='submitted', max_length=50), + model_name="invoice", + name="status", + field=django_fsm.FSMField( + choices=[ + ("submitted", "Submitted"), + ("resubmitted", "Resubmitted"), + ("changes_requested_staff", "Changes Requested by Staff"), + ("changes_requested_finance_1", "Changes Requested by Finance 1"), + ("changes_requested_finance_2", "Changes Requested by Finance 2"), + ("approved_by_staff", "Approved by Staff"), + ("approved_by_finance_1", "Approved by Finance 1"), + ("approved_by_finance_2", "Approved by Finance 2"), + ("paid", "Paid"), + ("declined", "Declined"), + ], + default="submitted", + max_length=50, + ), ), ] diff --git a/hypha/apply/projects/migrations/0046_add_required_checks_field.py b/hypha/apply/projects/migrations/0046_add_required_checks_field.py index 2ce8f69574..4a27d482f3 100644 --- a/hypha/apply/projects/migrations/0046_add_required_checks_field.py +++ b/hypha/apply/projects/migrations/0046_add_required_checks_field.py @@ -4,20 +4,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0045_use_fsm_field_for_status'), + ("application_projects", "0045_use_fsm_field_for_status"), ] operations = [ migrations.AddField( - model_name='invoice', - name='valid_checks', - field=models.BooleanField(default=False, help_text='Valid OFAC, SAM, W8/W9 on file'), + model_name="invoice", + name="valid_checks", + field=models.BooleanField( + default=False, help_text="Valid OFAC, SAM, W8/W9 on file" + ), ), migrations.AddField( - model_name='invoice', - name='valid_checks_link', - field=models.URLField(blank=True, help_text='Link to SAM/OFAC/W8/W9'), + model_name="invoice", + name="valid_checks_link", + field=models.URLField(blank=True, help_text="Link to SAM/OFAC/W8/W9"), ), ] diff --git a/hypha/apply/projects/migrations/0047_alter_project_form_data.py b/hypha/apply/projects/migrations/0047_alter_project_form_data.py index 12c346ebb7..92e98b6f89 100644 --- a/hypha/apply/projects/migrations/0047_alter_project_form_data.py +++ b/hypha/apply/projects/migrations/0047_alter_project_form_data.py @@ -5,15 +5,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0046_add_required_checks_field'), + ("application_projects", "0046_add_required_checks_field"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_data', - field=models.JSONField(default=dict, encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder), + model_name="project", + name="form_data", + field=models.JSONField( + default=dict, + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder, + ), ), ] diff --git a/hypha/apply/projects/migrations/0048_alter_project_value.py b/hypha/apply/projects/migrations/0048_alter_project_value.py index ee1986ce4d..2c1e2fd179 100644 --- a/hypha/apply/projects/migrations/0048_alter_project_value.py +++ b/hypha/apply/projects/migrations/0048_alter_project_value.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0047_alter_project_form_data'), + ("application_projects", "0047_alter_project_form_data"), ] operations = [ migrations.AlterField( - model_name='project', - name='value', + model_name="project", + name="value", field=models.PositiveIntegerField(default=0), ), ] diff --git a/hypha/apply/projects/migrations/0049_add_fields_for_finance_integrations.py b/hypha/apply/projects/migrations/0049_add_fields_for_finance_integrations.py index 08f99759d6..5265d0c23f 100644 --- a/hypha/apply/projects/migrations/0049_add_fields_for_finance_integrations.py +++ b/hypha/apply/projects/migrations/0049_add_fields_for_finance_integrations.py @@ -4,30 +4,43 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0048_alter_project_value'), + ("application_projects", "0048_alter_project_value"), ] operations = [ migrations.AddField( - model_name='deliverable', - name='external_id', - field=models.CharField(blank=True, help_text='ID of this deliverable at integrated payment service.', max_length=30), + model_name="deliverable", + name="external_id", + field=models.CharField( + blank=True, + help_text="ID of this deliverable at integrated payment service.", + max_length=30, + ), ), migrations.AddField( - model_name='deliverable', - name='extra_information', - field=models.JSONField(default=dict, help_text='More details of the deliverable at integrated payment service.'), + model_name="deliverable", + name="extra_information", + field=models.JSONField( + default=dict, + help_text="More details of the deliverable at integrated payment service.", + ), ), migrations.AddField( - model_name='project', - name='external_project_information', - field=models.JSONField(default=dict, help_text='More details of the project integrated at payment service.'), + model_name="project", + name="external_project_information", + field=models.JSONField( + default=dict, + help_text="More details of the project integrated at payment service.", + ), ), migrations.AddField( - model_name='project', - name='external_projectid', - field=models.CharField(blank=True, help_text='ID of this project at integrated payment service.', max_length=30), + model_name="project", + name="external_projectid", + field=models.CharField( + blank=True, + help_text="ID of this project at integrated payment service.", + max_length=30, + ), ), ] diff --git a/hypha/apply/projects/migrations/0050_add_new_invoice_status.py b/hypha/apply/projects/migrations/0050_add_new_invoice_status.py index ebb9bfbf69..2cd1e9d6dc 100644 --- a/hypha/apply/projects/migrations/0050_add_new_invoice_status.py +++ b/hypha/apply/projects/migrations/0050_add_new_invoice_status.py @@ -5,15 +5,30 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0049_add_fields_for_finance_integrations'), + ("application_projects", "0049_add_fields_for_finance_integrations"), ] operations = [ migrations.AlterField( - model_name='invoice', - name='status', - field=django_fsm.FSMField(choices=[('submitted', 'Submitted'), ('resubmitted', 'Resubmitted'), ('changes_requested_staff', 'Changes Requested by Staff'), ('changes_requested_finance_1', 'Changes Requested by Finance 1'), ('changes_requested_finance_2', 'Changes Requested by Finance 2'), ('approved_by_staff', 'Approved by Staff'), ('approved_by_finance_1', 'Approved by Finance 1'), ('approved_by_finance_2', 'Approved by Finance 2'), ('paid', 'Paid'), ('converted', 'Converted'), ('declined', 'Declined')], default='submitted', max_length=50), + model_name="invoice", + name="status", + field=django_fsm.FSMField( + choices=[ + ("submitted", "Submitted"), + ("resubmitted", "Resubmitted"), + ("changes_requested_staff", "Changes Requested by Staff"), + ("changes_requested_finance_1", "Changes Requested by Finance 1"), + ("changes_requested_finance_2", "Changes Requested by Finance 2"), + ("approved_by_staff", "Approved by Staff"), + ("approved_by_finance_1", "Approved by Finance 1"), + ("approved_by_finance_2", "Approved by Finance 2"), + ("paid", "Paid"), + ("converted", "Converted"), + ("declined", "Declined"), + ], + default="submitted", + max_length=50, + ), ), ] diff --git a/hypha/apply/projects/migrations/0051_remove_unnecessary_fields_from_invoice.py b/hypha/apply/projects/migrations/0051_remove_unnecessary_fields_from_invoice.py index 11ad637d54..036bffa793 100644 --- a/hypha/apply/projects/migrations/0051_remove_unnecessary_fields_from_invoice.py +++ b/hypha/apply/projects/migrations/0051_remove_unnecessary_fields_from_invoice.py @@ -4,22 +4,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0050_add_new_invoice_status'), + ("application_projects", "0050_add_new_invoice_status"), ] operations = [ migrations.RemoveField( - model_name='invoice', - name='amount', + model_name="invoice", + name="amount", ), migrations.RemoveField( - model_name='invoice', - name='date_from', + model_name="invoice", + name="date_from", ), migrations.RemoveField( - model_name='invoice', - name='date_to', + model_name="invoice", + name="date_to", ), ] diff --git a/hypha/apply/projects/migrations/0052_alter_project_form_fields.py b/hypha/apply/projects/migrations/0052_alter_project_form_fields.py index c02dc98ac4..1aafe40347 100644 --- a/hypha/apply/projects/migrations/0052_alter_project_form_fields.py +++ b/hypha/apply/projects/migrations/0052_alter_project_form_fields.py @@ -7,15 +7,604 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0051_remove_unnecessary_fields_from_invoice'), + ("application_projects", "0051_remove_unnecessary_fields_from_invoice"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + ), ), ] diff --git a/hypha/apply/projects/migrations/0053_projectapprovalform.py b/hypha/apply/projects/migrations/0053_projectapprovalform.py index 6c68508837..56e9752d91 100644 --- a/hypha/apply/projects/migrations/0053_projectapprovalform.py +++ b/hypha/apply/projects/migrations/0053_projectapprovalform.py @@ -8,18 +8,631 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0052_alter_project_form_fields'), + ("application_projects", "0052_alter_project_form_fields"), ] operations = [ migrations.CreateModel( - name='ProjectApprovalForm', + name="ProjectApprovalForm", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('form_fields', wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))])), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), + ( + "form_fields", + wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Checkbox" + ) + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock( + required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, + label="Required", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Choice" + ), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ] + ), + ), ], bases=(hypha.apply.stream_forms.models.BaseStreamForm, models.Model), ), diff --git a/hypha/apply/projects/migrations/0054_alter_project_form_fields.py b/hypha/apply/projects/migrations/0054_alter_project_form_fields.py index 1f509b95a9..b5e350c8a4 100644 --- a/hypha/apply/projects/migrations/0054_alter_project_form_fields.py +++ b/hypha/apply/projects/migrations/0054_alter_project_form_fields.py @@ -7,15 +7,605 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0053_projectapprovalform'), + ("application_projects", "0053_projectapprovalform"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True, use_json_field=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + use_json_field=True, + ), ), ] diff --git a/hypha/apply/projects/migrations/0055_alter_project_status_add_pafreviewersrole.py b/hypha/apply/projects/migrations/0055_alter_project_status_add_pafreviewersrole.py index 83d1dc25ac..59fe1460d6 100644 --- a/hypha/apply/projects/migrations/0055_alter_project_status_add_pafreviewersrole.py +++ b/hypha/apply/projects/migrations/0055_alter_project_status_add_pafreviewersrole.py @@ -6,33 +6,62 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0054_alter_project_form_fields'), + ("application_projects", "0054_alter_project_form_fields"), ] operations = [ migrations.AddField( - model_name='project', - name='paf_reviews_meta_data', - field=models.JSONField(default=dict, help_text='Reviewers role and their actions/comments'), + model_name="project", + name="paf_reviews_meta_data", + field=models.JSONField( + default=dict, help_text="Reviewers role and their actions/comments" + ), ), migrations.AlterField( - model_name='project', - name='status', - field=models.TextField(choices=[('committed', 'Committed'), ('waiting_for_approval', 'Waiting for Approval'), ('contracting', 'Contracting'), ('in_progress', 'In Progress'), ('closing', 'Closing'), ('complete', 'Complete')], default='committed'), + model_name="project", + name="status", + field=models.TextField( + choices=[ + ("committed", "Committed"), + ("waiting_for_approval", "Waiting for Approval"), + ("contracting", "Contracting"), + ("in_progress", "In Progress"), + ("closing", "Closing"), + ("complete", "Complete"), + ], + default="committed", + ), ), migrations.CreateModel( - name='PAFReviewersRole', + name="PAFReviewersRole", 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)), - ('role', models.CharField(max_length=200)), - ('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='paf_reviewers_roles', to='application_projects.projectsettings')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "sort_order", + models.IntegerField(blank=True, editable=False, null=True), + ), + ("role", models.CharField(max_length=200)), + ( + "page", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="paf_reviewers_roles", + to="application_projects.projectsettings", + ), + ), ], options={ - 'ordering': ['sort_order'], - 'abstract': False, + "ordering": ["sort_order"], + "abstract": False, }, ), ] diff --git a/hypha/apply/projects/migrations/0056_packetfile_created_at.py b/hypha/apply/projects/migrations/0056_packetfile_created_at.py index 6ade1ca1f2..1814193be7 100644 --- a/hypha/apply/projects/migrations/0056_packetfile_created_at.py +++ b/hypha/apply/projects/migrations/0056_packetfile_created_at.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0055_alter_project_status_add_pafreviewersrole'), + ("application_projects", "0055_alter_project_status_add_pafreviewersrole"), ] operations = [ migrations.AddField( - model_name='packetfile', - name='created_at', + model_name="packetfile", + name="created_at", field=models.DateField(auto_now_add=True, null=True), ), ] diff --git a/hypha/apply/projects/migrations/0057_alter_report_config.py b/hypha/apply/projects/migrations/0057_alter_report_config.py index fc64c2d4ba..7775824692 100644 --- a/hypha/apply/projects/migrations/0057_alter_report_config.py +++ b/hypha/apply/projects/migrations/0057_alter_report_config.py @@ -4,25 +4,28 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0056_packetfile_created_at'), + ("application_projects", "0056_packetfile_created_at"), ] operations = [ migrations.AddField( - model_name='reportconfig', - name='disable_reporting', + model_name="reportconfig", + name="disable_reporting", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='reportconfig', - name='does_not_repeat', + model_name="reportconfig", + name="does_not_repeat", field=models.BooleanField(default=False), ), migrations.AlterField( - model_name='reportconfig', - name='frequency', - field=models.CharField(choices=[('week', 'Weeks'), ('month', 'Months'), ('year', 'Years')], default='month', max_length=6), + model_name="reportconfig", + name="frequency", + field=models.CharField( + choices=[("week", "Weeks"), ("month", "Months"), ("year", "Years")], + default="month", + max_length=6, + ), ), ] diff --git a/hypha/apply/projects/migrations/0058_project_ready_for_final_approval.py b/hypha/apply/projects/migrations/0058_project_ready_for_final_approval.py index 6d582b36aa..b09a1614ea 100644 --- a/hypha/apply/projects/migrations/0058_project_ready_for_final_approval.py +++ b/hypha/apply/projects/migrations/0058_project_ready_for_final_approval.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0057_alter_report_config'), + ("application_projects", "0057_alter_report_config"), ] operations = [ migrations.AddField( - model_name='project', - name='ready_for_final_approval', + model_name="project", + name="ready_for_final_approval", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/hypha/apply/projects/migrations/0059_set_ready_for_final_approval.py b/hypha/apply/projects/migrations/0059_set_ready_for_final_approval.py index 998833eb84..b0c6c3d15b 100644 --- a/hypha/apply/projects/migrations/0059_set_ready_for_final_approval.py +++ b/hypha/apply/projects/migrations/0059_set_ready_for_final_approval.py @@ -8,28 +8,29 @@ def is_paf_approved_by_all_reviewers(project, paf_reviewers_count): return True elif paf_reviewers_count == len(project.paf_reviews_meta_data): for paf_review_data in project.paf_reviews_meta_data.values(): - if paf_review_data['status'] == 'request_change': + if paf_review_data["status"] == "request_change": return False return True return False def set_value_to_ready_for_final_approval(apps, schema_editor): - Project = apps.get_model('application_projects', 'Project') - PAFReviewersRole = apps.get_model('application_projects', 'PAFReviewersRole') - - for project in Project.objects.filter(status='waiting_for_approval', ready_for_final_approval=False): - if is_paf_approved_by_all_reviewers(project, PAFReviewersRole.objects.all().count()): + Project = apps.get_model("application_projects", "Project") + PAFReviewersRole = apps.get_model("application_projects", "PAFReviewersRole") + + for project in Project.objects.filter( + status="waiting_for_approval", ready_for_final_approval=False + ): + if is_paf_approved_by_all_reviewers( + project, PAFReviewersRole.objects.all().count() + ): project.ready_for_final_approval = True - project.save(update_fields={'ready_for_final_approval'}) + project.save(update_fields={"ready_for_final_approval"}) class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0058_project_ready_for_final_approval'), + ("application_projects", "0058_project_ready_for_final_approval"), ] - operations = [ - migrations.RunPython(set_value_to_ready_for_final_approval) - ] + operations = [migrations.RunPython(set_value_to_ready_for_final_approval)] diff --git a/hypha/apply/projects/migrations/0060_auto_20230116_0712.py b/hypha/apply/projects/migrations/0060_auto_20230116_0712.py index 9fd43c7744..90565f6f0c 100644 --- a/hypha/apply/projects/migrations/0060_auto_20230116_0712.py +++ b/hypha/apply/projects/migrations/0060_auto_20230116_0712.py @@ -4,29 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0059_set_ready_for_final_approval'), + ("application_projects", "0059_set_ready_for_final_approval"), ] operations = [ migrations.RemoveField( - model_name='projectsettings', - name='compliance_email', + model_name="projectsettings", + name="compliance_email", ), migrations.AddField( - model_name='projectsettings', - name='contracting_gp_email', - field=models.TextField(blank=True, null=True, verbose_name='Contracting Group Email'), + model_name="projectsettings", + name="contracting_gp_email", + field=models.TextField( + blank=True, null=True, verbose_name="Contracting Group Email" + ), ), migrations.AddField( - model_name='projectsettings', - name='finance_gp_email', - field=models.TextField(blank=True, null=True, verbose_name='Finance Group Email'), + model_name="projectsettings", + name="finance_gp_email", + field=models.TextField( + blank=True, null=True, verbose_name="Finance Group Email" + ), ), migrations.AddField( - model_name='projectsettings', - name='staff_gp_email', - field=models.TextField(blank=True, null=True, verbose_name='Staff Group Email'), + model_name="projectsettings", + name="staff_gp_email", + field=models.TextField( + blank=True, null=True, verbose_name="Staff Group Email" + ), ), ] diff --git a/hypha/apply/projects/migrations/0061_remove_checks.py b/hypha/apply/projects/migrations/0061_remove_checks.py index aa8f99526b..f73b2b29a7 100644 --- a/hypha/apply/projects/migrations/0061_remove_checks.py +++ b/hypha/apply/projects/migrations/0061_remove_checks.py @@ -4,18 +4,17 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0060_auto_20230116_0712'), + ("application_projects", "0060_auto_20230116_0712"), ] operations = [ migrations.RemoveField( - model_name='invoice', - name='valid_checks', + model_name="invoice", + name="valid_checks", ), migrations.RemoveField( - model_name='invoice', - name='valid_checks_link', + model_name="invoice", + name="valid_checks_link", ), ] diff --git a/hypha/apply/projects/migrations/0062_auto_20230228_1218.py b/hypha/apply/projects/migrations/0062_auto_20230228_1218.py index 88656c52b8..b27261a63b 100644 --- a/hypha/apply/projects/migrations/0062_auto_20230228_1218.py +++ b/hypha/apply/projects/migrations/0062_auto_20230228_1218.py @@ -7,53 +7,77 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('auth', '0012_alter_user_first_name_max_length'), - ('application_projects', '0061_remove_checks'), + ("auth", "0012_alter_user_first_name_max_length"), + ("application_projects", "0061_remove_checks"), ] operations = [ migrations.CreateModel( - name='PAFApprovals', + name="PAFApprovals", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('approved', models.BooleanField(default=False)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('updated_at', models.DateTimeField()), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("approved", models.BooleanField(default=False)), + ("created_at", models.DateTimeField(auto_now_add=True)), + ("updated_at", models.DateTimeField()), ], ), migrations.RenameField( - model_name='pafreviewersrole', - old_name='role', - new_name='label', + model_name="pafreviewersrole", + old_name="role", + new_name="label", ), migrations.AddField( - model_name='pafreviewersrole', - name='user_roles', - field=modelcluster.fields.ParentalManyToManyField(help_text="Only selected group's users will be listed for this PAFReviewerRole", related_name='paf_reviewers_roles', to='auth.Group', verbose_name='user groups'), + model_name="pafreviewersrole", + name="user_roles", + field=modelcluster.fields.ParentalManyToManyField( + help_text="Only selected group's users will be listed for this PAFReviewerRole", + related_name="paf_reviewers_roles", + to="auth.Group", + verbose_name="user groups", + ), ), migrations.DeleteModel( - name='Approval', + name="Approval", ), migrations.AddField( - model_name='pafapprovals', - name='paf_reviewer_role', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='paf_approvals', to='application_projects.pafreviewersrole'), + model_name="pafapprovals", + name="paf_reviewer_role", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="paf_approvals", + to="application_projects.pafreviewersrole", + ), ), migrations.AddField( - model_name='pafapprovals', - name='project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='paf_approvals', to='application_projects.project'), + model_name="pafapprovals", + name="project", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="paf_approvals", + to="application_projects.project", + ), ), migrations.AddField( - model_name='pafapprovals', - name='user', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='paf_approvals', to=settings.AUTH_USER_MODEL), + model_name="pafapprovals", + name="user", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="paf_approvals", + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterUniqueTogether( - name='pafapprovals', - unique_together={('project', 'paf_reviewer_role')}, + name="pafapprovals", + unique_together={("project", "paf_reviewer_role")}, ), ] diff --git a/hypha/apply/projects/migrations/0063_projectsettings_paf_approval_sequential.py b/hypha/apply/projects/migrations/0063_projectsettings_paf_approval_sequential.py index e515c33bb3..b82a6c8be2 100644 --- a/hypha/apply/projects/migrations/0063_projectsettings_paf_approval_sequential.py +++ b/hypha/apply/projects/migrations/0063_projectsettings_paf_approval_sequential.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0062_auto_20230228_1218'), + ("application_projects", "0062_auto_20230228_1218"), ] operations = [ migrations.AddField( - model_name='projectsettings', - name='paf_approval_sequential', - field=models.BooleanField(default=True, help_text='Uncheck it to approve PAF parallely'), + model_name="projectsettings", + name="paf_approval_sequential", + field=models.BooleanField( + default=True, help_text="Uncheck it to approve PAF parallely" + ), ), ] diff --git a/hypha/apply/projects/migrations/0064_alter_pafapprovals_options.py b/hypha/apply/projects/migrations/0064_alter_pafapprovals_options.py index 2a510daa18..76de84eb2e 100644 --- a/hypha/apply/projects/migrations/0064_alter_pafapprovals_options.py +++ b/hypha/apply/projects/migrations/0064_alter_pafapprovals_options.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0063_projectsettings_paf_approval_sequential'), + ("application_projects", "0063_projectsettings_paf_approval_sequential"), ] operations = [ migrations.AlterModelOptions( - name='pafapprovals', - options={'ordering': ['paf_reviewer_role__sort_order']}, + name="pafapprovals", + options={"ordering": ["paf_reviewer_role__sort_order"]}, ), ] diff --git a/hypha/apply/projects/migrations/0065_remove_project_ready_for_final_approval.py b/hypha/apply/projects/migrations/0065_remove_project_ready_for_final_approval.py index 57218a0821..3a255edccf 100644 --- a/hypha/apply/projects/migrations/0065_remove_project_ready_for_final_approval.py +++ b/hypha/apply/projects/migrations/0065_remove_project_ready_for_final_approval.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0064_alter_pafapprovals_options'), + ("application_projects", "0064_alter_pafapprovals_options"), ] operations = [ migrations.RemoveField( - model_name='project', - name='ready_for_final_approval', + model_name="project", + name="ready_for_final_approval", ), ] diff --git a/hypha/apply/projects/migrations/0066_projectsowform.py b/hypha/apply/projects/migrations/0066_projectsowform.py index 531791015e..affc81bdd5 100644 --- a/hypha/apply/projects/migrations/0066_projectsowform.py +++ b/hypha/apply/projects/migrations/0066_projectsowform.py @@ -8,21 +8,635 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0065_remove_project_ready_for_final_approval'), + ("application_projects", "0065_remove_project_ready_for_final_approval"), ] operations = [ migrations.CreateModel( - name='ProjectSOWForm', + name="ProjectSOWForm", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('form_fields', wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], use_json_field=None)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=255)), + ( + "form_fields", + wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Checkbox" + ) + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock( + required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, + label="Required", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Choice" + ), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + use_json_field=None, + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, bases=(hypha.apply.stream_forms.models.BaseStreamForm, models.Model), ), diff --git a/hypha/apply/projects/migrations/0067_projectsow.py b/hypha/apply/projects/migrations/0067_projectsow.py index 200d73d5b2..e8e1a6f9df 100644 --- a/hypha/apply/projects/migrations/0067_projectsow.py +++ b/hypha/apply/projects/migrations/0067_projectsow.py @@ -11,20 +11,652 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0066_projectsowform'), + ("application_projects", "0066_projectsowform"), ] operations = [ migrations.CreateModel( - name='ProjectSOW', + name="ProjectSOW", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('form_data', models.JSONField(default=dict, encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder)), - ('form_fields', wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Section text')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True, use_json_field=True)), - ('project', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='sow', to='application_projects.project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "form_data", + models.JSONField( + default=dict, + encoder=hypha.apply.stream_forms.files.StreamFieldDataEncoder, + ), + ), + ( + "form_fields", + wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock( + group="Custom", label="Section text" + ), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[ + ("email", "Email"), + ("url", "URL"), + ], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Checkbox" + ) + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock( + required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, + label="Required", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock( + label="Choice" + ), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + use_json_field=True, + ), + ), + ( + "project", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name="sow", + to="application_projects.project", + ), + ), ], - bases=(hypha.apply.stream_forms.models.BaseStreamForm, hypha.apply.funds.models.mixins.AccessFormData, models.Model), + bases=( + hypha.apply.stream_forms.models.BaseStreamForm, + hypha.apply.funds.models.mixins.AccessFormData, + models.Model, + ), ), ] diff --git a/hypha/apply/projects/migrations/0068_rename_section_text_field.py b/hypha/apply/projects/migrations/0068_rename_section_text_field.py index 973f22f8af..d1b64dcc34 100644 --- a/hypha/apply/projects/migrations/0068_rename_section_text_field.py +++ b/hypha/apply/projects/migrations/0068_rename_section_text_field.py @@ -7,30 +7,2383 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0067_projectsow'), + ("application_projects", "0067_projectsow"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True, use_json_field=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + use_json_field=True, + ), ), migrations.AlterField( - model_name='projectapprovalform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], use_json_field=None), + model_name="projectapprovalform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + use_json_field=None, + ), ), migrations.AlterField( - model_name='projectsow', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], null=True, use_json_field=True), + model_name="projectsow", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + null=True, + use_json_field=True, + ), ), migrations.AlterField( - model_name='projectsowform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom'))], use_json_field=None), + model_name="projectsowform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ], + use_json_field=None, + ), ), ] diff --git a/hypha/apply/projects/migrations/0069_contractpacketfile_contractdocumentcategory.py b/hypha/apply/projects/migrations/0069_contractpacketfile_contractdocumentcategory.py index 7b9bf4af17..214f76188f 100644 --- a/hypha/apply/projects/migrations/0069_contractpacketfile_contractdocumentcategory.py +++ b/hypha/apply/projects/migrations/0069_contractpacketfile_contractdocumentcategory.py @@ -7,51 +7,92 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0068_rename_section_text_field'), + ("application_projects", "0068_rename_section_text_field"), ] operations = [ migrations.CreateModel( - name='ContractDocumentCategory', + name="ContractDocumentCategory", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=254)), - ('recommended_minimum', models.PositiveIntegerField()), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=254)), + ("recommended_minimum", models.PositiveIntegerField()), ], options={ - 'verbose_name_plural': 'Contract Document Categories', - 'ordering': ('name',), + "verbose_name_plural": "Contract Document Categories", + "ordering": ("name",), }, ), migrations.AlterModelOptions( - name='documentcategory', - options={'ordering': ('name',), 'verbose_name_plural': 'Project Document Categories'}, + name="documentcategory", + options={ + "ordering": ("name",), + "verbose_name_plural": "Project Document Categories", + }, ), migrations.RemoveField( - model_name='contract', - name='is_signed', + model_name="contract", + name="is_signed", ), migrations.AddField( - model_name='contract', - name='signed_by_applicant', - field=models.BooleanField(default=False, verbose_name='Counter Signed?'), + model_name="contract", + name="signed_by_applicant", + field=models.BooleanField(default=False, verbose_name="Counter Signed?"), ), migrations.AddField( - model_name='project', - name='submitted_contract_documents', - field=models.BooleanField(default=False, verbose_name='Submit Contracting Documents'), + model_name="project", + name="submitted_contract_documents", + field=models.BooleanField( + default=False, verbose_name="Submit Contracting Documents" + ), ), migrations.CreateModel( - name='ContractPacketFile', + name="ContractPacketFile", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.TextField()), - ('document', models.FileField(storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.project.contract_document_path)), - ('created_at', models.DateField(auto_now_add=True, null=True)), - ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contract_packet_files', to='application_projects.contractdocumentcategory')), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contract_packet_files', to='application_projects.project')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.TextField()), + ( + "document", + models.FileField( + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.project.contract_document_path, + ), + ), + ("created_at", models.DateField(auto_now_add=True, null=True)), + ( + "category", + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="contract_packet_files", + to="application_projects.contractdocumentcategory", + ), + ), + ( + "project", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="contract_packet_files", + to="application_projects.project", + ), + ), ], ), ] diff --git a/hypha/apply/projects/migrations/0070_auto_20230327_1109.py b/hypha/apply/projects/migrations/0070_auto_20230327_1109.py index ec02b2130d..3a804a273b 100644 --- a/hypha/apply/projects/migrations/0070_auto_20230327_1109.py +++ b/hypha/apply/projects/migrations/0070_auto_20230327_1109.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0069_contractpacketfile_contractdocumentcategory'), + ("application_projects", "0069_contractpacketfile_contractdocumentcategory"), ] operations = [ migrations.AddField( - model_name='contract', - name='updated_at', + model_name="contract", + name="updated_at", field=models.DateTimeField(null=True), ), migrations.AddField( - model_name='contract', - name='uploaded_by_applicant_at', + model_name="contract", + name="uploaded_by_applicant_at", field=models.DateTimeField(null=True), ), migrations.AddField( - model_name='contract', - name='uploaded_by_contractor_at', + model_name="contract", + name="uploaded_by_contractor_at", field=models.DateTimeField(null=True), ), ] diff --git a/hypha/apply/projects/migrations/0071_add_customformfields_to_paf_and_sow.py b/hypha/apply/projects/migrations/0071_add_customformfields_to_paf_and_sow.py index e6a6d38981..00b915029b 100644 --- a/hypha/apply/projects/migrations/0071_add_customformfields_to_paf_and_sow.py +++ b/hypha/apply/projects/migrations/0071_add_customformfields_to_paf_and_sow.py @@ -7,30 +7,2719 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0070_auto_20230327_1109'), + ("application_projects", "0070_auto_20230327_1109"), ] operations = [ migrations.AlterField( - model_name='project', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields'))], null=True, use_json_field=True), + model_name="project", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ], + null=True, + use_json_field=True, + ), ), migrations.AlterField( - model_name='projectapprovalform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields'))], use_json_field=True), + model_name="projectapprovalform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ], + use_json_field=True, + ), ), migrations.AlterField( - model_name='projectsow', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields'))], null=True, use_json_field=True), + model_name="projectsow", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ], + null=True, + use_json_field=True, + ), ), migrations.AlterField( - model_name='projectsowform', - name='form_fields', - field=wagtail.fields.StreamField([('text_markup', wagtail.blocks.RichTextBlock(group='Custom', label='Paragraph')), ('header_markup', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(choices=[('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')]))], group='Custom', label='Section header')), ('char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('multi_inputs_char', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('format', wagtail.blocks.ChoiceBlock(choices=[('email', 'Email'), ('url', 'URL')], label='Format', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False)), ('number_of_inputs', wagtail.blocks.IntegerBlock(default=2, label='Max number of inputs')), ('add_button_text', wagtail.blocks.CharBlock(default='Add new item', required=False))], group='Fields')), ('text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('number', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.CharBlock(label='Default value', required=False))], group='Fields')), ('checkbox', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.BooleanBlock(required=False))], group='Fields')), ('radios', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('dropdown', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice')))], group='Fields')), ('checkboxes', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('checkboxes', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Checkbox')))], group='Fields')), ('date', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateBlock(required=False))], group='Fields')), ('time', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TimeBlock(required=False))], group='Fields')), ('datetime', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.DateTimeBlock(required=False))], group='Fields')), ('image', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('multi_file', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False))], group='Fields')), ('group_toggle', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(default=True, label='Required', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Choice'), help_text='Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.'))], group='Custom')), ('group_toggle_end', hypha.apply.stream_forms.blocks.GroupToggleEndBlock(group='Custom')), ('rich_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields')), ('markdown_text', wagtail.blocks.StructBlock([('field_label', wagtail.blocks.CharBlock(label='Label')), ('help_text', wagtail.blocks.TextBlock(label='Help text', required=False)), ('help_link', wagtail.blocks.URLBlock(label='Help link', required=False)), ('required', wagtail.blocks.BooleanBlock(label='Required', required=False)), ('default_value', wagtail.blocks.TextBlock(label='Default value', required=False)), ('word_limit', wagtail.blocks.IntegerBlock(default=1000, label='Word limit'))], group='Fields'))], use_json_field=True), + model_name="projectsowform", + name="form_fields", + field=wagtail.fields.StreamField( + [ + ( + "text_markup", + wagtail.blocks.RichTextBlock(group="Custom", label="Paragraph"), + ), + ( + "header_markup", + wagtail.blocks.StructBlock( + [ + ( + "heading_text", + wagtail.blocks.CharBlock( + form_classname="title", required=True + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ] + ), + ), + ], + group="Custom", + label="Section header", + ), + ), + ( + "char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_inputs_char", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "format", + wagtail.blocks.ChoiceBlock( + choices=[("email", "Email"), ("url", "URL")], + label="Format", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ( + "number_of_inputs", + wagtail.blocks.IntegerBlock( + default=2, label="Max number of inputs" + ), + ), + ( + "add_button_text", + wagtail.blocks.CharBlock( + default="Add new item", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + label="Default value", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.BooleanBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "radios", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice") + ), + ), + ], + group="Fields", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "checkboxes", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Checkbox") + ), + ), + ], + group="Fields", + ), + ), + ( + "date", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "time", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "datetime", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.DateTimeBlock(required=False), + ), + ], + group="Fields", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "multi_file", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ], + group="Fields", + ), + ), + ( + "group_toggle", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=True, label="Required", required=False + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.CharBlock(label="Choice"), + help_text="Please create only two choices for toggle. First choice will revel the group and the second hide it. Additional choices will be ignored.", + ), + ), + ], + group="Custom", + ), + ), + ( + "group_toggle_end", + hypha.apply.stream_forms.blocks.GroupToggleEndBlock( + group="Custom" + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ( + "markdown_text", + wagtail.blocks.StructBlock( + [ + ( + "field_label", + wagtail.blocks.CharBlock(label="Label"), + ), + ( + "help_text", + wagtail.blocks.TextBlock( + label="Help text", required=False + ), + ), + ( + "help_link", + wagtail.blocks.URLBlock( + label="Help link", required=False + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + label="Required", required=False + ), + ), + ( + "default_value", + wagtail.blocks.TextBlock( + label="Default value", required=False + ), + ), + ( + "word_limit", + wagtail.blocks.IntegerBlock( + default=1000, label="Word limit" + ), + ), + ], + group="Fields", + ), + ), + ], + use_json_field=True, + ), ), ] diff --git a/hypha/apply/projects/migrations/0072_pafapprovals_approved_at.py b/hypha/apply/projects/migrations/0072_pafapprovals_approved_at.py index 7de4db3892..f3a5128c30 100644 --- a/hypha/apply/projects/migrations/0072_pafapprovals_approved_at.py +++ b/hypha/apply/projects/migrations/0072_pafapprovals_approved_at.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0071_add_customformfields_to_paf_and_sow'), + ("application_projects", "0071_add_customformfields_to_paf_and_sow"), ] operations = [ migrations.AddField( - model_name='pafapprovals', - name='approved_at', + model_name="pafapprovals", + name="approved_at", field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/hypha/apply/projects/migrations/0073_alter_project_status.py b/hypha/apply/projects/migrations/0073_alter_project_status.py index 8f88000aa1..9025aa979b 100644 --- a/hypha/apply/projects/migrations/0073_alter_project_status.py +++ b/hypha/apply/projects/migrations/0073_alter_project_status.py @@ -4,15 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0072_pafapprovals_approved_at'), + ("application_projects", "0072_pafapprovals_approved_at"), ] operations = [ migrations.AlterField( - model_name='project', - name='status', - field=models.TextField(choices=[('draft', 'Draft'), ('waiting_for_approval', 'Waiting for Approval'), ('contracting', 'Contracting'), ('in_progress', 'In Progress'), ('closing', 'Closing'), ('complete', 'Complete')], default='draft'), + model_name="project", + name="status", + field=models.TextField( + choices=[ + ("draft", "Draft"), + ("waiting_for_approval", "Waiting for Approval"), + ("contracting", "Contracting"), + ("in_progress", "In Progress"), + ("closing", "Closing"), + ("complete", "Complete"), + ], + default="draft", + ), ), ] diff --git a/hypha/apply/projects/migrations/0074_update_projects_status_committed_to_draft.py b/hypha/apply/projects/migrations/0074_update_projects_status_committed_to_draft.py index 66dbbd60f7..47488495b9 100644 --- a/hypha/apply/projects/migrations/0074_update_projects_status_committed_to_draft.py +++ b/hypha/apply/projects/migrations/0074_update_projects_status_committed_to_draft.py @@ -4,19 +4,16 @@ def update_committed_project_status_to_draft(apps, schema_editor): - Project = apps.get_model('application_projects', 'Project') + Project = apps.get_model("application_projects", "Project") - for project in Project.objects.filter(status='committed'): - project.status = 'draft' - project.save(update_fields={'status'}) + for project in Project.objects.filter(status="committed"): + project.status = "draft" + project.save(update_fields={"status"}) class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0073_alter_project_status'), + ("application_projects", "0073_alter_project_status"), ] - operations = [ - migrations.RunPython(update_committed_project_status_to_draft) - ] + operations = [migrations.RunPython(update_committed_project_status_to_draft)] diff --git a/hypha/apply/projects/migrations/0075_alter_pafapprovals_user.py b/hypha/apply/projects/migrations/0075_alter_pafapprovals_user.py index 32369c66bb..86e02b3470 100644 --- a/hypha/apply/projects/migrations/0075_alter_pafapprovals_user.py +++ b/hypha/apply/projects/migrations/0075_alter_pafapprovals_user.py @@ -6,16 +6,21 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('application_projects', '0074_update_projects_status_committed_to_draft'), + ("application_projects", "0074_update_projects_status_committed_to_draft"), ] operations = [ migrations.AlterField( - model_name='pafapprovals', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='paf_approvals', to=settings.AUTH_USER_MODEL), + model_name="pafapprovals", + name="user", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="paf_approvals", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/hypha/apply/projects/migrations/0076_alter_projectdocument_and_contractdocument_category.py b/hypha/apply/projects/migrations/0076_alter_projectdocument_and_contractdocument_category.py index c00f82f070..fc785ee664 100644 --- a/hypha/apply/projects/migrations/0076_alter_projectdocument_and_contractdocument_category.py +++ b/hypha/apply/projects/migrations/0076_alter_projectdocument_and_contractdocument_category.py @@ -6,52 +6,67 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0075_alter_pafapprovals_user'), + ("application_projects", "0075_alter_pafapprovals_user"), ] operations = [ migrations.AlterModelOptions( - name='contractdocumentcategory', - options={'ordering': ('-required', 'name'), 'verbose_name_plural': 'Contract Document Categories'}, + name="contractdocumentcategory", + options={ + "ordering": ("-required", "name"), + "verbose_name_plural": "Contract Document Categories", + }, ), migrations.AlterModelOptions( - name='documentcategory', - options={'ordering': ('-required', 'name'), 'verbose_name_plural': 'Project Document Categories'}, + name="documentcategory", + options={ + "ordering": ("-required", "name"), + "verbose_name_plural": "Project Document Categories", + }, ), migrations.AlterModelOptions( - name='packetfile', - options={'ordering': ('-created_at',)}, + name="packetfile", + options={"ordering": ("-created_at",)}, ), migrations.AddField( - model_name='contractdocumentcategory', - name='required', + model_name="contractdocumentcategory", + name="required", field=models.BooleanField(default=True), ), migrations.AddField( - model_name='contractdocumentcategory', - name='template', - field=models.FileField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.project.contract_document_template_path), + model_name="contractdocumentcategory", + name="template", + field=models.FileField( + blank=True, + null=True, + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.project.contract_document_template_path, + ), ), migrations.AddField( - model_name='documentcategory', - name='required', + model_name="documentcategory", + name="required", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='documentcategory', - name='template', - field=models.FileField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(), upload_to=hypha.apply.projects.models.project.document_template_path), + model_name="documentcategory", + name="template", + field=models.FileField( + blank=True, + null=True, + storage=django.core.files.storage.FileSystemStorage(), + upload_to=hypha.apply.projects.models.project.document_template_path, + ), ), migrations.AlterField( - model_name='contractdocumentcategory', - name='recommended_minimum', + model_name="contractdocumentcategory", + name="recommended_minimum", field=models.PositiveIntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='documentcategory', - name='recommended_minimum', + model_name="documentcategory", + name="recommended_minimum", field=models.PositiveIntegerField(blank=True, null=True), ), ] diff --git a/hypha/apply/projects/migrations/0077_alter_invoice_status.py b/hypha/apply/projects/migrations/0077_alter_invoice_status.py index 43a0025027..65669731f2 100644 --- a/hypha/apply/projects/migrations/0077_alter_invoice_status.py +++ b/hypha/apply/projects/migrations/0077_alter_invoice_status.py @@ -5,15 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0076_alter_projectdocument_and_contractdocument_category'), + ( + "application_projects", + "0076_alter_projectdocument_and_contractdocument_category", + ), ] operations = [ migrations.AlterField( - model_name='invoice', - name='status', - field=django_fsm.FSMField(choices=[('submitted', 'Submitted'), ('resubmitted', 'Resubmitted'), ('changes_requested_staff', 'Changes Requested by Staff'), ('changes_requested_finance_1', 'Changes Requested by Finance 1'), ('changes_requested_finance_2', 'Changes Requested by Finance 2'), ('approved_by_staff', 'Approved by Staff'), ('approved_by_finance_1', 'Approved by Finance 1'), ('approved_by_finance_2', 'Approved by Finance 2'), ('paid', 'Paid'), ('declined', 'Declined')], default='submitted', max_length=50), + model_name="invoice", + name="status", + field=django_fsm.FSMField( + choices=[ + ("submitted", "Submitted"), + ("resubmitted", "Resubmitted"), + ("changes_requested_staff", "Changes Requested by Staff"), + ("changes_requested_finance_1", "Changes Requested by Finance 1"), + ("changes_requested_finance_2", "Changes Requested by Finance 2"), + ("approved_by_staff", "Approved by Staff"), + ("approved_by_finance_1", "Approved by Finance 1"), + ("approved_by_finance_2", "Approved by Finance 2"), + ("paid", "Paid"), + ("declined", "Declined"), + ], + default="submitted", + max_length=50, + ), ), ] diff --git a/hypha/apply/projects/migrations/0078_update_project_statuses.py b/hypha/apply/projects/migrations/0078_update_project_statuses.py index dd985a9953..4af72d711e 100644 --- a/hypha/apply/projects/migrations/0078_update_project_statuses.py +++ b/hypha/apply/projects/migrations/0078_update_project_statuses.py @@ -4,28 +4,37 @@ def update_project_statuses(apps, schema_editor): - Project = apps.get_model('application_projects', 'Project') + Project = apps.get_model("application_projects", "Project") - for project in Project.objects.filter(status='waiting_for_approval'): - project.status = 'internal_approval' - project.save(update_fields={'status'}) + for project in Project.objects.filter(status="waiting_for_approval"): + project.status = "internal_approval" + project.save(update_fields={"status"}) for project in Project.objects.filter(status="in_progress"): - project.status = 'invoicing_and_reporting' + project.status = "invoicing_and_reporting" project.save() class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0077_alter_invoice_status'), + ("application_projects", "0077_alter_invoice_status"), ] operations = [ migrations.AlterField( - model_name='project', - name='status', - field=models.TextField(choices=[('draft', 'Draft'), ('internal_approval', 'Internal approval'), ('contracting', 'Contracting'), ('invoicing_and_reporting', 'Invoicing and reporting'), ('closing', 'Closing'), ('complete', 'Complete')], default='draft'), + model_name="project", + name="status", + field=models.TextField( + choices=[ + ("draft", "Draft"), + ("internal_approval", "Internal approval"), + ("contracting", "Contracting"), + ("invoicing_and_reporting", "Invoicing and reporting"), + ("closing", "Closing"), + ("complete", "Complete"), + ], + default="draft", + ), ), migrations.RunPython(update_project_statuses), ] diff --git a/hypha/apply/projects/migrations/0079_alter_invoice_add_fields.py b/hypha/apply/projects/migrations/0079_alter_invoice_add_fields.py index 1f735bf9ee..7f69c510d8 100644 --- a/hypha/apply/projects/migrations/0079_alter_invoice_add_fields.py +++ b/hypha/apply/projects/migrations/0079_alter_invoice_add_fields.py @@ -6,20 +6,27 @@ class Migration(migrations.Migration): - dependencies = [ - ('application_projects', '0078_update_project_statuses'), + ("application_projects", "0078_update_project_statuses"), ] operations = [ migrations.AddField( - model_name='invoice', - name='invoice_amount', - field=models.DecimalField(decimal_places=2, max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))], verbose_name='Invoice amount'), + model_name="invoice", + name="invoice_amount", + field=models.DecimalField( + decimal_places=2, + max_digits=10, + null=True, + validators=[django.core.validators.MinValueValidator(Decimal("0.01"))], + verbose_name="Invoice amount", + ), ), migrations.AddField( - model_name='invoice', - name='invoice_number', - field=models.CharField(max_length=50, null=True, verbose_name='Invoice number'), + model_name="invoice", + name="invoice_number", + field=models.CharField( + max_length=50, null=True, verbose_name="Invoice number" + ), ), ] diff --git a/hypha/apply/projects/models/__init__.py b/hypha/apply/projects/models/__init__.py index 0b802842d7..5e289c2031 100644 --- a/hypha/apply/projects/models/__init__.py +++ b/hypha/apply/projects/models/__init__.py @@ -16,26 +16,26 @@ from .vendor import BankInformation, DueDiligenceDocument, Vendor, VendorFormSettings __all__ = [ - 'Project', - 'ProjectApprovalForm', - 'ProjectSOWForm', - 'ProjectSettings', - 'PAFApprovals', - 'Contract', - 'PacketFile', - 'ContractPacketFile', - 'DocumentCategory', - 'ContractDocumentCategory', - 'Report', - 'ReportVersion', - 'ReportPrivateFiles', - 'ReportConfig', - 'Vendor', - 'VendorFormSettings', - 'BankInformation', - 'DueDiligenceDocument', - 'Invoice', - 'SupportingDocument', - 'Deliverable', - 'InvoiceDeliverable', + "Project", + "ProjectApprovalForm", + "ProjectSOWForm", + "ProjectSettings", + "PAFApprovals", + "Contract", + "PacketFile", + "ContractPacketFile", + "DocumentCategory", + "ContractDocumentCategory", + "Report", + "ReportVersion", + "ReportPrivateFiles", + "ReportConfig", + "Vendor", + "VendorFormSettings", + "BankInformation", + "DueDiligenceDocument", + "Invoice", + "SupportingDocument", + "Deliverable", + "InvoiceDeliverable", ] diff --git a/hypha/apply/projects/models/payment.py b/hypha/apply/projects/models/payment.py index 00f31e3552..952ec3264c 100644 --- a/hypha/apply/projects/models/payment.py +++ b/hypha/apply/projects/models/payment.py @@ -15,42 +15,56 @@ from hypha.apply.utils.storage import PrivateStorage -SUBMITTED = 'submitted' -RESUBMITTED = 'resubmitted' -CHANGES_REQUESTED_BY_STAFF = 'changes_requested_staff' -CHANGES_REQUESTED_BY_FINANCE_1 = 'changes_requested_finance_1' -CHANGES_REQUESTED_BY_FINANCE_2 = 'changes_requested_finance_2' -APPROVED_BY_STAFF = 'approved_by_staff' -APPROVED_BY_FINANCE_1 = 'approved_by_finance_1' -APPROVED_BY_FINANCE_2 = 'approved_by_finance_2' -PAID = 'paid' -DECLINED = 'declined' +SUBMITTED = "submitted" +RESUBMITTED = "resubmitted" +CHANGES_REQUESTED_BY_STAFF = "changes_requested_staff" +CHANGES_REQUESTED_BY_FINANCE_1 = "changes_requested_finance_1" +CHANGES_REQUESTED_BY_FINANCE_2 = "changes_requested_finance_2" +APPROVED_BY_STAFF = "approved_by_staff" +APPROVED_BY_FINANCE_1 = "approved_by_finance_1" +APPROVED_BY_FINANCE_2 = "approved_by_finance_2" +PAID = "paid" +DECLINED = "declined" INVOICE_STATUS_CHOICES = [ - (SUBMITTED, _('Submitted')), - (RESUBMITTED, _('Resubmitted')), - (CHANGES_REQUESTED_BY_STAFF, _('Changes Requested by Staff')), - (CHANGES_REQUESTED_BY_FINANCE_1, _('Changes Requested by Finance 1')), - (CHANGES_REQUESTED_BY_FINANCE_2, _('Changes Requested by Finance 2')), - (APPROVED_BY_STAFF, _('Approved by Staff')), - (APPROVED_BY_FINANCE_1, _('Approved by Finance 1')), - (APPROVED_BY_FINANCE_2, _('Approved by Finance 2')), - (PAID, _('Paid')), - (DECLINED, _('Declined')), + (SUBMITTED, _("Submitted")), + (RESUBMITTED, _("Resubmitted")), + (CHANGES_REQUESTED_BY_STAFF, _("Changes Requested by Staff")), + (CHANGES_REQUESTED_BY_FINANCE_1, _("Changes Requested by Finance 1")), + (CHANGES_REQUESTED_BY_FINANCE_2, _("Changes Requested by Finance 2")), + (APPROVED_BY_STAFF, _("Approved by Staff")), + (APPROVED_BY_FINANCE_1, _("Approved by Finance 1")), + (APPROVED_BY_FINANCE_2, _("Approved by Finance 2")), + (PAID, _("Paid")), + (DECLINED, _("Declined")), ] # All invoice statuses that allows invoice to be transition directly to RESUBMITTED. INVOICE_TRANISTION_TO_RESUBMITTED = [ - SUBMITTED, RESUBMITTED, CHANGES_REQUESTED_BY_STAFF, - CHANGES_REQUESTED_BY_FINANCE_1, CHANGES_REQUESTED_BY_FINANCE_2, + SUBMITTED, + RESUBMITTED, + CHANGES_REQUESTED_BY_STAFF, + CHANGES_REQUESTED_BY_FINANCE_1, + CHANGES_REQUESTED_BY_FINANCE_2, ] INVOICE_STATUS_PM_CHOICES = [CHANGES_REQUESTED_BY_STAFF, APPROVED_BY_STAFF, DECLINED] -INVOICE_STATUS_FINANCE_1_CHOICES = [CHANGES_REQUESTED_BY_FINANCE_1, APPROVED_BY_FINANCE_1, PAID] +INVOICE_STATUS_FINANCE_1_CHOICES = [ + CHANGES_REQUESTED_BY_FINANCE_1, + APPROVED_BY_FINANCE_1, + PAID, +] INVOICE_STATUS_FINANCE_2_CHOICES = [] if settings.INVOICE_EXTENDED_WORKFLOW: - INVOICE_STATUS_FINANCE_1_CHOICES = [CHANGES_REQUESTED_BY_FINANCE_1, APPROVED_BY_FINANCE_1] - INVOICE_STATUS_FINANCE_2_CHOICES = [CHANGES_REQUESTED_BY_FINANCE_2, APPROVED_BY_FINANCE_2, PAID] + INVOICE_STATUS_FINANCE_1_CHOICES = [ + CHANGES_REQUESTED_BY_FINANCE_1, + APPROVED_BY_FINANCE_1, + ] + INVOICE_STATUS_FINANCE_2_CHOICES = [ + CHANGES_REQUESTED_BY_FINANCE_2, + APPROVED_BY_FINANCE_2, + PAID, + ] def invoice_status_user_choices(user): @@ -64,7 +78,7 @@ def invoice_status_user_choices(user): def invoice_path(instance, filename): - return f'projects/{instance.project_id}/payment_invoices/{filename}' + return f"projects/{instance.project_id}/payment_invoices/{filename}" class InvoiceQueryset(models.QuerySet): @@ -87,12 +101,16 @@ def waiting_to_convert(self): def for_finance_1(self): if settings.INVOICE_EXTENDED_WORKFLOW: - return self.filter(status__in=[APPROVED_BY_STAFF, CHANGES_REQUESTED_BY_FINANCE_2]) + return self.filter( + status__in=[APPROVED_BY_STAFF, CHANGES_REQUESTED_BY_FINANCE_2] + ) return self.filter(status__in=[APPROVED_BY_STAFF, APPROVED_BY_FINANCE_1]) def for_finance_2(self): if settings.INVOICE_EXTENDED_WORKFLOW: - return self.filter(status__in=[APPROVED_BY_FINANCE_1, APPROVED_BY_FINANCE_2]) + return self.filter( + status__in=[APPROVED_BY_FINANCE_1, APPROVED_BY_FINANCE_2] + ) return [] def rejected(self): @@ -102,24 +120,23 @@ def not_rejected(self): return self.exclude(status=DECLINED) def total_value(self, field): - return self.aggregate(total=Coalesce(Sum(field), Value(0), output_field=models.DecimalField()))['total'] + return self.aggregate( + total=Coalesce(Sum(field), Value(0), output_field=models.DecimalField()) + )["total"] def paid_value(self): - return self.filter(status=PAID).total_value('paid_value') + return self.filter(status=PAID).total_value("paid_value") def unpaid_value(self): - return self.filter(~Q(status=PAID)).total_value('paid_value') + return self.filter(~Q(status=PAID)).total_value("paid_value") class InvoiceDeliverable(models.Model): deliverable = models.ForeignKey( - 'Deliverable', - on_delete=models.CASCADE, - related_name='deliverables' + "Deliverable", on_delete=models.CASCADE, related_name="deliverables" ) quantity = models.IntegerField( - help_text=_('Quantity Selected on an Invoice'), - default=0 + help_text=_("Quantity Selected on an Invoice"), default=0 ) wagtail_reference_index_ignore = True @@ -129,50 +146,54 @@ def __str__(self): def get_absolute_api_url(self): return reverse( - 'api:v1:remove-deliverables', - kwargs={'pk': self.pk, 'invoice_pk': self.pk} + "api:v1:remove-deliverables", kwargs={"pk": self.pk, "invoice_pk": self.pk} ) class Invoice(models.Model): - project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="invoices") - by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="invoices") + project = models.ForeignKey( + "Project", on_delete=models.CASCADE, related_name="invoices" + ) + by = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="invoices" + ) paid_value = models.DecimalField( max_digits=10, decimal_places=2, - validators=[MinValueValidator(decimal.Decimal('0.01'))], - null=True + validators=[MinValueValidator(decimal.Decimal("0.01"))], + null=True, ) document = models.FileField(upload_to=invoice_path, storage=PrivateStorage()) requested_at = models.DateTimeField(auto_now_add=True) - message_for_pm = models.TextField(blank=True, verbose_name=_('Message')) + message_for_pm = models.TextField(blank=True, verbose_name=_("Message")) comment = models.TextField(blank=True) - invoice_number = models.CharField(max_length=50, null=True, verbose_name=_("Invoice number")) + invoice_number = models.CharField( + max_length=50, null=True, verbose_name=_("Invoice number") + ) invoice_amount = models.DecimalField( max_digits=10, decimal_places=2, - validators=[MinValueValidator(decimal.Decimal('0.01'))], + validators=[MinValueValidator(decimal.Decimal("0.01"))], null=True, - verbose_name=_("Invoice amount") + verbose_name=_("Invoice amount"), ) status = FSMField(default=SUBMITTED, choices=INVOICE_STATUS_CHOICES) - deliverables = ManyToManyField( - 'InvoiceDeliverable', - related_name='invoices' - ) + deliverables = ManyToManyField("InvoiceDeliverable", related_name="invoices") objects = InvoiceQueryset.as_manager() wagtail_reference_index_ignore = True def __str__(self): - return _('Invoice requested for {project}').format(project=self.project) + return _("Invoice requested for {project}").format(project=self.project) - @transition(field=status, source=INVOICE_TRANISTION_TO_RESUBMITTED, target=RESUBMITTED) + @transition( + field=status, source=INVOICE_TRANISTION_TO_RESUBMITTED, target=RESUBMITTED + ) def transition_invoice_to_resubmitted(self): - ''' + """ Tranistion invoice to resubmitted status. This method generally gets used on invoice edit. - ''' + """ pass @property @@ -185,13 +206,13 @@ def status_display(self): @property def vendor_document_number(self): - ''' + """ Vendor document number is a required field to create invoices in IntAcct. Formatting should be HP###### i.e. HP000001 and so on. - ''' - prefix = 'HP-' - return prefix + '-'.join(wrap(f"{self.id:06}", 3)) + """ + prefix = "HP-" + return prefix + "-".join(wrap(f"{self.id:06}", 3)) def can_user_delete(self, user): if user.is_applicant or user.is_apply_staff: @@ -201,10 +222,10 @@ def can_user_delete(self, user): return False def can_user_edit(self, user): - ''' + """ Check when an user can edit an invoice. Only applicant and staff have permission to edit invoice based on its current status. - ''' + """ if user.is_applicant: if self.status in {SUBMITTED, CHANGES_REQUESTED_BY_STAFF, RESUBMITTED}: return True @@ -216,10 +237,15 @@ def can_user_edit(self, user): return False def can_user_change_status(self, user): - ''' + """ Check user roles that can tranistion invoice status based on the current status. - ''' - if not (user.is_contracting or user.is_apply_staff or user.is_finance_level_1 or user.is_finance_level_2): + """ + if not ( + user.is_contracting + or user.is_apply_staff + or user.is_finance_level_1 + or user.is_finance_level_2 + ): return False # Users can't change status if self.status in {PAID, DECLINED}: @@ -230,7 +256,12 @@ def can_user_change_status(self, user): return True if user.is_apply_staff: - if self.status in {SUBMITTED, RESUBMITTED, CHANGES_REQUESTED_BY_STAFF, CHANGES_REQUESTED_BY_FINANCE_1}: + if self.status in { + SUBMITTED, + RESUBMITTED, + CHANGES_REQUESTED_BY_STAFF, + CHANGES_REQUESTED_BY_FINANCE_1, + }: return True if user.is_finance_level_1: @@ -248,7 +279,9 @@ def can_user_change_status(self, user): return False def can_user_edit_deliverables(self, user): - if not (user.is_apply_staff or user.is_finance_level_1 or user.is_finance_level_2): + if not ( + user.is_apply_staff or user.is_finance_level_1 or user.is_finance_level_2 + ): return False if user.is_apply_staff: if self.status in {SUBMITTED, RESUBMITTED, CHANGES_REQUESTED_BY_FINANCE_1}: @@ -256,7 +289,9 @@ def can_user_edit_deliverables(self, user): if user.is_finance_level_1: if self.status in {APPROVED_BY_STAFF}: return True - elif settings.INVOICE_EXTENDED_WORKFLOW and self.status in [CHANGES_REQUESTED_BY_FINANCE_2]: + elif settings.INVOICE_EXTENDED_WORKFLOW and self.status in [ + CHANGES_REQUESTED_BY_FINANCE_2 + ]: return True if user.is_finance_level_2: if self.status in {APPROVED_BY_FINANCE_1}: @@ -269,13 +304,17 @@ def value(self): def get_absolute_url(self): return reverse( - 'apply:projects:invoice-detail', - kwargs={'pk': self.project.pk, 'invoice_pk': self.pk} + "apply:projects:invoice-detail", + kwargs={"pk": self.project.pk, "invoice_pk": self.pk}, ) @property def deliverables_total_amount(self): - return self.deliverables.all().aggregate(total=Sum(F('deliverable__unit_price') * F('quantity'), output_field=FloatField())) + return self.deliverables.all().aggregate( + total=Sum( + F("deliverable__unit_price") * F("quantity"), output_field=FloatField() + ) + ) @property def filename(self): @@ -291,11 +330,11 @@ class SupportingDocument(models.Model): invoice = models.ForeignKey( Invoice, on_delete=models.CASCADE, - related_name='supporting_documents', + related_name="supporting_documents", ) def __str__(self): - return "{invoice}".format(invoice=self.invoice) + ' -> ' + self.document.name + return "{invoice}".format(invoice=self.invoice) + " -> " + self.document.name @property def filename(self): diff --git a/hypha/apply/projects/models/project.py b/hypha/apply/projects/models/project.py index 99f055eefa..6ab5d0ef7d 100644 --- a/hypha/apply/projects/models/project.py +++ b/hypha/apply/projects/models/project.py @@ -37,55 +37,55 @@ def contract_path(instance, filename): - return f'projects/{instance.project_id}/contracts/{filename}' + return f"projects/{instance.project_id}/contracts/{filename}" def document_path(instance, filename): - return f'projects/{instance.project_id}/supporting_documents/{filename}' + return f"projects/{instance.project_id}/supporting_documents/{filename}" def document_template_path(instance, filename): - return f'projects/supporting_documents/{instance.id}/template/{filename}' + return f"projects/supporting_documents/{instance.id}/template/{filename}" def contract_document_template_path(instance, filename): - return f'projects/contract_documents/{instance.id}/template/{filename}' + return f"projects/contract_documents/{instance.id}/template/{filename}" def contract_document_path(instance, filename): - return f'projects/{instance.project_id}/contracting_documents/{filename}' + return f"projects/{instance.project_id}/contracting_documents/{filename}" -PROJECT_ACTION_MESSAGE_TAG = 'project_action_message' +PROJECT_ACTION_MESSAGE_TAG = "project_action_message" -APPROVE = 'approve' -REQUEST_CHANGE = 'request_change' +APPROVE = "approve" +REQUEST_CHANGE = "request_change" PAF_STATUS_CHOICES = ( - (APPROVE, 'Approve'), - (REQUEST_CHANGE, 'Request changes or more information') + (APPROVE, "Approve"), + (REQUEST_CHANGE, "Request changes or more information"), ) -DRAFT = 'draft' -INTERNAL_APPROVAL = 'internal_approval' -CONTRACTING = 'contracting' -INVOICING_AND_REPORTING = 'invoicing_and_reporting' -CLOSING = 'closing' -COMPLETE = 'complete' +DRAFT = "draft" +INTERNAL_APPROVAL = "internal_approval" +CONTRACTING = "contracting" +INVOICING_AND_REPORTING = "invoicing_and_reporting" +CLOSING = "closing" +COMPLETE = "complete" PROJECT_STATUS_CHOICES = [ - (DRAFT, _('Draft')), - (INTERNAL_APPROVAL, _('Internal approval')), - (CONTRACTING, _('Contracting')), - (INVOICING_AND_REPORTING, _('Invoicing and reporting')), - (CLOSING, _('Closing')), - (COMPLETE, _('Complete')), + (DRAFT, _("Draft")), + (INTERNAL_APPROVAL, _("Internal approval")), + (CONTRACTING, _("Contracting")), + (INVOICING_AND_REPORTING, _("Invoicing and reporting")), + (CLOSING, _("Closing")), + (COMPLETE, _("Complete")), ] PROJECT_PUBLIC_STATUSES = [ - (DRAFT, _('Draft')), - (INTERNAL_APPROVAL, _('{} approval').format(settings.ORG_SHORT_NAME)), - (CONTRACTING, _('Contracting')), - (INVOICING_AND_REPORTING, _('Invoicing and reporting')), - (CLOSING, _('Closing')), - (COMPLETE, _('Complete')), + (DRAFT, _("Draft")), + (INTERNAL_APPROVAL, _("{} approval").format(settings.ORG_SHORT_NAME)), + (CONTRACTING, _("Contracting")), + (INVOICING_AND_REPORTING, _("Invoicing and reporting")), + (CLOSING, _("Closing")), + (COMPLETE, _("Complete")), ] @@ -97,7 +97,10 @@ def active(self): def in_progress(self): # Projects that users need to interact with, submitting reports or payment request. return self.filter( - status__in=(INVOICING_AND_REPORTING, CLOSING,) + status__in=( + INVOICING_AND_REPORTING, + CLOSING, + ) ) def complete(self): @@ -112,29 +115,40 @@ def internal_approval(self): ) def by_end_date(self, desc=False): - order = getattr(F('proposed_end'), 'desc' if desc else 'asc')(nulls_last=True) + order = getattr(F("proposed_end"), "desc" if desc else "asc")(nulls_last=True) return self.order_by(order) def with_amount_paid(self): return self.annotate( - amount_paid=Coalesce(Sum('invoices__paid_value'), Value(0), output_field=models.DecimalField()), + amount_paid=Coalesce( + Sum("invoices__paid_value"), + Value(0), + output_field=models.DecimalField(), + ), ) def with_last_payment(self): return self.annotate( - last_payment_request=Max('invoices__requested_at', output_field=models.DateTimeField()), + last_payment_request=Max( + "invoices__requested_at", output_field=models.DateTimeField() + ), ) def with_outstanding_reports(self): - Report = apps.get_model('application_projects', 'Report') + Report = apps.get_model("application_projects", "Report") return self.annotate( outstanding_reports=Subquery( Report.objects.filter( - project=OuterRef('pk'), - ).to_do().order_by().values('project').annotate( - count=Count('pk'), - ).values('count'), + project=OuterRef("pk"), + ) + .to_do() + .order_by() + .values("project") + .annotate( + count=Count("pk"), + ) + .values("count"), output_field=models.IntegerField(), ) ) @@ -144,71 +158,94 @@ def with_start_date(self): start=Cast( Subquery( Contract.objects.filter( - project=OuterRef('pk'), - ).approved().order_by( - 'approved_at' - ).values('approved_at')[:1] + project=OuterRef("pk"), + ) + .approved() + .order_by("approved_at") + .values("approved_at")[:1] ), models.DateField(), ) ) def for_table(self): - return self.with_amount_paid().with_last_payment().with_outstanding_reports().select_related( - 'report_config', - 'submission__page', - 'lead', + return ( + self.with_amount_paid() + .with_last_payment() + .with_outstanding_reports() + .select_related( + "report_config", + "submission__page", + "lead", + ) ) class Project(BaseStreamForm, AccessFormData, models.Model): - lead = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL, related_name='lead_projects') - submission = models.OneToOneField("funds.ApplicationSubmission", on_delete=models.CASCADE) - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, related_name='owned_projects') + lead = models.ForeignKey( + settings.AUTH_USER_MODEL, + null=True, + on_delete=models.SET_NULL, + related_name="lead_projects", + ) + submission = models.OneToOneField( + "funds.ApplicationSubmission", on_delete=models.CASCADE + ) + user = models.ForeignKey( + settings.AUTH_USER_MODEL, + on_delete=models.SET_NULL, + null=True, + related_name="owned_projects", + ) title = models.TextField() vendor = models.ForeignKey( "application_projects.Vendor", on_delete=models.SET_NULL, - null=True, blank=True, related_name='projects' + null=True, + blank=True, + related_name="projects", ) value = models.PositiveIntegerField(default=0) - proposed_start = models.DateTimeField(_('Proposed Start Date'), null=True) - proposed_end = models.DateTimeField(_('Proposed End Date'), null=True) + proposed_start = models.DateTimeField(_("Proposed Start Date"), null=True) + proposed_end = models.DateTimeField(_("Proposed End Date"), null=True) status = models.TextField(choices=PROJECT_STATUS_CHOICES, default=DRAFT) form_data = models.JSONField(encoder=StreamFieldDataEncoder, default=dict) - form_fields = StreamField(ProjectApprovalFormCustomFormFieldsBlock(), null=True, use_json_field=True) + form_fields = StreamField( + ProjectApprovalFormCustomFormFieldsBlock(), null=True, use_json_field=True + ) # tracks read/write state of the Project is_locked = models.BooleanField(default=False) # tracks updates to the Projects fields via the Project Application Form. user_has_updated_details = models.BooleanField(default=False) - submitted_contract_documents = models.BooleanField("Submit Contracting Documents", default=False) + submitted_contract_documents = models.BooleanField( + "Submit Contracting Documents", default=False + ) activities = GenericRelation( - 'activity.Activity', - content_type_field='source_content_type', - object_id_field='source_object_id', - related_query_name='project', + "activity.Activity", + content_type_field="source_content_type", + object_id_field="source_object_id", + related_query_name="project", ) created_at = models.DateTimeField(auto_now_add=True) external_projectid = models.CharField( max_length=30, blank=True, - help_text='ID of this project at integrated payment service.' + help_text="ID of this project at integrated payment service.", ) external_project_information = models.JSONField( default=dict, - help_text='More details of the project integrated at payment service.' + help_text="More details of the project integrated at payment service.", ) sent_to_compliance_at = models.DateTimeField(null=True) paf_reviews_meta_data = models.JSONField( - default=dict, - help_text='Reviewers role and their actions/comments' + default=dict, help_text="Reviewers role and their actions/comments" ) objects = ProjectQuerySet.as_manager() @@ -226,9 +263,9 @@ def get_address_display(self): try: address = json.loads(self.vendor.address) except (json.JSONDecodeError, AttributeError): - return '' + return "" else: - return ', '.join( + return ", ".join( address.get(field) for field in ADDRESS_FIELDS_ORDER if address.get(field) @@ -243,22 +280,24 @@ def create_from_submission(cls, submission, lead=None): Project. """ if not settings.PROJECTS_ENABLED: - logging.error(f'Tried to create a Project for Submission ID={submission.id} while projects are disabled') + logging.error( + f"Tried to create a Project for Submission ID={submission.id} while projects are disabled" + ) return None # OneToOne relations on the targetted model cannot be accessed without # an exception when the relation doesn't exist (is None). Since we # want to fail fast here, we can use hasattr instead. - if hasattr(submission, 'project'): + if hasattr(submission, "project"): return submission.project # See if there is a form field named "legal name", if not use user name. - legal_name = submission.get_answer_from_label('legal name') or submission.user.full_name - vendor, _ = Vendor.objects.get_or_create( - user=submission.user + legal_name = ( + submission.get_answer_from_label("legal name") or submission.user.full_name ) + vendor, _ = Vendor.objects.get_or_create(user=submission.user) vendor.name = legal_name - vendor.address = submission.form_data.get('address', '') + vendor.address = submission.form_data.get("address", "") vendor.save() return Project.objects.create( submission=submission, @@ -266,13 +305,15 @@ def create_from_submission(cls, submission, lead=None): title=submission.title, vendor=vendor, lead=lead if lead else None, - value=submission.form_data.get('value', 0), + value=submission.form_data.get("value", 0), ) @property def start_date(self): # Assume project starts when OTF are happy with the first signed contract - first_approved_contract = self.contracts.approved().order_by('approved_at').first() + first_approved_contract = ( + self.contracts.approved().order_by("approved_at").first() + ) if not first_approved_contract: return None @@ -303,7 +344,9 @@ def clean(self): return if self.proposed_start > self.proposed_end: - raise ValidationError(_('Proposed End Date must be after Proposed Start Date')) + raise ValidationError( + _("Proposed End Date must be after Proposed Start Date") + ) def save(self, *args, **kwargs): creating = not self.pk @@ -338,14 +381,16 @@ def editable_by(self, user): def editable(self): if self.is_locked: return False - elif self.status == DRAFT: # locked condition is enough,it is just for double check + elif ( + self.status == DRAFT + ): # locked condition is enough,it is just for double check return True return False def get_absolute_url(self): if settings.PROJECTS_ENABLED: - return reverse('apply:projects:detail', args=[self.id]) - return '#' + return reverse("apply:projects:detail", args=[self.id]) + return "#" @property def can_make_approval(self): @@ -390,30 +435,36 @@ def has_deliverables(self): @property def program_project_id(self): - ''' + """ Program project id is used to fetch deliverables from IntAcct. Stored in external_project_information as the first item of referenceno(PONUMBER). - ''' - reference_number = self.external_project_information.get('PONUMBER', None) + """ + reference_number = self.external_project_information.get("PONUMBER", None) if reference_number: - return reference_number.split('-')[0] - return '' + return reference_number.split("-")[0] + return "" class ProjectSOW(BaseStreamForm, AccessFormData, models.Model): - project = models.OneToOneField(Project, related_name='sow', on_delete=models.CASCADE) + project = models.OneToOneField( + Project, related_name="sow", on_delete=models.CASCADE + ) form_data = models.JSONField(encoder=StreamFieldDataEncoder, default=dict) - form_fields = StreamField(ProjectApprovalFormCustomFormFieldsBlock(), null=True, use_json_field=True) + form_fields = StreamField( + ProjectApprovalFormCustomFormFieldsBlock(), null=True, use_json_field=True + ) class ProjectBaseStreamForm(BaseStreamForm, models.Model): name = models.CharField(max_length=255) - form_fields = StreamField(ProjectApprovalFormCustomFormFieldsBlock(), use_json_field=True) + form_fields = StreamField( + ProjectApprovalFormCustomFormFieldsBlock(), use_json_field=True + ) panels = [ - FieldPanel('name'), - FieldPanel('form_fields'), + FieldPanel("name"), + FieldPanel("form_fields"), ] class Meta: @@ -441,11 +492,11 @@ class PAFReviewersRole(Orderable, ClusterableModel): ), related_name="paf_reviewers_roles", ) - page = ParentalKey('ProjectSettings', related_name='paf_reviewers_roles') + page = ParentalKey("ProjectSettings", related_name="paf_reviewers_roles") panels = [ - FieldPanel('label'), - FieldPanel('user_roles', widget=forms.CheckboxSelectMultiple), + FieldPanel("label"), + FieldPanel("user_roles", widget=forms.CheckboxSelectMultiple), ] def __str__(self): @@ -454,42 +505,60 @@ def __str__(self): @register_setting class ProjectSettings(BaseSiteSetting, ClusterableModel): - contracting_gp_email = models.TextField("Contracting Group Email", null=True, blank=True) + contracting_gp_email = models.TextField( + "Contracting Group Email", null=True, blank=True + ) finance_gp_email = models.TextField("Finance Group Email", null=True, blank=True) staff_gp_email = models.TextField("Staff Group Email", null=True, blank=True) vendor_setup_required = models.BooleanField(default=True) - paf_approval_sequential = models.BooleanField(default=True, help_text="Uncheck it to approve PAF parallely") + paf_approval_sequential = models.BooleanField( + default=True, help_text="Uncheck it to approve PAF parallely" + ) panels = [ - FieldPanel('staff_gp_email'), - FieldPanel('contracting_gp_email'), - FieldPanel('finance_gp_email'), - FieldPanel('vendor_setup_required'), + FieldPanel("staff_gp_email"), + FieldPanel("contracting_gp_email"), + FieldPanel("finance_gp_email"), + FieldPanel("vendor_setup_required"), MultiFieldPanel( [ - FieldPanel('paf_approval_sequential', heading='Approve PAF Sequentially'), - InlinePanel('paf_reviewers_roles', label=_('PAF Reviewers Roles')), + FieldPanel( + "paf_approval_sequential", heading="Approve PAF Sequentially" + ), + InlinePanel("paf_reviewers_roles", label=_("PAF Reviewers Roles")), ], - heading=_('PAF Reviewers Roles'), - ) + heading=_("PAF Reviewers Roles"), + ), ] class PAFApprovals(models.Model): - project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="paf_approvals") - paf_reviewer_role = models.ForeignKey("PAFReviewersRole", on_delete=models.CASCADE, related_name="paf_approvals") - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True, related_name="paf_approvals") + project = models.ForeignKey( + "Project", on_delete=models.CASCADE, related_name="paf_approvals" + ) + paf_reviewer_role = models.ForeignKey( + "PAFReviewersRole", on_delete=models.CASCADE, related_name="paf_approvals" + ) + user = models.ForeignKey( + settings.AUTH_USER_MODEL, + on_delete=models.SET_NULL, + null=True, + blank=True, + related_name="paf_approvals", + ) approved = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField() approved_at = models.DateTimeField(null=True, blank=True) class Meta: - unique_together = ['project', 'paf_reviewer_role'] + unique_together = ["project", "paf_reviewer_role"] ordering = ["paf_reviewer_role__sort_order"] def __str__(self): - return _('Approval of {project} by {user}').format(project=self.project, user=self.user) + return _("Approval of {project} by {user}").format( + project=self.project, user=self.user + ) def save(self, *args, **kwargs): self.updated_at = timezone.now() @@ -502,8 +571,15 @@ def approved(self): class Contract(models.Model): - approver = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL, related_name='contracts') - project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="contracts") + approver = models.ForeignKey( + settings.AUTH_USER_MODEL, + null=True, + on_delete=models.SET_NULL, + related_name="contracts", + ) + project = models.ForeignKey( + "Project", on_delete=models.CASCADE, related_name="contracts" + ) file = models.FileField(upload_to=contract_path, storage=PrivateStorage()) @@ -522,28 +598,37 @@ def save(self, *args, **kwargs): @property def state(self): - return _('Counter Signed') if self.signed_by_applicant else _('Unsigned') + return _("Counter Signed") if self.signed_by_applicant else _("Unsigned") def __str__(self): - return _('Contract for {project} ({state})').format(project=self.project, state=self.state) + return _("Contract for {project} ({state})").format( + project=self.project, state=self.state + ) def get_absolute_url(self): - return reverse('apply:projects:contract', args=[self.project.pk, self.pk]) + return reverse("apply:projects:contract", args=[self.project.pk, self.pk]) class PacketFile(models.Model): - category = models.ForeignKey("DocumentCategory", null=True, on_delete=models.CASCADE, related_name="packet_files") - project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="packet_files") + category = models.ForeignKey( + "DocumentCategory", + null=True, + on_delete=models.CASCADE, + related_name="packet_files", + ) + project = models.ForeignKey( + "Project", on_delete=models.CASCADE, related_name="packet_files" + ) title = models.TextField() document = models.FileField(upload_to=document_path, storage=PrivateStorage()) created_at = models.DateField(auto_now_add=True, null=True) def __str__(self): - return _('Project file: {title}').format(title=self.title) + return _("Project file: {title}").format(title=self.title) class Meta: - ordering = ('-created_at',) + ordering = ("-created_at",) def get_remove_form(self): """ @@ -553,8 +638,9 @@ def get_remove_form(self): instance of PacketFile in the supporting documents template. The standard Delegated View flow makes it difficult to create these forms in the view or template. - """ + """ from ..forms import RemoveDocumentForm + return RemoveDocumentForm(instance=self) @@ -565,15 +651,24 @@ def delete_packetfile_file(sender, instance, **kwargs): class ContractPacketFile(models.Model): - category = models.ForeignKey("ContractDocumentCategory", null=True, on_delete=models.CASCADE, related_name="contract_packet_files") - project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="contract_packet_files") + category = models.ForeignKey( + "ContractDocumentCategory", + null=True, + on_delete=models.CASCADE, + related_name="contract_packet_files", + ) + project = models.ForeignKey( + "Project", on_delete=models.CASCADE, related_name="contract_packet_files" + ) title = models.TextField() - document = models.FileField(upload_to=contract_document_path, storage=PrivateStorage()) + document = models.FileField( + upload_to=contract_document_path, storage=PrivateStorage() + ) created_at = models.DateField(auto_now_add=True, null=True) def __str__(self): - return _('Contract file: {title}').format(title=self.title) + return _("Contract file: {title}").format(title=self.title) def get_remove_form(self): """ @@ -583,8 +678,9 @@ def get_remove_form(self): instance of ContractPacketFile in the contracting documents template. The standard Delegated View flow makes it difficult to create these forms in the view or template. - """ + """ from ..forms import RemoveContractDocumentForm + return RemoveContractDocumentForm(instance=self) @@ -598,19 +694,24 @@ class DocumentCategory(models.Model): name = models.CharField(max_length=254) recommended_minimum = models.PositiveIntegerField(null=True, blank=True) required = models.BooleanField(default=False) - template = models.FileField(upload_to=document_template_path, storage=PrivateStorage(), blank=True, null=True) + template = models.FileField( + upload_to=document_template_path, + storage=PrivateStorage(), + blank=True, + null=True, + ) def __str__(self): return self.name class Meta: - ordering = ('-required', 'name') - verbose_name_plural = 'Project Document Categories' + ordering = ("-required", "name") + verbose_name_plural = "Project Document Categories" panels = [ - FieldPanel('name'), - FieldPanel('required'), - FieldPanel('template'), + FieldPanel("name"), + FieldPanel("required"), + FieldPanel("template"), ] @@ -618,19 +719,24 @@ class ContractDocumentCategory(models.Model): name = models.CharField(max_length=254) recommended_minimum = models.PositiveIntegerField(null=True, blank=True) required = models.BooleanField(default=True) - template = models.FileField(upload_to=contract_document_template_path, storage=PrivateStorage(), blank=True, null=True) + template = models.FileField( + upload_to=contract_document_template_path, + storage=PrivateStorage(), + blank=True, + null=True, + ) def __str__(self): return self.name class Meta: - ordering = ('-required', 'name') - verbose_name_plural = 'Contract Document Categories' + ordering = ("-required", "name") + verbose_name_plural = "Contract Document Categories" panels = [ - FieldPanel('name'), - FieldPanel('required'), - FieldPanel('template'), + FieldPanel("name"), + FieldPanel("required"), + FieldPanel("template"), ] @@ -638,24 +744,25 @@ class Deliverable(models.Model): external_id = models.CharField( max_length=30, blank=True, - help_text='ID of this deliverable at integrated payment service.' + help_text="ID of this deliverable at integrated payment service.", ) name = models.TextField() available_to_invoice = models.IntegerField(default=1) unit_price = models.DecimalField( max_digits=10, decimal_places=2, - validators=[MinValueValidator(decimal.Decimal('0.01'))], + validators=[MinValueValidator(decimal.Decimal("0.01"))], ) extra_information = models.JSONField( default=dict, - help_text='More details of the deliverable at integrated payment service.' + help_text="More details of the deliverable at integrated payment service.", ) project = models.ForeignKey( Project, - null=True, blank=True, + null=True, + blank=True, on_delete=models.CASCADE, - related_name='deliverables' + related_name="deliverables", ) def __str__(self): diff --git a/hypha/apply/projects/models/report.py b/hypha/apply/projects/models/report.py index 2e92062f27..9467b2f033 100644 --- a/hypha/apply/projects/models/report.py +++ b/hypha/apply/projects/models/report.py @@ -17,7 +17,9 @@ def report_path(instance, filename): - return f'reports/{instance.report.report_id}/version/{instance.report_id}/{filename}' + return ( + f"reports/{instance.report.report_id}/version/{instance.report_id}/{filename}" + ) class ReportQueryset(models.QuerySet): @@ -32,7 +34,7 @@ def to_do(self): current__isnull=True, skipped=False, end_date__lt=today, - ).order_by('end_date') + ).order_by("end_date") def any_very_late(self): two_weeks_ago = timezone.now().date() - relativedelta(weeks=2) @@ -42,18 +44,19 @@ def submitted(self): return self.filter(current__isnull=False) def for_table(self): - Project = apps.get_model('application_projects', 'Project') + Project = apps.get_model("application_projects", "Project") return self.annotate( last_end_date=Subquery( Report.objects.filter( - project=OuterRef('project_id'), - end_date__lt=OuterRef('end_date') - ).values('end_date')[:1] + project=OuterRef("project_id"), end_date__lt=OuterRef("end_date") + ).values("end_date")[:1] ), project_start_date=Subquery( Project.objects.filter( - pk=OuterRef('project_id'), - ).with_start_date().values('start')[:1] + pk=OuterRef("project_id"), + ) + .with_start_date() + .values("start")[:1] ), start=Case( When( @@ -62,34 +65,36 @@ def for_table(self): # Use cast to get an actual date object then=Cast( ExpressionWrapper( - F('last_end_date') + datetime.timedelta(days=1), + F("last_end_date") + datetime.timedelta(days=1), output_field=models.DateTimeField(), ), models.DateField(), ), ), - default=F('project_start_date'), + default=F("project_start_date"), output_field=models.DateField(), - ) + ), ) class Report(models.Model): skipped = models.BooleanField(default=False) end_date = models.DateField() - project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="reports") + project = models.ForeignKey( + "Project", on_delete=models.CASCADE, related_name="reports" + ) submitted = models.DateTimeField(null=True) notified = models.DateTimeField(null=True) current = models.OneToOneField( "ReportVersion", on_delete=models.CASCADE, - related_name='live_for_report', + related_name="live_for_report", null=True, ) draft = models.OneToOneField( "ReportVersion", on_delete=models.CASCADE, - related_name='draft_for_report', + related_name="draft_for_report", null=True, ) @@ -98,28 +103,39 @@ class Report(models.Model): wagtail_reference_index_ignore = True class Meta: - ordering = ('-end_date',) + ordering = ("-end_date",) def get_absolute_url(self): - return reverse('apply:projects:reports:detail', kwargs={'pk': self.pk}) + return reverse("apply:projects:reports:detail", kwargs={"pk": self.pk}) @property def previous(self): - return Report.objects.submitted().filter( - project=self.project_id, - end_date__lt=self.end_date, - ).exclude( - pk=self.pk, - ).first() + return ( + Report.objects.submitted() + .filter( + project=self.project_id, + end_date__lt=self.end_date, + ) + .exclude( + pk=self.pk, + ) + .first() + ) @property def next(self): - return Report.objects.submitted().filter( - project=self.project_id, - end_date__gt=self.end_date, - ).exclude( - pk=self.pk, - ).order_by('end_date').first() + return ( + Report.objects.submitted() + .filter( + project=self.project_id, + end_date__gt=self.end_date, + ) + .exclude( + pk=self.pk, + ) + .order_by("end_date") + .first() + ) @property def past_due(self): @@ -151,7 +167,9 @@ def start_date(self): class ReportVersion(models.Model): - report = models.ForeignKey("Report", on_delete=models.CASCADE, related_name="versions") + report = models.ForeignKey( + "Report", on_delete=models.CASCADE, related_name="versions" + ) submitted = models.DateTimeField() public_content = models.TextField() private_content = models.TextField() @@ -167,7 +185,9 @@ class ReportVersion(models.Model): class ReportPrivateFiles(models.Model): - report = models.ForeignKey("ReportVersion", on_delete=models.CASCADE, related_name="files") + report = models.ForeignKey( + "ReportVersion", on_delete=models.CASCADE, related_name="files" + ) document = models.FileField(upload_to=report_path, storage=PrivateStorage()) wagtail_reference_index_ignore = True @@ -180,22 +200,27 @@ def __str__(self): return self.filename def get_absolute_url(self): - return reverse('apply:projects:reports:document', kwargs={'pk': self.report.report_id, 'file_pk': self.pk}) + return reverse( + "apply:projects:reports:document", + kwargs={"pk": self.report.report_id, "file_pk": self.pk}, + ) class ReportConfig(models.Model): """Persists configuration about the reporting schedule etc""" - WEEK = _('week') - MONTH = _('month') - YEAR = _('year') + WEEK = _("week") + MONTH = _("month") + YEAR = _("year") FREQUENCY_CHOICES = [ - (WEEK, _('Weeks')), - (MONTH, _('Months')), - (YEAR, _('Years')), + (WEEK, _("Weeks")), + (MONTH, _("Months")), + (YEAR, _("Years")), ] - project = models.OneToOneField("Project", on_delete=models.CASCADE, related_name="report_config") + project = models.OneToOneField( + "Project", on_delete=models.CASCADE, related_name="report_config" + ) schedule_start = models.DateField(null=True) occurrence = models.PositiveSmallIntegerField(default=1) frequency = models.CharField(choices=FREQUENCY_CHOICES, default=MONTH, max_length=6) @@ -204,40 +229,55 @@ class ReportConfig(models.Model): def get_frequency_display(self): if self.disable_reporting: - return _('Reporting Disabled') + return _("Reporting Disabled") if self.does_not_repeat: last_report = self.last_report() if last_report: - return _('One time, that already has reported on {date}'.format( - date=last_report.end_date.strftime('%d %B, %Y'))) - return _('One time on {date}'.format(date=self.schedule_start.strftime('%d %B, %Y'))) + return _( + "One time, that already has reported on {date}".format( + date=last_report.end_date.strftime("%d %B, %Y") + ) + ) + return _( + "One time on {date}".format( + date=self.schedule_start.strftime("%d %B, %Y") + ) + ) next_report = self.current_due_report() if self.frequency == self.YEAR: if self.schedule_start and self.schedule_start.day == 31: - day_of_month = _('last day') - month = self.schedule_start.strftime('%B') + day_of_month = _("last day") + month = self.schedule_start.strftime("%B") else: day_of_month = ordinal(next_report.end_date.day) - month = next_report.end_date.strftime('%B') + month = next_report.end_date.strftime("%B") if self.occurrence == 1: - return _('Once a year on {month} {day}').format(day=day_of_month, month=month) - return _('Every {occurrence} years on {month} {day}').format(occurrence=self.occurrence, day=day_of_month, month=month) + return _("Once a year on {month} {day}").format( + day=day_of_month, month=month + ) + return _("Every {occurrence} years on {month} {day}").format( + occurrence=self.occurrence, day=day_of_month, month=month + ) if self.frequency == self.MONTH: if self.schedule_start and self.schedule_start.day == 31: - day_of_month = _('last day') + day_of_month = _("last day") else: day_of_month = ordinal(next_report.end_date.day) if self.occurrence == 1: - return _('Once a month on the {day}').format(day=day_of_month) - return _('Every {occurrence} months on the {day}').format(occurrence=self.occurrence, day=day_of_month) + return _("Once a month on the {day}").format(day=day_of_month) + return _("Every {occurrence} months on the {day}").format( + occurrence=self.occurrence, day=day_of_month + ) - weekday = next_report.end_date.strftime('%A') + weekday = next_report.end_date.strftime("%A") if self.occurrence == 1: - return _('Once a week on {weekday}').format(weekday=weekday) - return _('Every {occurrence} weeks on {weekday}').format(occurrence=self.occurrence, weekday=weekday) + return _("Once a week on {weekday}").format(weekday=weekday) + return _("Every {occurrence} weeks on {weekday}").format( + occurrence=self.occurrence, weekday=weekday + ) def is_up_to_date(self): return len(self.project.reports.to_do()) == 0 @@ -258,9 +298,7 @@ def last_report(self): # - was skipped but due after today # - was submitted but due after today return self.project.reports.filter( - Q(end_date__lt=today) | - Q(skipped=True) | - Q(submitted__isnull=False) + Q(end_date__lt=today) | Q(skipped=True) | Q(submitted__isnull=False) ).first() def current_due_report(self): @@ -309,12 +347,12 @@ def current_due_report(self): current__isnull=True, skipped=False, end_date__gte=today, - defaults={'end_date': next_due_date} + defaults={"end_date": next_due_date}, ) return report def next_date(self, last_date): - delta_frequency = self.frequency + 's' + delta_frequency = self.frequency + "s" delta = relativedelta(**{delta_frequency: self.occurrence}) next_date = last_date + delta return next_date diff --git a/hypha/apply/projects/models/vendor.py b/hypha/apply/projects/models/vendor.py index 20b2a50ce8..1b530524f2 100644 --- a/hypha/apply/projects/models/vendor.py +++ b/hypha/apply/projects/models/vendor.py @@ -13,27 +13,22 @@ class BankInformation(models.Model): account_holder_name = models.CharField(max_length=150) account_routing_number = models.CharField(max_length=10) account_number = models.CharField(max_length=20) - account_currency = models.CharField( - max_length=10 - ) + account_currency = models.CharField(max_length=10) need_extra_info = models.BooleanField(default=False) - branch_address = models.TextField(_('Address'), blank=True) + branch_address = models.TextField(_("Address"), blank=True) iba_info = models.OneToOneField( - 'self', - null=True, blank=True, + "self", + null=True, + blank=True, on_delete=models.SET_NULL, - related_name='bank_info', - verbose_name='Intermediary Bank Account Information' + related_name="bank_info", + verbose_name="Intermediary Bank Account Information", ) nid_type = models.CharField( - max_length=25, - verbose_name='National Identity Document Type', - blank=True + max_length=25, verbose_name="National Identity Document Type", blank=True ) nid_number = models.CharField( - max_length=20, - blank=True, - verbose_name='National Identity Document Number' + max_length=20, blank=True, verbose_name="National Identity Document Number" ) wagtail_reference_index_ignore = True @@ -43,26 +38,27 @@ def __str__(self): class Vendor(models.Model): - TYPE_CHOICES = [ - ('organization', _('Yes, the account belongs to the organisation above')), - ('personal', _('No, it is a personal bank account')), + ("organization", _("Yes, the account belongs to the organisation above")), + ("personal", _("No, it is a personal bank account")), ] - created_at = models.DateTimeField(verbose_name=_('Creation time'), auto_now_add=True) - updated_at = models.DateTimeField(verbose_name=_('Update time'), auto_now=True) + created_at = models.DateTimeField( + verbose_name=_("Creation time"), auto_now_add=True + ) + updated_at = models.DateTimeField(verbose_name=_("Update time"), auto_now=True) user = models.OneToOneField( - settings.AUTH_USER_MODEL, on_delete=models.PROTECT, - related_name='vendor' + settings.AUTH_USER_MODEL, on_delete=models.PROTECT, related_name="vendor" ) name = models.CharField(max_length=150, blank=True) contractor_name = models.CharField(max_length=150, blank=True) - address = models.TextField(_('Address'), blank=True) + address = models.TextField(_("Address"), blank=True) type = models.CharField(max_length=15, choices=TYPE_CHOICES, blank=True) required_to_pay_taxes = models.BooleanField(default=False) bank_info = models.OneToOneField( BankInformation, on_delete=models.SET_NULL, - null=True, blank=True, + null=True, + blank=True, ) other_info = models.TextField(blank=True) # tracks updates to the Vendor fields via the Vendor Setup Form. @@ -74,24 +70,23 @@ def __str__(self): return self.name def get_absolute_url(self): - return reverse('apply:projects:vendor-detail', args=[self.pk]) + return reverse("apply:projects:vendor-detail", args=[self.pk]) class DueDiligenceDocument(models.Model): - document = models.FileField( upload_to="due_diligence_documents", storage=PrivateStorage() ) vendor = models.ForeignKey( Vendor, on_delete=models.CASCADE, - related_name='due_diligence_documents', + related_name="due_diligence_documents", ) wagtail_reference_index_ignore = True def __str__(self): - return self.vendor.name + ' -> ' + self.document.name + return self.vendor.name + " -> " + self.document.name @register_setting @@ -99,239 +94,264 @@ class VendorFormSettings(BaseSiteSetting): wagtail_reference_index_ignore = True name_label = models.TextField( - 'label', - default='1. What is the name of the person/organisation on the contract?' + "label", + default="1. What is the name of the person/organisation on the contract?", ) name_help_text = RichTextField( - 'help text', blank=True, - default='This is the party name in the contract.' + "help text", blank=True, default="This is the party name in the contract." ) contractor_name_label = models.TextField( - 'label', - default="2. What is the individual's name who is signing the contract?" + "label", default="2. What is the individual's name who is signing the contract?" ) contractor_name_help_text = RichTextField( - 'help text', blank=True, - default="This person is is authorised to sign contract on behalf of the person or organization named above." + "help text", + blank=True, + default="This person is is authorised to sign contract on behalf of the person or organization named above.", ) type_label = models.TextField( - 'label', - default='3. Is the bank account owned by the person or organisation in the Question 1 above?' + "label", + default="3. Is the bank account owned by the person or organisation in the Question 1 above?", ) type_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='The name of the bank account must be the same as on the contract.' + default="The name of the bank account must be the same as on the contract.", ) required_to_pay_taxes_label = models.TextField( - 'label', - default='Is the organisation required to pay US taxes?' + "label", default="Is the organisation required to pay US taxes?" ) required_to_pay_taxes_help_text = RichTextField( - 'help text', - default='', blank=True, + "help text", + default="", + blank=True, ) due_diligence_documents_label = models.TextField( - 'label', - default='Due Diligence Documents' + "label", default="Due Diligence Documents" ) due_diligence_documents_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='Upload Due Diligence Documents. E.g. w8/w9 forms.' + default="Upload Due Diligence Documents. E.g. w8/w9 forms.", ) account_holder_name_label = models.TextField( - 'label', - default='Bank Account Holder name' + "label", default="Bank Account Holder name" ) account_holder_name_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='This name must be same as the person or organisation that signed the contract. ' - 'This person is authorised to sign contracts on behalf of the person or organisation named above.' + default="This name must be same as the person or organisation that signed the contract. " + "This person is authorised to sign contracts on behalf of the person or organisation named above.", ) account_routing_number_label = models.TextField( - 'label', - default='Bank Account Routing number' + "label", default="Bank Account Routing number" ) account_routing_number_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='Depending on your country, this might be called the ACH, SWIFT, BIC or ABA number.' - ) - account_number_label = models.TextField( - 'label', - default='Bank Account Number' + default="Depending on your country, this might be called the ACH, SWIFT, BIC or ABA number.", ) + account_number_label = models.TextField("label", default="Bank Account Number") account_number_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='Depending on your country, this might be called the account number, IBAN, or BBAN number.' - ) - account_currency_label = models.TextField( - 'label', - default='Bank Account Currency' + default="Depending on your country, this might be called the account number, IBAN, or BBAN number.", ) + account_currency_label = models.TextField("label", default="Bank Account Currency") account_currency_help_text = RichTextField( - 'help text', - blank=True, - default='This is the currency of this bank account.' + "help text", blank=True, default="This is the currency of this bank account." ) need_extra_info_label = models.TextField( - 'label', - default='Do you need to provide us with extra information?' - ) - need_extra_info_help_text = RichTextField( - 'help text', - blank=True, - default='' + "label", default="Do you need to provide us with extra information?" ) + need_extra_info_help_text = RichTextField("help text", blank=True, default="") branch_address_label = models.TextField( - 'label', - default='Bank Account Branch Address' + "label", default="Bank Account Branch Address" ) branch_address_help_text = models.TextField( - 'help text', + "help text", blank=True, - default='The address of the bank branch where you have the bank account ' - 'located(not the bank account holder address)' + default="The address of the bank branch where you have the bank account " + "located(not the bank account holder address)", ) ib_account_routing_number_label = models.TextField( - 'label', - default='Intermediary Bank Account Routing Number' + "label", default="Intermediary Bank Account Routing Number" ) ib_account_routing_number_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='Depending on your country, this might be called ACH, SWIFT, BIC or ABA number' + default="Depending on your country, this might be called ACH, SWIFT, BIC or ABA number", ) ib_account_number_label = models.TextField( - 'label', - default='Intermediary Bank Account Number' + "label", default="Intermediary Bank Account Number" ) ib_account_number_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='Depending on your country, this might be called the account number, IBAN, or BBAN number' + default="Depending on your country, this might be called the account number, IBAN, or BBAN number", ) ib_account_currency_label = models.TextField( - 'label', - default='Intermediary Bank Account Currency' + "label", default="Intermediary Bank Account Currency" ) ib_account_currency_help_text = RichTextField( - 'help text', - blank=True, - default='This is the currency of this bank account' + "help text", blank=True, default="This is the currency of this bank account" ) ib_branch_address_label = models.TextField( - 'label', - default='Intermediary Bank Branch Address' + "label", default="Intermediary Bank Branch Address" ) ib_branch_address_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='Bank branch address(not the bank account holder address)' + default="Bank branch address(not the bank account holder address)", ) nid_type_label = models.TextField( - 'label', - default='Account Holder National Identity Document Type' + "label", default="Account Holder National Identity Document Type" ) nid_type_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='This could be a passport, a National Identity number, ' - 'or other national identity document.' + default="This could be a passport, a National Identity number, " + "or other national identity document.", ) nid_number_label = models.TextField( - 'label', - default='Account Holder National Identity Document Number' + "label", default="Account Holder National Identity Document Number" ) nid_number_help_text = RichTextField( - 'help text', - default='', + "help text", + default="", blank=True, ) - other_info_label = models.TextField( - 'label', - default='Other Information' - ) + other_info_label = models.TextField("label", default="Other Information") other_info_help_text = RichTextField( - 'help text', + "help text", blank=True, - default='If you need to include other information not listed above, provide it here.' + default="If you need to include other information not listed above, provide it here.", ) panels = [ - MultiFieldPanel([ - FieldPanel('name_label'), - FieldPanel('name_help_text'), - ], 'Name'), - MultiFieldPanel([ - FieldPanel('contractor_name_label'), - FieldPanel('contractor_name_help_text'), - ], 'Contractor Name'), - MultiFieldPanel([ - FieldPanel('type_label'), - FieldPanel('type_help_text'), - ], 'Type'), - MultiFieldPanel([ - FieldPanel('required_to_pay_taxes_label'), - FieldPanel('required_to_pay_taxes_help_text'), - ], 'Required to pay taxes'), - MultiFieldPanel([ - FieldPanel('due_diligence_documents_label'), - FieldPanel('due_diligence_documents_help_text'), - ], 'Due Diligence Documents'), - MultiFieldPanel([ - FieldPanel('account_holder_name_label'), - FieldPanel('account_holder_name_help_text'), - ], 'Account Holder Name'), - MultiFieldPanel([ - FieldPanel('account_routing_number_label'), - FieldPanel('account_routing_number_help_text'), - ], 'Account Routing Number'), - MultiFieldPanel([ - FieldPanel('account_number_label'), - FieldPanel('account_number_help_text'), - ], 'Account Number'), - MultiFieldPanel([ - FieldPanel('account_currency_label'), - FieldPanel('account_currency_help_text'), - ], 'Account Currency'), - MultiFieldPanel([ - FieldPanel('need_extra_info_label'), - FieldPanel('need_extra_info_help_text'), - ], 'Need Extra Info'), - MultiFieldPanel([ - FieldPanel('branch_address_label'), - FieldPanel('branch_address_help_text'), - ], 'Account Branch Address'), - MultiFieldPanel([ - FieldPanel('ib_account_routing_number_label'), - FieldPanel('ib_account_routing_number_help_text'), - ], 'Intermediary Account Routing Number'), - MultiFieldPanel([ - FieldPanel('ib_account_number_label'), - FieldPanel('ib_account_number_help_text'), - ], 'Intermediary Account Number'), - MultiFieldPanel([ - FieldPanel('ib_account_currency_label'), - FieldPanel('ib_account_currency_help_text'), - ], 'Intermediary Account Currency'), - MultiFieldPanel([ - FieldPanel('ib_branch_address_label'), - FieldPanel('ib_branch_address_help_text'), - ], 'Intermediary Account Branch Address'), - MultiFieldPanel([ - FieldPanel('nid_type_label'), - FieldPanel('nid_type_help_text'), - ], 'National Identity Document Type'), - MultiFieldPanel([ - FieldPanel('nid_number_label'), - FieldPanel('nid_number_help_text'), - ], 'National Identity Document Number'), - MultiFieldPanel([ - FieldPanel('other_info_label'), - FieldPanel('other_info_help_text'), - ], 'Other Information'), + MultiFieldPanel( + [ + FieldPanel("name_label"), + FieldPanel("name_help_text"), + ], + "Name", + ), + MultiFieldPanel( + [ + FieldPanel("contractor_name_label"), + FieldPanel("contractor_name_help_text"), + ], + "Contractor Name", + ), + MultiFieldPanel( + [ + FieldPanel("type_label"), + FieldPanel("type_help_text"), + ], + "Type", + ), + MultiFieldPanel( + [ + FieldPanel("required_to_pay_taxes_label"), + FieldPanel("required_to_pay_taxes_help_text"), + ], + "Required to pay taxes", + ), + MultiFieldPanel( + [ + FieldPanel("due_diligence_documents_label"), + FieldPanel("due_diligence_documents_help_text"), + ], + "Due Diligence Documents", + ), + MultiFieldPanel( + [ + FieldPanel("account_holder_name_label"), + FieldPanel("account_holder_name_help_text"), + ], + "Account Holder Name", + ), + MultiFieldPanel( + [ + FieldPanel("account_routing_number_label"), + FieldPanel("account_routing_number_help_text"), + ], + "Account Routing Number", + ), + MultiFieldPanel( + [ + FieldPanel("account_number_label"), + FieldPanel("account_number_help_text"), + ], + "Account Number", + ), + MultiFieldPanel( + [ + FieldPanel("account_currency_label"), + FieldPanel("account_currency_help_text"), + ], + "Account Currency", + ), + MultiFieldPanel( + [ + FieldPanel("need_extra_info_label"), + FieldPanel("need_extra_info_help_text"), + ], + "Need Extra Info", + ), + MultiFieldPanel( + [ + FieldPanel("branch_address_label"), + FieldPanel("branch_address_help_text"), + ], + "Account Branch Address", + ), + MultiFieldPanel( + [ + FieldPanel("ib_account_routing_number_label"), + FieldPanel("ib_account_routing_number_help_text"), + ], + "Intermediary Account Routing Number", + ), + MultiFieldPanel( + [ + FieldPanel("ib_account_number_label"), + FieldPanel("ib_account_number_help_text"), + ], + "Intermediary Account Number", + ), + MultiFieldPanel( + [ + FieldPanel("ib_account_currency_label"), + FieldPanel("ib_account_currency_help_text"), + ], + "Intermediary Account Currency", + ), + MultiFieldPanel( + [ + FieldPanel("ib_branch_address_label"), + FieldPanel("ib_branch_address_help_text"), + ], + "Intermediary Account Branch Address", + ), + MultiFieldPanel( + [ + FieldPanel("nid_type_label"), + FieldPanel("nid_type_help_text"), + ], + "National Identity Document Type", + ), + MultiFieldPanel( + [ + FieldPanel("nid_number_label"), + FieldPanel("nid_number_help_text"), + ], + "National Identity Document Number", + ), + MultiFieldPanel( + [ + FieldPanel("other_info_label"), + FieldPanel("other_info_help_text"), + ], + "Other Information", + ), ] diff --git a/hypha/apply/projects/permissions.py b/hypha/apply/projects/permissions.py index 426e940bd6..87b22573d0 100644 --- a/hypha/apply/projects/permissions.py +++ b/hypha/apply/projects/permissions.py @@ -25,77 +25,91 @@ def has_permission(action, user, object=None, raise_exception=True, **kwargs): def can_approve_contract(user, project, **kwargs): if project.status != CONTRACTING: - return False, 'Project is not in Contracting State' + return False, "Project is not in Contracting State" if not project.submitted_contract_documents: - return False, 'No contract documents submission yet' + return False, "No contract documents submission yet" if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if user.is_apply_staff and not user.is_contracting and not user.is_applicant: - return True, 'Only Staff can approve the contract' + return True, "Only Staff can approve the contract" - return False, 'Forbidden Error' + return False, "Forbidden Error" def can_upload_contract(user, project, **kwargs): if project.status != CONTRACTING: - return False, 'Project is not in Contracting State' + return False, "Project is not in Contracting State" if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if user == project.user and project.contracts.exists(): - return True, 'Project Owner can only re-upload contract with countersigned' + return True, "Project Owner can only re-upload contract with countersigned" if user.is_contracting: - return True, 'Contracting team can upload the contract' + return True, "Contracting team can upload the contract" - return False, 'Forbidden Error' + return False, "Forbidden Error" def can_submit_contract_documents(user, project, **kwargs): if project.status != CONTRACTING: - return False, 'Project is not in Contracting State' + return False, "Project is not in Contracting State" if user != project.user: - return False, 'Only Vendor can submit contracting documents' - if not kwargs.get('contract', None): - return False, 'Can not submit without contract' + return False, "Only Vendor can submit contracting documents" + if not kwargs.get("contract", None): + return False, "Can not submit without contract" if not project.submitted_contract_documents: - return True, 'Vendor can submit contracting documents' + return True, "Vendor can submit contracting documents" - return False, 'Forbidden Error' + return False, "Forbidden Error" def can_update_paf_approvers(user, project, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if project.status != INTERNAL_APPROVAL: - return False, 'PAF Approvers can be updated only in Internal approval state' + return False, "PAF Approvers can be updated only in Internal approval state" if user == project.lead: - return True, 'Lead can update approvers in approval state' + return True, "Lead can update approvers in approval state" if not project.paf_approvals.exists(): - return False, 'No user can update approvers without paf approval, except lead(lead can add paf approvals)' + return ( + False, + "No user can update approvers without paf approval, except lead(lead can add paf approvals)", + ) - request = kwargs.get('request') + request = kwargs.get("request") project_settings = ProjectSettings.for_request(request) if project_settings.paf_approval_sequential: next_paf_approval = project.paf_approvals.filter(approved=False).first() if next_paf_approval: - if next_paf_approval.user and user in get_users_for_groups(list(next_paf_approval.paf_reviewer_role.user_roles.all()), exact_match=True): - return True, 'PAF Reviewer-roles users can update next approval approvers if any approvers assigned' - return False, 'Forbidden Error' + if next_paf_approval.user and user in get_users_for_groups( + list(next_paf_approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ): + return ( + True, + "PAF Reviewer-roles users can update next approval approvers if any approvers assigned", + ) + return False, "Forbidden Error" else: approvers_ids = [] - for approval in project.paf_approvals.filter(approved=False, user__isnull=False): - approvers_ids.extend(assigner.id for assigner in - get_users_for_groups(list(approval.paf_reviewer_role.user_roles.all()), - exact_match=True)) + for approval in project.paf_approvals.filter( + approved=False, user__isnull=False + ): + approvers_ids.extend( + assigner.id + for assigner in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), exact_match=True + ) + ) if user.id in approvers_ids: - return True, 'PAF Reviewer-roles users can update approvers' - return False, 'Forbidden Error' + return True, "PAF Reviewer-roles users can update approvers" + return False, "Forbidden Error" def can_update_assigned_paf_approvers(user, project, **kwargs): @@ -104,194 +118,255 @@ def can_update_assigned_paf_approvers(user, project, **kwargs): UpdateAssignApproversView will be used by only approvers teams members. """ if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if project.status != INTERNAL_APPROVAL: - return False, 'PAF approvers can be assigned only in Internal approval state' + return False, "PAF approvers can be assigned only in Internal approval state" if not project.paf_approvals.exists(): - return False, 'No user can assign approvers with paf_approvals' + return False, "No user can assign approvers with paf_approvals" - request = kwargs.get('request') + request = kwargs.get("request") project_settings = ProjectSettings.for_request(request) if project_settings.paf_approval_sequential: next_paf_approval = project.paf_approvals.filter(approved=False).first() if next_paf_approval: - if user in get_users_for_groups(list(next_paf_approval.paf_reviewer_role.user_roles.all()), - exact_match=True): - return True, 'PAF Reviewer-roles users can assign approvers' - return False, 'Forbidden Error' - return False, 'Forbidden Error' + if user in get_users_for_groups( + list(next_paf_approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ): + return True, "PAF Reviewer-roles users can assign approvers" + return False, "Forbidden Error" + return False, "Forbidden Error" else: assigners_ids = [] for approval in project.paf_approvals.filter(approved=False): - assigners_ids.extend(assigner.id for assigner in - get_users_for_groups(list(approval.paf_reviewer_role.user_roles.all()), - exact_match=True)) + assigners_ids.extend( + assigner.id + for assigner in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), exact_match=True + ) + ) if user.id in assigners_ids: - return True, 'PAF Reviewer-roles users can assign approvers' - return False, 'Forbidden Error' + return True, "PAF Reviewer-roles users can assign approvers" + return False, "Forbidden Error" def can_assign_paf_approvers(user, project, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if project.status != INTERNAL_APPROVAL: - return False, 'PAF approvers can be assigned only in Internal approval state' + return False, "PAF approvers can be assigned only in Internal approval state" if not project.paf_approvals.exists(): - return False, 'No user can assign approvers with paf_approvals' + return False, "No user can assign approvers with paf_approvals" - request = kwargs.get('request') + request = kwargs.get("request") project_settings = ProjectSettings.for_request(request) if project_settings.paf_approval_sequential: next_paf_approval = project.paf_approvals.filter(approved=False).first() if next_paf_approval: if next_paf_approval.user: - return False, 'User already assigned' + return False, "User already assigned" else: - if user in get_users_for_groups(list(next_paf_approval.paf_reviewer_role.user_roles.all()), exact_match=True): - return True, 'PAF Reviewer-roles users can assign approvers' - return False, 'Forbidden Error' - return False, 'Forbidden Error' + if user in get_users_for_groups( + list(next_paf_approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ): + return True, "PAF Reviewer-roles users can assign approvers" + return False, "Forbidden Error" + return False, "Forbidden Error" else: assigners_ids = [] for approval in project.paf_approvals.filter(approved=False, user__isnull=True): - assigners_ids.extend(assigner.id for assigner in get_users_for_groups(list(approval.paf_reviewer_role.user_roles.all()), exact_match=True)) + assigners_ids.extend( + assigner.id + for assigner in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), exact_match=True + ) + ) if user.id in assigners_ids: - return True, 'PAF Reviewer-roles users can assign approvers' - return False, 'Forbidden Error' + return True, "PAF Reviewer-roles users can assign approvers" + return False, "Forbidden Error" def can_update_paf_status(user, project, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if not project.paf_approvals.filter(approved=False).exists(): - return False, 'No PAF Approvals Exists' + return False, "No PAF Approvals Exists" if project.status != INTERNAL_APPROVAL: - return False, 'Incorrect project status to approve PAF' + return False, "Incorrect project status to approve PAF" - request = kwargs.get('request') + request = kwargs.get("request") if request: project_settings = ProjectSettings.for_request(request) if project_settings.paf_approval_sequential: approval = project.paf_approvals.filter(approved=False).first() - possible_approvers_ids = [role_user.id for role_user in get_users_for_groups( - list(approval.paf_reviewer_role.user_roles.all()), exact_match=True)] + possible_approvers_ids = [ + role_user.id + for role_user in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), exact_match=True + ) + ] if user.id in possible_approvers_ids: - return True, 'Next approval group users can approve PAF(For Sequential Approvals)' - return False, 'Only Next approval group can approve PAF(For Sequential Approvals)' + return ( + True, + "Next approval group users can approve PAF(For Sequential Approvals)", + ) + return ( + False, + "Only Next approval group can approve PAF(For Sequential Approvals)", + ) else: possible_approvers_ids = [] for approval in project.paf_approvals.filter(approved=False): - possible_approvers_ids.extend([role_user.id for role_user in get_users_for_groups( - list(approval.paf_reviewer_role.user_roles.all()), exact_match=True)]) + possible_approvers_ids.extend( + [ + role_user.id + for role_user in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ) + ] + ) if user.id in possible_approvers_ids: - return True, 'All approval group users can approve PAF(For Parallel Approvals)' - return False, 'Only approval group users can approve PAF(For Parallel Approvals)' + return ( + True, + "All approval group users can approve PAF(For Parallel Approvals)", + ) + return ( + False, + "Only approval group users can approve PAF(For Parallel Approvals)", + ) - return False, 'Forbidden Error' + return False, "Forbidden Error" def can_update_project_status(user, project, **kwargs): if project.status not in [COMPLETE, CLOSING, INVOICING_AND_REPORTING]: - return False, 'Forbidden Error' + return False, "Forbidden Error" if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if user.is_apply_staff or user.is_apply_staff_admin: - return True, 'Staff and Staff Admin can update status' + return True, "Staff and Staff Admin can update status" - return False, 'Forbidden Error' + return False, "Forbidden Error" def can_update_report(user, report, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if report.project.status != INVOICING_AND_REPORTING: - return False, 'Report can be updated only in Invoicing and reporting state' + return False, "Report can be updated only in Invoicing and reporting state" if report.skipped: - return False, 'Skipped reports are not editable' + return False, "Skipped reports are not editable" if not report.can_submit: - return False, 'Future reports are not editable' + return False, "Future reports are not editable" if user.is_apply_staff or (user == report.project.user and not report.current): - return True, 'Staff and Project Owner can edit the editable reports' + return True, "Staff and Project Owner can edit the editable reports" - return False, 'Forbidden Error' + return False, "Forbidden Error" def can_update_report_config(user, project, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if project.status != INVOICING_AND_REPORTING: - return False, 'Report Config can be changed only in Invoicing and reporting state' + return ( + False, + "Report Config can be changed only in Invoicing and reporting state", + ) if user.is_apply_staff: - return True, 'Only Staff can update report config for Invoicing and reporting projects' - return False, 'Forbidden Error' + return ( + True, + "Only Staff can update report config for Invoicing and reporting projects", + ) + return False, "Forbidden Error" def can_update_project_reports(user, project, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if project.status != INVOICING_AND_REPORTING: - return False, 'Report Config can be changed only in Invoicing and reporting state' + return ( + False, + "Report Config can be changed only in Invoicing and reporting state", + ) if user.is_apply_staff or user == project.user: - return True, 'Only Staff and project owner can update report config for Invoicing and reporting projects' - return False, 'Forbidden Error' + return ( + True, + "Only Staff and project owner can update report config for Invoicing and reporting projects", + ) + return False, "Forbidden Error" def can_view_report(user, report, **kwargs): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if report.project.status not in [COMPLETE, CLOSING, INVOICING_AND_REPORTING]: - return False, 'Report are not available at this state' + return False, "Report are not available at this state" if not report.current: - return False, 'Only current reports can be viewed' + return False, "Only current reports can be viewed" if report.skipped: - return False, 'Skipped reports are not available' + return False, "Skipped reports are not available" if user.is_apply_staff or user.is_finance or user == report.project.user: - return True, 'Staff, Finance, and Project owner can view the report' - return False, 'Forbidden Error' + return True, "Staff, Finance, and Project owner can view the report" + return False, "Forbidden Error" def can_access_project(user, project): if not user.is_authenticated: - return False, 'Login Required' + return False, "Login Required" if user.is_apply_staff or user.is_finance or user.is_contracting: # Staff, Finance and Contracting are internal and trusted peoples, # Their action are limited, but they can view all projects. - return True, 'Staff, Finance and Contracting can view project in all statuses' + return True, "Staff, Finance and Contracting can view project in all statuses" if user.is_applicant and user == project.user: - return True, 'Vendor(project user) can view project in all statuses' + return True, "Vendor(project user) can view project in all statuses" - if project.status in [DRAFT, INTERNAL_APPROVAL, CONTRACTING] and project.paf_approvals.exists(): + if ( + project.status in [DRAFT, INTERNAL_APPROVAL, CONTRACTING] + and project.paf_approvals.exists() + ): paf_reviewer_roles_users_ids = [] for approval in project.paf_approvals.all(): - paf_reviewer_roles_users_ids.extend([role_user.id for role_user in get_users_for_groups( - list(approval.paf_reviewer_role.user_roles.all()), exact_match=True)]) + paf_reviewer_roles_users_ids.extend( + [ + role_user.id + for role_user in get_users_for_groups( + list(approval.paf_reviewer_role.user_roles.all()), + exact_match=True, + ) + ] + ) if user.id in paf_reviewer_roles_users_ids: - return True, 'PAF Approvers can access the project in Draft, Approval state and after approval state' + return ( + True, + "PAF Approvers can access the project in Draft, Approval state and after approval state", + ) - return False, 'Forbidden Error' + return False, "Forbidden Error" permissions_map = { - 'contract_approve': can_approve_contract, - 'contract_upload': can_upload_contract, - 'paf_status_update': can_update_paf_status, - 'paf_approvers_update': can_update_paf_approvers, - 'paf_approvers_assign': can_assign_paf_approvers, - 'update_paf_assigned_approvers': can_update_assigned_paf_approvers, # Permission for UpdateAssignApproversView - 'project_status_update': can_update_project_status, - 'project_reports_update': can_update_project_reports, - 'report_update': can_update_report, - 'report_config_update': can_update_report_config, - 'report_view': can_view_report, - 'submit_contract_documents': can_submit_contract_documents, - 'project_access': can_access_project, + "contract_approve": can_approve_contract, + "contract_upload": can_upload_contract, + "paf_status_update": can_update_paf_status, + "paf_approvers_update": can_update_paf_approvers, + "paf_approvers_assign": can_assign_paf_approvers, + "update_paf_assigned_approvers": can_update_assigned_paf_approvers, # Permission for UpdateAssignApproversView + "project_status_update": can_update_project_status, + "project_reports_update": can_update_project_reports, + "report_update": can_update_report, + "report_config_update": can_update_report_config, + "report_view": can_view_report, + "submit_contract_documents": can_submit_contract_documents, + "project_access": can_access_project, } diff --git a/hypha/apply/projects/services/sageintacct/__init__.py b/hypha/apply/projects/services/sageintacct/__init__.py index ecc225b1cb..159af5c2d0 100644 --- a/hypha/apply/projects/services/sageintacct/__init__.py +++ b/hypha/apply/projects/services/sageintacct/__init__.py @@ -13,14 +13,14 @@ from .sageintacctsdk import SageIntacctSDK __all__ = [ - 'SageIntacctSDK', - 'SageIntacctSDKError', - 'ExpiredTokenError', - 'InvalidTokenError', - 'NoPrivilegeError', - 'WrongParamsError', - 'NotFoundItemError', - 'InternalServerError' + "SageIntacctSDK", + "SageIntacctSDKError", + "ExpiredTokenError", + "InvalidTokenError", + "NoPrivilegeError", + "WrongParamsError", + "NotFoundItemError", + "InternalServerError", ] name = "sageintacctsdk" diff --git a/hypha/apply/projects/services/sageintacct/exceptions.py b/hypha/apply/projects/services/sageintacct/exceptions.py index e396902a8e..7d64be8a59 100644 --- a/hypha/apply/projects/services/sageintacct/exceptions.py +++ b/hypha/apply/projects/services/sageintacct/exceptions.py @@ -18,10 +18,10 @@ def __str__(self): class SageIntacctSDKWarning(Warning): """The base Warning class for SageIntacctSDK. - Parameters: - msg (str): Short description of the alert. - response: Error response from the API call. - """ + Parameters: + msg (str): Short description of the alert. + response: Error response from the API call. + """ def __init__(self, msg, response=None): super(SageIntacctSDKWarning, self).__init__(msg) diff --git a/hypha/apply/projects/services/sageintacct/sageintacctsdk.py b/hypha/apply/projects/services/sageintacct/sageintacctsdk.py index 6eed63df5a..bf6a8cf118 100644 --- a/hypha/apply/projects/services/sageintacct/sageintacctsdk.py +++ b/hypha/apply/projects/services/sageintacct/sageintacctsdk.py @@ -7,9 +7,13 @@ class SageIntacctSDK: """ def __init__( - self, sender_id: str, sender_password: str, - user_id: str, company_id: str, user_password: str, - entity_id: str = None + self, + sender_id: str, + sender_password: str, + user_id: str, + company_id: str, + user_password: str, + entity_id: str = None, ): """ Initialize connection to Sage Intacct @@ -59,10 +63,7 @@ def update_session_id(self): Update the session id and change it in all API objects. """ self.__session_id = self.api_base.get_session_id( - self.__user_id, - self.__company_id, - self.__user_password, - self.__entity_id + self.__user_id, self.__company_id, self.__user_password, self.__entity_id ) self.api_base.set_session_id(self.__session_id) self.purchasing.set_session_id(self.__session_id) diff --git a/hypha/apply/projects/services/sageintacct/utils.py b/hypha/apply/projects/services/sageintacct/utils.py index 6adc4ecce8..15a2d85c65 100644 --- a/hypha/apply/projects/services/sageintacct/utils.py +++ b/hypha/apply/projects/services/sageintacct/utils.py @@ -6,23 +6,23 @@ from .sageintacctsdk import SageIntacctSDK -def fetch_deliverables(program_project_id=''): - ''' +def fetch_deliverables(program_project_id=""): + """ Fetch deliverables from IntAcct using the program project id(DEPARTMENTID). Returns a list of deliverables or an empty list. Also logs any error that occurred during the API call. - ''' + """ if not program_project_id: return [] formatted_filter = { - 'and': { - 'equalto': [ - {'field': 'DOCPARID', 'value': 'Project Contract'}, - {'field': 'DEPARTMENTID', 'value': program_project_id} + "and": { + "equalto": [ + {"field": "DOCPARID", "value": "Project Contract"}, + {"field": "DEPARTMENTID", "value": program_project_id}, ], - 'greaterthan': {'field': 'QTY_REMAINING', 'value': 0.0} + "greaterthan": {"field": "QTY_REMAINING", "value": 0.0}, } } @@ -32,7 +32,7 @@ def fetch_deliverables(program_project_id=''): sender_password=settings.INTACCT_SENDER_PASSWORD, user_id=settings.INTACCT_USER_ID, company_id=settings.INTACCT_COMPANY_ID, - user_password=settings.INTACCT_USER_PASSWORD + user_password=settings.INTACCT_USER_PASSWORD, ) except Exception as e: logging.error(e) @@ -43,11 +43,11 @@ def fetch_deliverables(program_project_id=''): def get_deliverables_json(invoice): - ''' + """ Get a json format of deliverables attached to the invoice. Used when creating invoice in IntAcct. - ''' + """ deliverables = invoice.deliverables.all() deliverables_list = [] for deliverable in deliverables: @@ -55,16 +55,16 @@ def get_deliverables_json(invoice): extra_info = project_deliverable.extra_information deliverables_list.append( { - 'itemid': project_deliverable.external_id, - 'quantity': deliverable.quantity, - 'unit': extra_info['UNIT'], - 'price': project_deliverable.unit_price, - 'locationid': extra_info['LOCATIONID'], - 'departmentid': extra_info['DEPARTMENTID'], - 'projectid': extra_info['PROJECTID'], - 'customerid': extra_info['CUSTOMERID'], - 'classid': extra_info['CLASSID'], - 'billable': extra_info['BILLABLE'], + "itemid": project_deliverable.external_id, + "quantity": deliverable.quantity, + "unit": extra_info["UNIT"], + "price": project_deliverable.unit_price, + "locationid": extra_info["LOCATIONID"], + "departmentid": extra_info["DEPARTMENTID"], + "projectid": extra_info["PROJECTID"], + "customerid": extra_info["CUSTOMERID"], + "classid": extra_info["CLASSID"], + "billable": extra_info["BILLABLE"], } ) return deliverables_list @@ -81,11 +81,11 @@ def create_intacct_invoice(invoice): project = invoice.project external_project_information = project.external_project_information external_projectid = project.external_projectid - transactiontype = 'Contract Invoice Release' + transactiontype = "Contract Invoice Release" date_created = invoice.requested_at - createdfrom = external_project_information['DOCPARID'] + '-' + external_projectid - vendorid = external_project_information['CUSTVENDID'] - referenceno = external_project_information['PONUMBER'] + createdfrom = external_project_information["DOCPARID"] + "-" + external_projectid + vendorid = external_project_information["CUSTVENDID"] + referenceno = external_project_information["PONUMBER"] project.created_at + timedelta(days=20) datedue = date_created + timedelta(days=20) contract_start_date = project.proposed_start @@ -93,42 +93,36 @@ def create_intacct_invoice(invoice): deliverables = get_deliverables_json(invoice) vendordocno = invoice.vendor_document_number data = { - 'transactiontype': transactiontype, - 'datecreated': { - 'year': date_created.year, - 'month': date_created.month, - 'day': date_created.day, - }, - 'createdfrom': createdfrom, - 'vendorid': vendorid, - 'referenceno': referenceno, - 'vendordocno': vendordocno, - 'datedue': { - 'year': datedue.year, - 'month': datedue.month, - 'day': datedue.day, - }, - 'returnto': { - 'contactname': '' + "transactiontype": transactiontype, + "datecreated": { + "year": date_created.year, + "month": date_created.month, + "day": date_created.day, }, - 'payto': { - 'contactname': '' + "createdfrom": createdfrom, + "vendorid": vendorid, + "referenceno": referenceno, + "vendordocno": vendordocno, + "datedue": { + "year": datedue.year, + "month": datedue.month, + "day": datedue.day, }, - 'customfields': { - 'customfield': [ + "returnto": {"contactname": ""}, + "payto": {"contactname": ""}, + "customfields": { + "customfield": [ { - 'customfieldname': 'CONTRACT_START_DATE', - 'customfieldvalue': f'{contract_start_date.month}/{contract_start_date.day}/{contract_start_date.year}' + "customfieldname": "CONTRACT_START_DATE", + "customfieldvalue": f"{contract_start_date.month}/{contract_start_date.day}/{contract_start_date.year}", }, { - 'customfieldname': 'CONTRACT_END_DATE', - 'customfieldvalue': f'{contract_end_date.month}/{contract_end_date.day}/{contract_end_date.year}' - } + "customfieldname": "CONTRACT_END_DATE", + "customfieldvalue": f"{contract_end_date.month}/{contract_end_date.day}/{contract_end_date.year}", + }, ] }, - 'potransitems': { - 'potransitem': deliverables - } + "potransitems": {"potransitem": deliverables}, } try: connection = SageIntacctSDK( @@ -136,7 +130,7 @@ def create_intacct_invoice(invoice): sender_password=settings.INTACCT_SENDER_PASSWORD, user_id=settings.INTACCT_USER_ID, company_id=settings.INTACCT_COMPANY_ID, - user_password=settings.INTACCT_USER_PASSWORD + user_password=settings.INTACCT_USER_PASSWORD, ) except Exception as e: logging.error(e) @@ -146,14 +140,12 @@ def create_intacct_invoice(invoice): def fetch_project_details(external_projectid): - ''' + """ Fetch detail of a project contract from IntAcct. These details will be further used to fetch deliverables and create invoices. - ''' - formatted_filter = { - 'equalto': {'field': 'DOCNO', 'value': external_projectid} - } + """ + formatted_filter = {"equalto": {"field": "DOCNO", "value": external_projectid}} try: connection = SageIntacctSDK( @@ -161,7 +153,7 @@ def fetch_project_details(external_projectid): sender_password=settings.INTACCT_SENDER_PASSWORD, user_id=settings.INTACCT_USER_ID, company_id=settings.INTACCT_COMPANY_ID, - user_password=settings.INTACCT_USER_PASSWORD + user_password=settings.INTACCT_USER_PASSWORD, ) except Exception as e: logging.error(e) diff --git a/hypha/apply/projects/services/sageintacct/wrapper/__init__.py b/hypha/apply/projects/services/sageintacct/wrapper/__init__.py index 10e4a384b3..4af59e24f8 100644 --- a/hypha/apply/projects/services/sageintacct/wrapper/__init__.py +++ b/hypha/apply/projects/services/sageintacct/wrapper/__init__.py @@ -4,8 +4,8 @@ from .purchasing import Purchasing __all__ = [ - 'ApiBase', - 'Purchasing', - 'Invoice', - 'Project', + "ApiBase", + "Purchasing", + "Invoice", + "Project", ] diff --git a/hypha/apply/projects/services/sageintacct/wrapper/api_base.py b/hypha/apply/projects/services/sageintacct/wrapper/api_base.py index 67f0e2b215..d0e8867a70 100644 --- a/hypha/apply/projects/services/sageintacct/wrapper/api_base.py +++ b/hypha/apply/projects/services/sageintacct/wrapper/api_base.py @@ -25,11 +25,16 @@ class ApiBase: """The base class for all API classes.""" - def __init__(self, dimension: str = None, pagesize: int = 2000, post_legacy_method: str = None): + def __init__( + self, + dimension: str = None, + pagesize: int = 2000, + post_legacy_method: str = None, + ): self.__sender_id = None self.__sender_password = None self.__session_id = None - self.__api_url = 'https://api.intacct.com/ia/xml/xmlgw.phtml' + self.__api_url = "https://api.intacct.com/ia/xml/xmlgw.phtml" self.__dimension = dimension self.__pagesize = pagesize self.__post_legacy_method = post_legacy_method @@ -50,7 +55,9 @@ def set_sender_password(self, sender_password: str): """ self.__sender_password = sender_password - def get_session_id(self, user_id: str, company_id: str, user_password: str, entity_id: str = None): + def get_session_id( + self, user_id: str, company_id: str, user_password: str, entity_id: str = None + ): """ Sets the session id for APIs :param access_token: acceess token (JWT) @@ -59,45 +66,45 @@ def get_session_id(self, user_id: str, company_id: str, user_password: str, enti timestamp = datetime.datetime.now() dict_body = { - 'request': { - 'control': { - 'senderid': self.__sender_id, - 'password': self.__sender_password, - 'controlid': timestamp, - 'uniqueid': False, - 'dtdversion': 3.0, - 'includewhitespace': False + "request": { + "control": { + "senderid": self.__sender_id, + "password": self.__sender_password, + "controlid": timestamp, + "uniqueid": False, + "dtdversion": 3.0, + "includewhitespace": False, }, - 'operation': { - 'authentication': { - 'login': { - 'userid': user_id, - 'companyid': company_id, - 'password': user_password, - 'locationid': entity_id + "operation": { + "authentication": { + "login": { + "userid": user_id, + "companyid": company_id, + "password": user_password, + "locationid": entity_id, } }, - 'content': { - 'function': { - '@controlid': str(uuid.uuid4()), - 'getAPISession': None + "content": { + "function": { + "@controlid": str(uuid.uuid4()), + "getAPISession": None, } - } - } + }, + }, } } response = self.__post_request(dict_body, self.__api_url) - if response['authentication']['status'] == 'success': - session_details = response['result']['data']['api'] - self.__api_url = session_details['endpoint'] - self.__session_id = session_details['sessionid'] + if response["authentication"]["status"] == "success": + session_details = response["result"]["data"]["api"] + self.__api_url = session_details["endpoint"] + self.__session_id = session_details["sessionid"] return self.__session_id else: - raise SageIntacctSDKError('Error: {0}'.format(response['errormessage'])) + raise SageIntacctSDKError("Error: {0}".format(response["errormessage"])) def set_session_id(self, session_id: str): """ @@ -117,12 +124,12 @@ def __support_id_msg(self, errormessages): Error message assignment and type. """ error = {} - if isinstance(errormessages['error'], list): - error['error'] = errormessages['error'][0] - error['type'] = 'list' - elif isinstance(errormessages['error'], dict): - error['error'] = errormessages['error'] - error['type'] = 'dict' + if isinstance(errormessages["error"], list): + error["error"] = errormessages["error"][0] + error["type"] = "list" + elif isinstance(errormessages["error"], dict): + error["error"] = errormessages["error"] + error["type"] = "dict" return error @@ -136,20 +143,20 @@ def __decode_support_id(self, errormessages): Same error message with decoded Support ID. """ support_id_msg = self.__support_id_msg(errormessages) - data_type = support_id_msg['type'] - error = support_id_msg['error'] - if (error and error['description2']): - message = error['description2'] - support_id = re.search('Support ID: (.*)]', message) + data_type = support_id_msg["type"] + error = support_id_msg["error"] + if error and error["description2"]: + message = error["description2"] + support_id = re.search("Support ID: (.*)]", message) if support_id.group(1): decoded_support_id = unquote(support_id.group(1)) message = message.replace(support_id.group(1), decoded_support_id) # Converting dict to list even for single error response - if data_type == 'dict': - errormessages['error'] = [errormessages['error']] + if data_type == "dict": + errormessages["error"] = [errormessages["error"]] - errormessages['error'][0]['description2'] = message if message else None + errormessages["error"][0]["description2"] = message if message else None return errormessages @@ -164,9 +171,7 @@ def __post_request(self, dict_body: dict, api_url: str): A response from the request (dict). """ - api_headers = { - 'content-type': 'application/xml' - } + api_headers = {"content-type": "application/xml"} body = xmltodict.unparse(dict_body) response = requests.post(api_url, headers=api_headers, data=body) @@ -175,47 +180,69 @@ def __post_request(self, dict_body: dict, api_url: str): parsed_response = json.loads(json.dumps(parsed_xml)) if response.status_code == 200: - if parsed_response['response']['control']['status'] == 'success': - api_response = parsed_response['response']['operation'] - - if parsed_response['response']['control']['status'] == 'failure': - exception_msg = self.__decode_support_id(parsed_response['response']['errormessage']) - raise WrongParamsError('Some of the parameters are wrong', exception_msg) - - if api_response['authentication']['status'] == 'failure': - raise InvalidTokenError('Invalid token / Incorrect credentials', api_response['errormessage']) - - if api_response['result']['status'] == 'success': + if parsed_response["response"]["control"]["status"] == "success": + api_response = parsed_response["response"]["operation"] + + if parsed_response["response"]["control"]["status"] == "failure": + exception_msg = self.__decode_support_id( + parsed_response["response"]["errormessage"] + ) + raise WrongParamsError( + "Some of the parameters are wrong", exception_msg + ) + + if api_response["authentication"]["status"] == "failure": + raise InvalidTokenError( + "Invalid token / Incorrect credentials", + api_response["errormessage"], + ) + + if api_response["result"]["status"] == "success": return api_response - if api_response['result']['status'] == 'failure': - exception_msg = self.__decode_support_id(api_response['result']['errormessage']) - - for error in exception_msg['error']: - if error['description2'] and 'You do not have permission for API' in error['description2']: - raise InvalidTokenError('The user has insufficient privilege', exception_msg) - - raise WrongParamsError('Error during {0}'.format(api_response['result']['function']), exception_msg) + if api_response["result"]["status"] == "failure": + exception_msg = self.__decode_support_id( + api_response["result"]["errormessage"] + ) + + for error in exception_msg["error"]: + if ( + error["description2"] + and "You do not have permission for API" + in error["description2"] + ): + raise InvalidTokenError( + "The user has insufficient privilege", exception_msg + ) + + raise WrongParamsError( + "Error during {0}".format(api_response["result"]["function"]), + exception_msg, + ) if response.status_code == 400: - raise WrongParamsError('Some of the parameters are wrong', parsed_response) + raise WrongParamsError("Some of the parameters are wrong", parsed_response) if response.status_code == 401: - raise InvalidTokenError('Invalid token / Incorrect credentials', parsed_response) + raise InvalidTokenError( + "Invalid token / Incorrect credentials", parsed_response + ) if response.status_code == 403: - raise NoPrivilegeError('Forbidden, the user has insufficient privilege', parsed_response) + raise NoPrivilegeError( + "Forbidden, the user has insufficient privilege", parsed_response + ) if response.status_code == 404: - raise NotFoundItemError('Not found item with ID', parsed_response) + raise NotFoundItemError("Not found item with ID", parsed_response) if response.status_code == 498: - raise ExpiredTokenError('Expired token, try to refresh it', parsed_response) + raise ExpiredTokenError("Expired token, try to refresh it", parsed_response) if response.status_code == 500: - raise InternalServerError('Internal server error', parsed_response) + raise InternalServerError("Internal server error", parsed_response) - raise SageIntacctSDKError('Error: {0}'.format(parsed_response)) + raise SageIntacctSDKError("Error: {0}".format(parsed_response)) def format_and_send_request(self, data: Dict): """Format data accordingly to convert them to xml. @@ -231,67 +258,54 @@ def format_and_send_request(self, data: Dict): timestamp = datetime.datetime.now() dict_body = { - 'request': { - 'control': { - 'senderid': self.__sender_id, - 'password': self.__sender_password, - 'controlid': timestamp, - 'uniqueid': False, - 'dtdversion': 3.0, - 'includewhitespace': False + "request": { + "control": { + "senderid": self.__sender_id, + "password": self.__sender_password, + "controlid": timestamp, + "uniqueid": False, + "dtdversion": 3.0, + "includewhitespace": False, }, - 'operation': { - 'authentication': { - 'sessionid': self.__session_id + "operation": { + "authentication": {"sessionid": self.__session_id}, + "content": { + "function": {"@controlid": str(uuid.uuid4()), key: data[key]} }, - 'content': { - 'function': { - '@controlid': str(uuid.uuid4()), - key: data[key] - } - } - } + }, } } response = self.__post_request(dict_body, self.__api_url) - return response['result'] + return response["result"] def post(self, data: Dict): - if self.__dimension in ('CCTRANSACTION', 'EPPAYMENT'): + if self.__dimension in ("CCTRANSACTION", "EPPAYMENT"): return self.__construct_post_legacy_payload(data) return self.__construct_post_payload(data) def __construct_post_payload(self, data: Dict): - payload = { - 'create': { - self.__dimension: data - } - } + payload = {"create": {self.__dimension: data}} return self.format_and_send_request(payload) def __construct_post_legacy_payload(self, data: Dict): - payload = { - self.__post_legacy_method: data - } + payload = {self.__post_legacy_method: data} return self.format_and_send_request(payload) def count(self): get_count = { - 'query': { - 'object': self.__dimension, - 'select': { - 'field': 'RECORDNO' - }, - 'pagesize': '1' + "query": { + "object": self.__dimension, + "select": {"field": "RECORDNO"}, + "pagesize": "1", } } response = self.format_and_send_request(get_count) - return int(response['data']['@totalcount']) + return int(response["data"]["@totalcount"]) def read_by_query(self, fields: list = None): """Read by Query from Sage Intacct @@ -303,11 +317,11 @@ def read_by_query(self, fields: list = None): Dict. """ payload = { - 'readByQuery': { - 'object': self.__dimension, - 'fields': ','.join(fields) if fields else '*', - 'query': None, - 'pagesize': '1000' + "readByQuery": { + "object": self.__dimension, + "fields": ",".join(fields) if fields else "*", + "query": None, + "pagesize": "1000", } } @@ -324,15 +338,15 @@ def get(self, field: str, value: str, fields: list = None): Dict. """ data = { - 'readByQuery': { - 'object': self.__dimension, - 'fields': ','.join(fields) if fields else '*', - 'query': "{0} = '{1}'".format(field, value), - 'pagesize': '1000' + "readByQuery": { + "object": self.__dimension, + "fields": ",".join(fields) if fields else "*", + "query": "{0} = '{1}'".format(field, value), + "pagesize": "1000", } } - return self.format_and_send_request(data)['data'] + return self.format_and_send_request(data)["data"] def get_all(self, field: str = None, value: str = None, fields: list = None): """Get all data from Sage Intacct @@ -345,35 +359,37 @@ def get_all(self, field: str = None, value: str = None, fields: list = None): pagesize = self.__pagesize for offset in range(0, count, pagesize): data = { - 'query': { - 'object': self.__dimension, - 'select': { - 'field': fields if fields else dimensions_fields_mapping[self.__dimension] + "query": { + "object": self.__dimension, + "select": { + "field": fields + if fields + else dimensions_fields_mapping[self.__dimension] }, - 'pagesize': pagesize, - 'offset': offset + "pagesize": pagesize, + "offset": offset, } } if field and value: - data['query']['filter'] = { - 'equalto': { - 'field': field, - 'value': value - } - } + data["query"]["filter"] = {"equalto": {"field": field, "value": value}} - paginated_data = self.format_and_send_request(data)['data'][self.__dimension] + paginated_data = self.format_and_send_request(data)["data"][ + self.__dimension + ] complete_data.extend(paginated_data) return complete_data __query_filter = List[Tuple[str, str, str]] - def get_by_query(self, fields: List[str] = None, - and_filter: __query_filter = None, - or_filter: __query_filter = None, - filter_payload: dict = None): + def get_by_query( + self, + fields: List[str] = None, + and_filter: __query_filter = None, + or_filter: __query_filter = None, + filter_payload: dict = None, + ): """Get data from Sage Intacct using query method based on filter. See sage intacct documentation here for query structures: @@ -390,7 +406,7 @@ def get_by_query(self, fields: List[str] = None, Returns: Dict. - """ + """ complete_data = [] count = self.count() @@ -398,68 +414,82 @@ def get_by_query(self, fields: List[str] = None, offset = 0 formatted_filter = filter_payload data = { - 'query': { - 'object': self.__dimension, - 'select': { - 'field': fields if fields else dimensions_fields_mapping[self.__dimension] + "query": { + "object": self.__dimension, + "select": { + "field": fields + if fields + else dimensions_fields_mapping[self.__dimension] }, - 'pagesize': pagesize, - 'offset': offset + "pagesize": pagesize, + "offset": offset, } } if and_filter and or_filter: - formatted_filter = {'and': {}} + formatted_filter = {"and": {}} for operator, field, value in and_filter: - formatted_filter['and'].setdefault(operator, {}).update({'field': field, 'value': value}) - formatted_filter['and']['or'] = {} + formatted_filter["and"].setdefault(operator, {}).update( + {"field": field, "value": value} + ) + formatted_filter["and"]["or"] = {} for operator, field, value in or_filter: - formatted_filter['and']['or'].setdefault(operator, {}).update({'field': field, 'value': value}) + formatted_filter["and"]["or"].setdefault(operator, {}).update( + {"field": field, "value": value} + ) elif and_filter: if len(and_filter) > 1: - formatted_filter = {'and': {}} + formatted_filter = {"and": {}} for operator, field, value in and_filter: - formatted_filter['and'].setdefault(operator, {}).update({'field': field, 'value': value}) + formatted_filter["and"].setdefault(operator, {}).update( + {"field": field, "value": value} + ) else: formatted_filter = {} for operator, field, value in and_filter: - formatted_filter.setdefault(operator, {}).update({'field': field, 'value': value}) + formatted_filter.setdefault(operator, {}).update( + {"field": field, "value": value} + ) elif or_filter: if len(or_filter) > 1: - formatted_filter = {'or': {}} + formatted_filter = {"or": {}} for operator, field, value in or_filter: - formatted_filter['or'].setdefault(operator, {}).update({'field': field, 'value': value}) + formatted_filter["or"].setdefault(operator, {}).update( + {"field": field, "value": value} + ) else: formatted_filter = {} for operator, field, value in or_filter: - formatted_filter.setdefault(operator, {}).update({'field': field, 'value': value}) + formatted_filter.setdefault(operator, {}).update( + {"field": field, "value": value} + ) if formatted_filter: - data['query']['filter'] = formatted_filter + data["query"]["filter"] = formatted_filter for offset in range(0, count, pagesize): - data['query']['offset'] = offset - paginated_data = self.format_and_send_request(data)['data'] + data["query"]["offset"] = offset + paginated_data = self.format_and_send_request(data)["data"] complete_data.extend(paginated_data[self.__dimension]) - filtered_total = int(paginated_data['@totalcount']) - if paginated_data['@numremaining'] == '0': + filtered_total = int(paginated_data["@totalcount"]) + if paginated_data["@numremaining"] == "0": break if filtered_total != len(complete_data): warn( - message='Your data may not be complete. Records returned do not equal total query record count', + message="Your data may not be complete. Records returned do not equal total query record count", category=DataIntegrityWarning, - stacklevel=2 + stacklevel=2, ) return complete_data def get_lookup(self): - """ Returns all fields with attributes from the object called on. + """Returns all fields with attributes from the object called on. - Parameters: - self - Returns: - Dict. + Parameters: + self + Returns: + Dict. """ - data = {'lookup': {'object': self.__dimension}} - return self.format_and_send_request(data)['data'] + data = {"lookup": {"object": self.__dimension}} + return self.format_and_send_request(data)["data"] diff --git a/hypha/apply/projects/services/sageintacct/wrapper/constants.py b/hypha/apply/projects/services/sageintacct/wrapper/constants.py index 865e6c77b6..8df5562610 100644 --- a/hypha/apply/projects/services/sageintacct/wrapper/constants.py +++ b/hypha/apply/projects/services/sageintacct/wrapper/constants.py @@ -1,22 +1,17 @@ dimensions_fields_mapping = { - 'PODOCUMENTENTRY': [ - 'ITEMID', - 'ITEMNAME', - 'ITEMDESC', - 'QTY_REMAINING', - 'UNIT', - 'PRICE', - 'PROJECTID', - 'LOCATIONID', - 'CLASSID', - 'BILLABLE', - 'DEPARTMENTID', - 'CUSTOMERID', + "PODOCUMENTENTRY": [ + "ITEMID", + "ITEMNAME", + "ITEMDESC", + "QTY_REMAINING", + "UNIT", + "PRICE", + "PROJECTID", + "LOCATIONID", + "CLASSID", + "BILLABLE", + "DEPARTMENTID", + "CUSTOMERID", ], - 'PODOCUMENT': [ - 'DOCNO', - 'DOCPARID', - 'PONUMBER', - 'CUSTVENDID' - ] + "PODOCUMENT": ["DOCNO", "DOCPARID", "PONUMBER", "CUSTVENDID"], } diff --git a/hypha/apply/projects/services/sageintacct/wrapper/invoice.py b/hypha/apply/projects/services/sageintacct/wrapper/invoice.py index 81a9c8fc3e..7fba7db6bd 100644 --- a/hypha/apply/projects/services/sageintacct/wrapper/invoice.py +++ b/hypha/apply/projects/services/sageintacct/wrapper/invoice.py @@ -5,7 +5,5 @@ class Invoice(ApiBase): """Class to create Contract Invoice Release at Sage IntAcct.""" def post(self, data: dict): - data = { - 'create_potransaction': data - } + data = {"create_potransaction": data} return self.format_and_send_request(data) diff --git a/hypha/apply/projects/services/sageintacct/wrapper/project.py b/hypha/apply/projects/services/sageintacct/wrapper/project.py index 96387eecd0..3664c57d03 100644 --- a/hypha/apply/projects/services/sageintacct/wrapper/project.py +++ b/hypha/apply/projects/services/sageintacct/wrapper/project.py @@ -1,4 +1,3 @@ - """ Sage Intacct contract """ @@ -7,5 +6,6 @@ class Project(ApiBase): """Class for contract APIs.""" + def __init__(self): - ApiBase.__init__(self, dimension='PODOCUMENT') + ApiBase.__init__(self, dimension="PODOCUMENT") diff --git a/hypha/apply/projects/services/sageintacct/wrapper/purchasing.py b/hypha/apply/projects/services/sageintacct/wrapper/purchasing.py index 628169d689..d6e7f4da46 100644 --- a/hypha/apply/projects/services/sageintacct/wrapper/purchasing.py +++ b/hypha/apply/projects/services/sageintacct/wrapper/purchasing.py @@ -1,4 +1,3 @@ - """ Sage Intacct purchasing """ @@ -7,5 +6,6 @@ class Purchasing(ApiBase): """Class for Purchasing APIs.""" + def __init__(self): - ApiBase.__init__(self, dimension='PODOCUMENTENTRY') + ApiBase.__init__(self, dimension="PODOCUMENTENTRY") diff --git a/hypha/apply/projects/tables.py b/hypha/apply/projects/tables.py index ae5e2beb11..97e177d3f0 100644 --- a/hypha/apply/projects/tables.py +++ b/hypha/apply/projects/tables.py @@ -9,136 +9,137 @@ class BaseInvoiceTable(tables.Table): vendor_document_number = tables.LinkColumn( - 'funds:projects:invoice-detail', - verbose_name=_('Invoice Number'), - args=[tables.utils.A('project__pk'), tables.utils.A('pk')], - ) - project = tables.Column( - verbose_name=_('Project Name') + "funds:projects:invoice-detail", + verbose_name=_("Invoice Number"), + args=[tables.utils.A("project__pk"), tables.utils.A("pk")], ) + project = tables.Column(verbose_name=_("Project Name")) status = tables.Column() - requested_at = tables.DateColumn(verbose_name=_('Submitted')) + requested_at = tables.DateColumn(verbose_name=_("Submitted")) def render_project(self, value): - text = textwrap.shorten(value.title, width=30, placeholder="..."), + text = (textwrap.shorten(value.title, width=30, placeholder="..."),) return text[0] class InvoiceDashboardTable(BaseInvoiceTable): class Meta: fields = [ - 'requested_at', - 'invoice_number', - 'status', - 'project', + "requested_at", + "invoice_number", + "status", + "project", ] model = Invoice - order_by = ['-requested_at'] - attrs = {'class': 'invoices-table'} + order_by = ["-requested_at"] + attrs = {"class": "invoices-table"} class InvoiceListTable(BaseInvoiceTable): - fund = tables.Column(verbose_name=_('Fund'), accessor='project__submission__page') - lead = tables.Column(verbose_name=_('Lead'), accessor='project__lead') + fund = tables.Column(verbose_name=_("Fund"), accessor="project__submission__page") + lead = tables.Column(verbose_name=_("Lead"), accessor="project__lead") class Meta: fields = [ - 'requested_at', - 'invoice_number', - 'status', - 'project', - 'lead', - 'fund', + "requested_at", + "invoice_number", + "status", + "project", + "lead", + "fund", ] model = Invoice orderable = True - order_by = ['-requested_at'] - attrs = {'class': 'invoices-table'} + order_by = ["-requested_at"] + attrs = {"class": "invoices-table"} class BaseProjectsTable(tables.Table): title = tables.LinkColumn( - 'funds:projects:detail', + "funds:projects:detail", text=lambda r: textwrap.shorten(r.title, width=30, placeholder="..."), - args=[tables.utils.A('pk')], + args=[tables.utils.A("pk")], + ) + status = tables.Column( + verbose_name=_("Status"), accessor="get_status_display", order_by=("status",) ) - status = tables.Column(verbose_name=_('Status'), accessor='get_status_display', order_by=('status',)) - fund = tables.Column(verbose_name=_('Fund'), accessor='submission__page') - reporting = tables.Column(verbose_name=_('Reporting'), accessor='pk') + fund = tables.Column(verbose_name=_("Fund"), accessor="submission__page") + reporting = tables.Column(verbose_name=_("Reporting"), accessor="pk") last_payment_request = tables.DateColumn() - end_date = tables.DateColumn(verbose_name=_('End Date'), accessor='proposed_end') + end_date = tables.DateColumn(verbose_name=_("End Date"), accessor="proposed_end") def order_reporting(self, qs, is_descending): - direction = '-' if is_descending else '' + direction = "-" if is_descending else "" - qs = qs.order_by(f'{direction}outstanding_reports') + qs = qs.order_by(f"{direction}outstanding_reports") return qs, True def render_reporting(self, record): - if not hasattr(record, 'report_config'): - return '-' + if not hasattr(record, "report_config"): + return "-" if record.report_config.is_up_to_date(): - return 'Up to date' + return "Up to date" if record.report_config.has_very_late_reports(): - display = '' + display = ( + '' + ) else: - display = '' + display = "" - display += f'{ record.report_config.outstanding_reports() } outstanding' + display += f"{ record.report_config.outstanding_reports() } outstanding" return mark_safe(display) class ProjectsDashboardTable(BaseProjectsTable): class Meta: fields = [ - 'title', - 'status', - 'fund', - 'reporting', - 'last_payment_request', - 'end_date', + "title", + "status", + "fund", + "reporting", + "last_payment_request", + "end_date", ] model = Project orderable = False - attrs = {'class': 'projects-table'} + attrs = {"class": "projects-table"} class ProjectsAssigneeDashboardTable(BaseProjectsTable): class Meta: fields = [ - 'title', - 'fund', - 'lead', - 'reporting', - 'last_payment_request', - 'end_date', + "title", + "fund", + "lead", + "reporting", + "last_payment_request", + "end_date", ] model = Project orderable = False - exclude = ['status'] - attrs = {'class': 'projects-table'} + exclude = ["status"] + attrs = {"class": "projects-table"} class ProjectsListTable(BaseProjectsTable): class Meta: fields = [ - 'title', - 'status', - 'lead', - 'fund', - 'reporting', - 'last_payment_request', - 'end_date', + "title", + "status", + "lead", + "fund", + "reporting", + "last_payment_request", + "end_date", ] model = Project orderable = True - order_by = ('-end_date',) - template_name = 'application_projects/tables/table.html' - attrs = {'class': 'projects-table'} - + order_by = ("-end_date",) + template_name = "application_projects/tables/table.html" + attrs = {"class": "projects-table"} def order_end_date(self, qs, desc): return qs.by_end_date(desc), True @@ -146,26 +147,22 @@ def order_end_date(self, qs, desc): class ReportListTable(tables.Table): project = tables.LinkColumn( - 'funds:projects:reports:detail', + "funds:projects:reports:detail", text=lambda r: textwrap.shorten(r.project.title, width=30, placeholder="..."), - args=[tables.utils.A('pk')], + args=[tables.utils.A("pk")], ) - report_period = tables.Column(accessor='pk') + report_period = tables.Column(accessor="pk") submitted = tables.DateColumn() - lead = tables.Column(accessor='project__lead') + lead = tables.Column(accessor="project__lead") class Meta: fields = [ - 'project', - 'submitted', - ] - sequence = [ - 'project', - 'report_period', - '...' + "project", + "submitted", ] + sequence = ["project", "report_period", "..."] model = Report - attrs = {'class': 'responsive-table'} + attrs = {"class": "responsive-table"} def render_report_period(self, record): return f"{record.start} to {record.end_date}" diff --git a/hypha/apply/projects/templates/application_projects/includes/contracting_documents.html b/hypha/apply/projects/templates/application_projects/includes/contracting_documents.html index c89b6abaa6..d6566b5824 100644 --- a/hypha/apply/projects/templates/application_projects/includes/contracting_documents.html +++ b/hypha/apply/projects/templates/application_projects/includes/contracting_documents.html @@ -5,17 +5,17 @@
    {% trans "Contracting documents" %} {% if collapsible_header %} - - + + {% endif %}
    {% user_can_upload_contract object request.user as can_upload_contract %} {% user_can_submit_contract object user contract as can_submit_contract %} {% if can_submit_contract %} + data-src="#submit-contract-documents" + class="button button--project-action {% if remaining_contract_document_categories or not contract.signed_by_applicant %}is-disabled{% endif %}" + href="#"> {% trans "Submit contract documents" %} + {% endif %} + + + {% if contracting_documents_configured and contract_uploaded %} +
  • +
    + + + +

    {% trans "Contracting documents" %}

    +
    + {% can_update_contracting_documents object user as can_update_documents %} + + {% if all_contract_document_categories %} + +
    +

    +
      + {% for document_category in all_contract_document_categories %} +
    • +
      +

      + {% if document_category in remaining_contract_document_categories %} + {% trans "Pending " %} + {{ document_category.name|lower }} + {% else %} + {{ document_category.name }} + {% endif %} + {% if document_category.required %}*{% endif %} + {% if document_category.template %} + + {% trans "View template" %} + {% endif %} +

      + {% if document_category not in remaining_contract_document_categories %} + {% contract_category_latest_file project document_category as latest_file %} +

      {{ latest_file.title }} - {{ latest_file.created_at }}

      + {% endif %} +
      + {% if document_category in remaining_contract_document_categories and can_update_documents %} + + {% else %} + {% contract_category_latest_file project document_category as latest_file %} + {% if latest_file %} +
      + + + {% trans "View" %} + + {% if can_update_documents %} + + + {% csrf_token %} + {{ latest_file.get_remove_form }} + + + {% endif %} +
      + {% endif %} + {% endif %} +
    • + {% endfor %} +
    +
    + {% endif %} +
  • {% endif %} - - {% endif %} - +
    {% if can_upload_contract %} - + {% endif %} {% if can_update_documents %} - + {% endif %} {% if contract_to_approve %} - + {% endif %} diff --git a/hypha/apply/projects/templates/application_projects/includes/deliverables_block.html b/hypha/apply/projects/templates/application_projects/includes/deliverables_block.html index 67d0d627bc..acb4a70421 100644 --- a/hypha/apply/projects/templates/application_projects/includes/deliverables_block.html +++ b/hypha/apply/projects/templates/application_projects/includes/deliverables_block.html @@ -6,17 +6,17 @@
    {% trans "Choose deliverables" %}

    -
    - {% trans "Available to invoice:" %} -
    -
    +
    + {% trans "Available to invoice:" %} +
    +
    diff --git a/hypha/apply/projects/templates/application_projects/includes/invoices.html b/hypha/apply/projects/templates/application_projects/includes/invoices.html index 30f2a95a97..fd2747916a 100644 --- a/hypha/apply/projects/templates/application_projects/includes/invoices.html +++ b/hypha/apply/projects/templates/application_projects/includes/invoices.html @@ -23,57 +23,57 @@
    {% for invoice in object.invoices.not_rejected %} - {% display_invoice_status_for_user user invoice as invoice_status %} - - - - - + + + + - + {% can_edit invoice user as user_can_edit_request %} + {% if user_can_edit_request %} + + + {% trans "Edit" %} + + {% endif %} + + {% can_delete invoice user as user_can_delete_request %} + {% if user.is_applicant and user_can_delete_request %} + + + {% trans "Delete" %} + + {% endif %} + {% can_change_status invoice user as can_change_invoice_status %} + {% if can_change_invoice_status %} + + {% trans "Update Status" %} + + + {% endif %} + + {% empty %} - - - + + + {% endfor %}
    {% trans "Linked" %} {{ row.record.previous.stage }}{{ column.header }}{% trans "Linked" %} {{ row.record.previous.stage }}{{ column.header }}
    {% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %}
    {{ table.empty_text }}
    {{ table.empty_text }}
    {"".join(review_form_links)}{"".join(review_form_links)}
    {% trans "Date submitted" %}: {{ invoice.requested_at.date }}{% trans "Invoice number" %}: {{ invoice.invoice_number }}{% trans "Status" %}: {{ invoice_status }} - - - {% trans "View" %} - - {% can_edit invoice user as user_can_edit_request %} - {% if user_can_edit_request %} - - - {% trans "Edit" %} - - {% endif %} - - {% can_delete invoice user as user_can_delete_request %} - {% if user.is_applicant and user_can_delete_request %} - - - {% trans "Delete" %} - - {% endif %} - {% can_change_status invoice user as can_change_invoice_status %} - {% if can_change_invoice_status %} - - {% trans "Update Status" %} + {% display_invoice_status_for_user user invoice as invoice_status %} +
    {% trans "Date submitted" %}: {{ invoice.requested_at.date }}{% trans "Invoice number" %}: {{ invoice.invoice_number }}{% trans "Status" %}: {{ invoice_status }} + + + {% trans "View" %} - - {% endif %} -
    {% trans "No active Invoices." %}
    {% trans "No active Invoices." %}
    @@ -94,18 +94,18 @@ {% for invoice in object.invoices.rejected %} - {% display_invoice_status_for_user user invoice as invoice_status %} - - {% trans "Date submitted" %}: {{ invoice.requested_at.date }} - {% trans "Invoice number" %}: {{ invoice.invoice_number }} - {% trans "Status" %}: {{ invoice_status }} - - - - {% trans "View" %} - - - + {% display_invoice_status_for_user user invoice as invoice_status %} + + {% trans "Date submitted" %}: {{ invoice.requested_at.date }} + {% trans "Invoice number" %}: {{ invoice.invoice_number }} + {% trans "Status" %}: {{ invoice_status }} + + + + {% trans "View" %} + + + {% endfor %} diff --git a/hypha/apply/projects/templates/application_projects/includes/report_frequency_config.html b/hypha/apply/projects/templates/application_projects/includes/report_frequency_config.html index f81ad77348..b559c85b55 100644 --- a/hypha/apply/projects/templates/application_projects/includes/report_frequency_config.html +++ b/hypha/apply/projects/templates/application_projects/includes/report_frequency_config.html @@ -37,7 +37,7 @@
    {% if not current %} - - {% csrf_token %} - - +
    + {% csrf_token %} + +
    {% endif %}
    diff --git a/hypha/apply/projects/templates/application_projects/includes/reports.html b/hypha/apply/projects/templates/application_projects/includes/reports.html index 70989a1e56..a703d66488 100644 --- a/hypha/apply/projects/templates/application_projects/includes/reports.html +++ b/hypha/apply/projects/templates/application_projects/includes/reports.html @@ -2,35 +2,35 @@ {% user_can_update_project_reports object user as can_update_project_reports %} {% if can_update_project_reports %} -
    -
    -
    -

    {% trans "Reports" %}

    -
    -
    - {% user_can_update_report_config object user as can_update_report_config %} - {% if can_update_report_config %} -
    -

    {% trans "Report frequency" %}

    -

    {{ object.report_config.get_frequency_display }}

    -

    - {% if object.report_config.disable_reporting %}{% trans "Enable" %}{% else %}{% trans "Change" %}{% endif %} -

    +
    +
    +
    +

    {% trans "Reports" %}

    +
    +
    + {% user_can_update_report_config object user as can_update_report_config %} + {% if can_update_report_config %} +
    +

    {% trans "Report frequency" %}

    +

    {{ object.report_config.get_frequency_display }}

    +

    + {% if object.report_config.disable_reporting %}{% trans "Enable" %}{% else %}{% trans "Change" %}{% endif %} +

    - {% include 'application_projects/includes/report_frequency_config.html' with form=update_frequency_form extra_classes="form--report-frequency" config=object.report_config %} -
    - {% endif %} -
      - {% for report in object.report_config.past_due_reports %} - {% include "application_projects/includes/report_line.html" with report=report %} - {% endfor %} - {% with next_report=object.report_config.current_due_report %} - {% include "application_projects/includes/report_line.html" with report=next_report current=True %} - {% endwith %} -
    + {% include 'application_projects/includes/report_frequency_config.html' with form=update_frequency_form extra_classes="form--report-frequency" config=object.report_config %} +
    + {% endif %} +
      + {% for report in object.report_config.past_due_reports %} + {% include "application_projects/includes/report_line.html" with report=report %} + {% endfor %} + {% with next_report=object.report_config.current_due_report %} + {% include "application_projects/includes/report_line.html" with report=next_report current=True %} + {% endwith %} +
    +
    -
    {% endif %} @@ -61,10 +61,10 @@ {% if not report.skipped %} {% user_can_view_report report user as can_view_report %} {% if can_view_report %} - - - {% trans "View" %} - + + + {% trans "View" %} + {% endif %} {% user_can_update_report report user as can_update_report %} @@ -84,7 +84,7 @@ {% endif %} - {% empty %} + {% empty %} {% trans "No reports submitted" %} diff --git a/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html b/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html index 368e33025e..77dd5af2af 100644 --- a/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html +++ b/hypha/apply/projects/templates/application_projects/includes/supporting_documents.html @@ -6,293 +6,293 @@
    {% trans "Project documents" %} {% if collapsible_header %} - - + + {% endif %}
    - {% user_can_send_for_approval object user as can_send_to_approve %} - {% if can_send_to_approve %} - - {% if object.paf_approvals.exists %} - {% trans "Resubmit for approval" %} + {% user_can_send_for_approval object user as can_send_to_approve %} + {% if can_send_to_approve %} + + {% if object.paf_approvals.exists %} + {% trans "Resubmit for approval" %} + {% else %} + {% trans "Submit for approval" %} + {% endif %} + + {% endif %} + {% user_can_update_paf_approvers object user request as can_update_paf_approvers %} + {% user_can_assign_approvers_to_project object user request as can_assign_paf_approvers %} + {% if can_update_paf_approvers %} + {% if user == project.lead %} + + {% trans "View/Update Approvers" %} + {% else %} - {% trans "Submit for approval" %} + + {% trans "Change approver" %} + {% endif %} - - {% endif %} - {% user_can_update_paf_approvers object user request as can_update_paf_approvers %} - {% user_can_assign_approvers_to_project object user request as can_assign_paf_approvers %} - {% if can_update_paf_approvers %} - {% if user == project.lead %} - - {% trans "View/Update Approvers" %} - - {% else %} - - {% trans "Change approver" %} - {% endif %} - {% endif %} - {% if can_assign_paf_approvers %} - - {% trans "Assign approver" %} - - {% endif %} - {% user_can_update_paf_status object user request=request as can_update_paf_status %} - {% if object.can_make_approval and can_update_paf_status %} - - {% trans "Update Status" %} - - {% endif %} + {% if can_assign_paf_approvers %} + + {% trans "Assign approver" %} + + {% endif %} + {% user_can_update_paf_status object user request=request as can_update_paf_status %} + {% if object.can_make_approval and can_update_paf_status %} + + {% trans "Update Status" %} + + {% endif %}
    + {% endif %} - - - {% if supporting_documents_configured %} -
  • -
    - - - -

    {% trans "Supporting documents" %}

    -
    - - {% if all_document_categories %} -
    -

    -
      - {% for document_category in all_document_categories %} +
    • +
      + + + +

      {% trans "Approval Form" %}

      +
      +
      + {% if editable and not user.is_applicant %} + + {% if object.user_has_updated_details %} + + {% trans "Edit" %} + {% else %} + {% trans "Fill in" %} + {% endif %} + + {% endif %} + {% if object.user_has_updated_details and not user.is_applicant %} + + + {% trans "View" %} + + {% endif %} +
      + {% has_project_sow_form object as project_sow %} + {% if project_sow and object.user_has_updated_details and not user.is_applicant %} +
      • -

        {{ document_category.name }} - {% if document_category.required %}*{% endif %} - {% if document_category.template %} - {% trans "View template" %} - - {% endif %} -

        - {% if document_category not in remaining_document_categories %} - {% category_latest_file project document_category as latest_file %} -

        {{ latest_file.title }} - {{ latest_file.created_at }}

        - {% endif %} +

        {% trans "Scope of work (SOW)" %}

        +
        + - {% if document_category in remaining_document_categories %} - - {% else %} - {% category_latest_file project document_category as latest_file %} - {% if latest_file %} -
        - - - {% trans "View" %} - - {% user_can_remove_supporting_documents object user as can_remove_supporting_doc %} - {% if can_remove_supporting_doc %} - - {% endif %} -
        - {% endif %} - {% endif %}
      • - {% endfor %} -
      -
    - {% endif %} + + {% endif %} +
  • - - {% endif %} - + {% if supporting_documents_configured %} +
  • +
    + + + +

    {% trans "Supporting documents" %}

    +
    + + {% if all_document_categories %} + +
    +

    +
      + {% for document_category in all_document_categories %} +
    • +
      +

      {{ document_category.name }} + {% if document_category.required %}*{% endif %} + {% if document_category.template %} + {% trans "View template" %} + + {% endif %} +

      + {% if document_category not in remaining_document_categories %} + {% category_latest_file project document_category as latest_file %} +

      {{ latest_file.title }} - {{ latest_file.created_at }}

      + {% endif %} +
      + {% if document_category in remaining_document_categories %} + + {% else %} + {% category_latest_file project document_category as latest_file %} + {% if latest_file %} +
      + + + {% trans "View" %} + + {% user_can_remove_supporting_documents object user as can_remove_supporting_doc %} + {% if can_remove_supporting_doc %} + + {% endif %} +
      + {% endif %} + {% endif %} +
    • + {% endfor %} +
    +
    + {% endif %} + +
  • + {% endif %} +
    {% if user.is_apply_staff %} - + {% endif %} {% if can_send_to_approve %} - {% endif %} {% if can_update_paf_approvers %} - -