Skip to content

Commit

Permalink
format_html, mark_safe, translations
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jan 22, 2025
1 parent 3f8121c commit ab755b7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion edc_data_manager/admin/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def update_query_rules_action(modeladmin, request, queryset):
"An updated digest will be email upon completion. "
'You may also check in <a href="{}?"'
'task_name=update_query_rules">task results</A>. ',
mark_safe(formatted_datetime(dte)), # nosec B703, B308
formatted_datetime(dte),
mark_safe(taskresult_url), # nosec B703, B308
)
else:
Expand Down
10 changes: 8 additions & 2 deletions edc_data_manager/admin/data_dictionary_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def changelist_link(self, obj):
except NoReverseMatch:
pass
else:
return format_html('<a href="{url}">Changelist</a>', url=url)
return format_html(
'<a href="{url}">Changelist</a>',
url=mark_safe(url), # nosec B703 B308
)
return None

@staticmethod
Expand All @@ -132,7 +135,10 @@ def form_title(obj):

@staticmethod
def question_text(obj):
return format_html("{}", mark_safe(obj.prompt)) # nosec B703, B308
return format_html(
"{}",
mark_safe(obj.prompt), # nosec B703, B308
)

def populate_data_dictionary_action(self, request, queryset):
DataDictionary.objects.update(active=False)
Expand Down
5 changes: 4 additions & 1 deletion edc_data_manager/admin/data_query_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ class DataQueryAdmin(SiteModelAdminMixin, ModelAdminSubjectDashboardMixin, Simpl
def wrapped_title(self, obj=None):
wrapped_title = wrap(obj.title, width=20)
html = "<BR>".join(wrapped_title)
return format_html("{}", mark_safe(html)) # nosec B703, B308
return format_html(
"{}",
mark_safe(html), # nosec B703, B308
)

wrapped_title.short_description = "Title"

Expand Down
5 changes: 4 additions & 1 deletion edc_data_manager/populate_data_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def __init__(self, model, fld):
self.field_name = getattr(db_field, "name", None)
self.field_type = None if db_field is None else db_field.get_internal_type()
self.help_text = format_html(
"{}", mark_safe(getattr(db_field, "help_text", "")) # nosec B703, B308
"{}",
mark_safe(
getattr(db_field, "help_text", ""),
), # nosec B703, B308
)
self.max_digits = getattr(db_field, "max_digits", None)
self.max_length = getattr(db_field, "max_length", None)
Expand Down

0 comments on commit ab755b7

Please sign in to comment.