Skip to content

Commit f6ac2f9

Browse files
committed
format_html, mark_safe, translations
1 parent a8adc13 commit f6ac2f9

1 file changed

Lines changed: 151 additions & 20 deletions

File tree

edc_qol/choices.py

Lines changed: 151 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.utils.functional import lazy
22
from django.utils.html import format_html
3+
from django.utils.safestring import mark_safe
34
from django.utils.translation import gettext_lazy as _
45

56
from .constants import (
@@ -103,67 +104,197 @@
103104
(
104105
"4",
105106
format_html_lazy(
106-
_("I am able to feel settled and secure in <B>all</B> areas of my life")
107+
"{}",
108+
mark_safe(
109+
_("I am able to feel settled and secure in <B>all</B> areas of my life")
110+
), # nosec B703, B308
107111
),
108112
),
109113
(
110114
"3",
111115
format_html_lazy(
112-
_("I am able to feel settled and secure in <B>many</B> areas of my life")
116+
"{}",
117+
mark_safe(
118+
_("I am able to feel settled and secure in <B>many</B> areas of my life")
119+
), # nosec B703, B308
113120
),
114121
),
115122
(
116123
"2",
117124
format_html_lazy(
118-
_("I am able to feel settled and secure in a <B>few</B> areas of my life")
125+
"{}",
126+
mark_safe(
127+
_("I am able to feel settled and secure in a <B>few</B> areas of my life")
128+
), # nosec B703, B308
119129
),
120130
),
121131
(
122132
"1",
123133
format_html_lazy(
124-
_("I am <B>unable</B> to feel settled and secure in <B>any</B> areas of my life")
134+
"{}",
135+
mark_safe(
136+
_(
137+
"I am <B>unable</B> to feel settled and secure in <B>any</B> "
138+
"areas of my life"
139+
)
140+
), # nosec B703, B308
125141
),
126142
),
127143
)
128144

129145

130146
ICECAP_ATTACHMENT = (
131-
("4", format_html_lazy(_("I can have <B>a lot</B> of love, friendship and support"))),
147+
(
148+
"4",
149+
format_html_lazy(
150+
"{}",
151+
mark_safe(
152+
_("I can have <B>a lot</B> of love, friendship and support")
153+
), # nosec B703, B308
154+
),
155+
),
132156
(
133157
"3",
134-
format_html_lazy(_("I can have <B>quite a lot</B> of love, friendship and support")),
158+
format_html_lazy(
159+
"{}",
160+
mark_safe(
161+
_("I can have <B>quite a lot</B> of love, friendship and support")
162+
), # nosec B703, B308
163+
),
164+
),
165+
(
166+
"2",
167+
format_html_lazy(
168+
"{}",
169+
mark_safe(
170+
_("I can have <B>a little</B> love, friendship and support")
171+
), # nosec B703, B308
172+
),
173+
),
174+
(
175+
"1",
176+
format_html_lazy(
177+
"{}",
178+
mark_safe(
179+
_("I <B>cannot</B> have <B>any</B> love, friendship and support")
180+
), # nosec B703, B308
181+
),
135182
),
136-
("2", format_html_lazy(_("I can have <B>a little</B> love, friendship and support"))),
137-
("1", format_html_lazy(_("I <B>cannot</B> have <B>any</B> love, friendship and support"))),
138183
)
139184

140185

141186
ICECAP_AUTONOMY = (
142-
("4", format_html_lazy(_("I am able to be <B>completely</B> independent"))),
143-
("3", format_html_lazy(_("I am able to be independent in <B>many</B> things"))),
144-
("2", format_html_lazy(_("I am able to be independent in <B>a few</B> things"))),
145-
("1", format_html_lazy(_("I am <B>unable</B> to be at all independent"))),
187+
(
188+
"4",
189+
format_html_lazy(
190+
"{}",
191+
mark_safe(_("I am able to be <B>completely</B> independent")), # nosec B703, B308
192+
),
193+
),
194+
(
195+
"3",
196+
format_html_lazy(
197+
"{}",
198+
mark_safe(
199+
_("I am able to be independent in <B>many</B> things")
200+
), # nosec B703, B308
201+
),
202+
),
203+
(
204+
"2",
205+
format_html_lazy(
206+
"{}",
207+
mark_safe(
208+
_("I am able to be independent in <B>a few</B> things")
209+
), # nosec B703, B308
210+
),
211+
),
212+
(
213+
"1",
214+
format_html_lazy(
215+
"{}",
216+
mark_safe(_("I am <B>unable</B> to be at all independent")), # nosec B703, B308
217+
),
218+
),
146219
)
147220

148221
ICECAP_ACHIEVMENT = (
149-
("4", format_html_lazy(_("I can achieve and progress in <B>all</B> aspects of my life"))),
150-
("3", format_html_lazy(_("I can achieve and progress in <B>many</B> aspects of my life"))),
222+
(
223+
"4",
224+
format_html_lazy(
225+
"{}",
226+
mark_safe(
227+
_("I can achieve and progress in <B>all</B> aspects of my life")
228+
), # nosec B703, B308
229+
),
230+
),
231+
(
232+
"3",
233+
format_html_lazy(
234+
"{}",
235+
mark_safe(
236+
_("I can achieve and progress in <B>many</B> aspects of my life")
237+
), # nosec B703, B308
238+
),
239+
),
151240
(
152241
"2",
153-
format_html_lazy(_("I can achieve and progress in <B>a few</B> aspects of my life")),
242+
format_html_lazy(
243+
"{}",
244+
mark_safe(
245+
_("I can achieve and progress in <B>a few</B> aspects of my life")
246+
), # nosec B703, B308
247+
),
154248
),
155249
(
156250
"1",
157251
format_html_lazy(
158-
_("I <B>cannot</B> achieve and progress in <B>any</B> aspects of my life")
252+
"{}",
253+
mark_safe(
254+
_(
255+
"I <B>cannot</B> achieve and progress in <B>any</B> aspects of my life"
256+
), # nosec B703, B308
257+
),
159258
),
160259
),
161260
)
162261

163262

164263
ICECAP_ENJOYMENT = (
165-
("4", format_html_lazy(_("I can have <B>a lot</B> of enjoyment and pleasure"))),
166-
("3", format_html_lazy(_("I can have <B>quite a lot</B> of enjoyment and pleasure"))),
167-
("2", format_html_lazy(_("I can have <B>a little</B> enjoyment and pleasure"))),
168-
("1", format_html_lazy(_("I <B>cannot</B> have <B>any</B> enjoyment and pleasure"))),
264+
(
265+
"4",
266+
format_html_lazy(
267+
"{}",
268+
mark_safe(
269+
_("I can have <B>a lot</B> of enjoyment and pleasure")
270+
), # nosec B703, B308
271+
),
272+
),
273+
(
274+
"3",
275+
format_html_lazy(
276+
"{}",
277+
mark_safe(
278+
_("I can have <B>quite a lot</B> of enjoyment and pleasure")
279+
), # nosec B703, B308
280+
),
281+
),
282+
(
283+
"2",
284+
format_html_lazy(
285+
"{}",
286+
mark_safe(
287+
_("I can have <B>a little</B> enjoyment and pleasure")
288+
), # nosec B703, B308
289+
),
290+
),
291+
(
292+
"1",
293+
format_html_lazy(
294+
"{}",
295+
mark_safe(
296+
_("I <B>cannot</B> have <B>any</B> enjoyment and pleasure")
297+
), # nosec B703, B308
298+
),
299+
),
169300
)

0 commit comments

Comments
 (0)