Skip to content

Commit

Permalink
Merge pull request #4483 from opensafely-core/iaindillingham/add-new-…
Browse files Browse the repository at this point in the history
…question-to-study-information-page

Add a new question to the "Study information" page
  • Loading branch information
iaindillingham authored Jul 24, 2024
2 parents 6890e94 + 0492431 commit d0f3fb2
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions applications/form_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
help_text=snippet("study_purpose-help_text"),
template_name="form_textarea",
),
Field(
name="read_analytic_methods_policy",
label="Have all applicants for OpenSAFELY read and agreed to the OpenSAFELY Analytic Methods Policy?",
help_text=snippet("read_analytic_methods_policy-help_text"),
),
],
),
],
Expand Down
1 change: 1 addition & 0 deletions applications/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(self, *args, **kwargs):
# which uses choices.
radio_fields = [
"all_applicants_completed_getting_started",
"read_analytic_methods_policy",
"need_record_level_data",
"is_approved",
]
Expand Down
20 changes: 20 additions & 0 deletions applications/migrations/0003_add_read_analytic_methods_policy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.0.7 on 2024-07-23 15:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("applications", "0002_add_short_data_report"),
]

operations = [
migrations.AddField(
model_name="studyinformationpage",
name="read_analytic_methods_policy",
field=models.BooleanField(
choices=[(True, "Yes"), (False, "No")], null=True
),
),
]
3 changes: 3 additions & 0 deletions applications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ class CommercialInvolvementPage(AbstractPage):
class StudyInformationPage(AbstractPage):
study_name = models.TextField(blank=True)
study_purpose = models.TextField(blank=True)
read_analytic_methods_policy = models.BooleanField(
null=True, choices=YES_NO_CHOICES
)


class StudyPurposePage(AbstractPage):
Expand Down
3 changes: 3 additions & 0 deletions snippets/read_analytic_methods_policy-help_text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The [OpenSAFELY Analytic Methods Policy][1] can be found on the OpenSAFELY website.

[1]: https://www.opensafely.org/policies-for-researchers/#opensafely-analytic-methods-policy
1 change: 1 addition & 0 deletions tests/factories/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Meta:

study_name = factory.Sequence(lambda n: f"study {n}")
study_purpose = factory.Sequence(lambda n: f"purpose {n}")
read_analytic_methods_policy = factory.fuzzy.FuzzyChoice([True, False])


class StudyPurposePageFactory(AbstractPageFactory):
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_successful_application(client, mailoutbox, slack_messages):
data = {
"study_name": "Title for this study",
"study_purpose": "Long form technical message about what this study is about",
"read_analytic_methods_policy": "True",
}
response = client.post(url("study-information"), data, follow=True)
assert response.status_code == 200
Expand Down

0 comments on commit d0f3fb2

Please sign in to comment.