diff --git a/edc_qol/admin/sf12_admin.py b/edc_qol/admin/sf12_admin.py index 236c4f0..cae6ad6 100644 --- a/edc_qol/admin/sf12_admin.py +++ b/edc_qol/admin/sf12_admin.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.utils.html import format_html +from django.utils.safestring import mark_safe from django_audit_fields.admin import audit_fieldset_tuple from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin from edc_model_admin.history import SimpleHistoryAdmin @@ -9,13 +10,16 @@ from ..models import Sf12 additional_instructions = format_html( - "
" - "This survey asks for your views about your health. This information " - "will help keep track of how you feel and how well you are able to do " - "your usual activities. " - "Answer each question by choosing just one answer. If you are " - "unsure how to answer a question, please give the best answer you can." - "
" + "{}", + mark_safe( # nosec B308, B703 + "" + "This survey asks for your views about your health. This information " + "will help keep track of how you feel and how well you are able to do " + "your usual activities. " + "Answer each question by choosing just one answer. If you are " + "unsure how to answer a question, please give the best answer you can." + "
" + ), ) past_4w = "past 4 weeks" @@ -61,7 +65,9 @@ def sf12_fieldsets(): ( "Part 2: Activities limited by health", { - "description": format_html(part2_description), + "description": format_html( + "{}", mark_safe(part2_description) # nosec B308, B703 + ), "fields": ( "moderate_activities_now_limited", "climbing_stairs_now_limited", @@ -71,7 +77,9 @@ def sf12_fieldsets(): ( "Part 3: Physical health problems (last 4 weeks)", { - "description": format_html(part3_description), + "description": format_html( + "{}", mark_safe(part3_description) # nosec B308, B703 + ), "fields": ( "accomplished_less_physical_health", "work_limited_physical_health", @@ -81,7 +89,9 @@ def sf12_fieldsets(): ( "Part 4: Emotional problems (last 4 weeks)", { - "description": format_html(part4_description), + "description": format_html( + "{}", mark_safe(part4_description) # nosec B308, B703 + ), "fields": ( "accomplished_less_emotional", "work_less_carefully_emotional", @@ -95,7 +105,9 @@ def sf12_fieldsets(): ( "Part 6: Feeling (last 4 weeks)", { - "description": format_html(part6_description), + "description": format_html( + "{}", mark_safe(part6_description) # nosec B308, B703 + ), "fields": ( "felt_calm_peaceful", "felt_lot_energy", diff --git a/edc_qol/model_mixins/eq5d3l_model_mixin.py b/edc_qol/model_mixins/eq5d3l_model_mixin.py index f84367c..b6066ad 100644 --- a/edc_qol/model_mixins/eq5d3l_model_mixin.py +++ b/edc_qol/model_mixins/eq5d3l_model_mixin.py @@ -1,6 +1,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.utils.html import format_html +from django.utils.safestring import mark_safe from ..choices import ( ANXIETY_DEPRESSION, @@ -32,14 +33,17 @@ class Eq5d3lModelMixin(models.Model): ) health_today_score_slider = models.CharField( - verbose_name=format_html("Visual score for how your health is TODAY"), + verbose_name=format_html("{}", "Visual score for how your health is TODAY"), max_length=3, ) health_today_score_confirmed = models.IntegerField( verbose_name=format_html( - "Interviewer: " - "please confirm the number on the scale indicated from above." + "{}", + mark_safe( # nosec B308, B703 + "Interviewer: " + "please confirm the number on the scale indicated from above." + ), ), validators=[MinValueValidator(0), MaxValueValidator(100)], help_text=( diff --git a/edc_qol/model_mixins/sf12_model_mixin.py b/edc_qol/model_mixins/sf12_model_mixin.py index f2a1df0..ea4d9d7 100644 --- a/edc_qol/model_mixins/sf12_model_mixin.py +++ b/edc_qol/model_mixins/sf12_model_mixin.py @@ -1,5 +1,6 @@ from django.db import models from django.utils.html import format_html +from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from edc_constants.choices import YES_NO @@ -21,44 +22,62 @@ class Sf12ModelMixin(models.Model): moderate_activities_now_limited = models.CharField( verbose_name=format_html( - _( - "Moderate activities such as moving a table, " - "pushing a vacuum cleaner, bowling, or playing golf:" - ) + "{}", + mark_safe( # nosec B308, B703 + _( + "Moderate activities such as moving a table, " + "pushing a vacuum cleaner, bowling, or playing golf:" + ) + ), ), max_length=20, choices=HEALTH_LIMITED_CHOICES, ) climbing_stairs_now_limited = models.CharField( - verbose_name=format_html(_("Climbing several flights of stairs:")), + verbose_name=format_html( + "{}", + mark_safe(_("Climbing several flights of stairs:")), # nosec B308, B703 + ), max_length=20, choices=HEALTH_LIMITED_CHOICES, ) accomplished_less_physical_health = models.CharField( - verbose_name=format_html(_("Accomplished less than you would like:")), + verbose_name=format_html( + "{}", + mark_safe(_("Accomplished less than you would like:")), # nosec B308, B703 + ), max_length=15, choices=YES_NO, ) work_limited_physical_health = models.CharField( verbose_name=format_html( - _("Were limited in the kind of work or other activities:") + "{}", + mark_safe( # nosec B308, B703 + _("Were limited in the kind of work or other activities:") + ), ), max_length=15, choices=YES_NO, ) accomplished_less_emotional = models.CharField( - verbose_name=format_html(_("Accomplished less than you would like:")), + verbose_name=format_html( + "{}", + mark_safe(_("Accomplished less than you would like:")), # nosec B308, B703 + ), max_length=15, choices=YES_NO, ) work_less_carefully_emotional = models.CharField( verbose_name=format_html( - _("Did work or activities less carefully than usual:") + "{}", + mark_safe( # nosec B308, B703 + _("Did work or activities less carefully than usual:") + ), ), max_length=15, choices=YES_NO, @@ -66,10 +85,13 @@ class Sf12ModelMixin(models.Model): pain_interfere_work = models.CharField( verbose_name=format_html( - _( - "During the past 4 weeks, how much did pain interfere " - "with your normal work (including work outside the home and housework)?" - ) + "{}", + mark_safe( # nosec B308, B703 + _( + "During the past 4 weeks, how much did pain interfere " + "with your normal work (including work outside the home and housework)?" + ) + ), ), max_length=15, choices=WORK_PAIN_INTERFERENCE_CHOICES, @@ -95,11 +117,14 @@ class Sf12ModelMixin(models.Model): social_activities_interfered = models.CharField( verbose_name=format_html( - _( - "During the past 4 weeks, how much of the time has your physical " - "health or emotional problems interfered with your social " - "activities (like visiting friends, relatives, etc.)?" - ) + "{}", + mark_safe( # nosec B308, B703 + _( + "During the past 4 weeks, how much of the time has your physical " + "health or emotional problems interfered with your social " + "activities (like visiting friends, relatives, etc.)?" + ) + ), ), max_length=25, choices=INTERFERENCE_DURATION_CHOICES, diff --git a/edc_qol/modeladmin_mixins/eq5d3l_model_admin_mixin.py b/edc_qol/modeladmin_mixins/eq5d3l_model_admin_mixin.py index 6398736..0125c9a 100644 --- a/edc_qol/modeladmin_mixins/eq5d3l_model_admin_mixin.py +++ b/edc_qol/modeladmin_mixins/eq5d3l_model_admin_mixin.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.utils.html import format_html +from django.utils.safestring import mark_safe from django_audit_fields.admin import audit_fieldset_tuple eq5d3l_description = """ @@ -36,7 +37,9 @@ def eq5d3l_fieldsets(): ( "How is your health TODAY?", { - "description": format_html(eq5d3l_description), + "description": format_html( + "{}", mark_safe(eq5d3l_description) # nosec B308, B703 + ), "fields": ( "health_today_score_slider", "health_today_score_confirmed",