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 d9e690e commit 3dcacec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion edc_pharmacy/admin/model_admin_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def dashboard(self, obj=None, label=None):
kwargs=opts,
)
context = dict(title="Go to subject's dashboard", url=url, label=label)
return render_to_string("dashboard_button.html", context=context)
return render_to_string("edc_subject_dashboard/dashboard_button.html", context=context)
4 changes: 2 additions & 2 deletions edc_pharmacy/admin/prescription/rx_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ def add_refill(self, obj=None, label=None):
url = reverse("edc_pharmacy_admin:edc_pharmacy_rxrefill_add")
url = f"{url}?rx={obj.id}"
context = dict(title="Add refill", url=url, label="Add refill")
return render_to_string("dashboard_button.html", context=context)
return render_to_string("edc_subject_dashboard/dashboard_button.html", context=context)

@admin.display
def refills(self, obj=None, label=None):
url = reverse("edc_pharmacy_admin:edc_pharmacy_rxrefill_changelist")
url = f"{url}?q={obj.id}"
context = dict(title="RX items", url=url, label="Refills")
return render_to_string("dashboard_button.html", context=context)
return render_to_string("edc_subject_dashboard/dashboard_button.html", context=context)

@admin.display
def rx_medications(self, obj):
Expand Down
2 changes: 1 addition & 1 deletion edc_pharmacy/admin/prescription/rx_refill_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def prescription(self, obj=None):
url = reverse("edc_pharmacy_admin:edc_pharmacy_rx_changelist")
url = f"{url}?q={obj.rx.id}"
context = dict(title="Back to RX", url=url, label="Rx")
return render_to_string("dashboard_button.html", context=context)
return render_to_string("edc_subject_dashboard/dashboard_button.html", context=context)

@admin.display(description="Description of Refill")
def description(self, obj=None):
Expand Down
6 changes: 5 additions & 1 deletion edc_pharmacy/admin/stock/stock_request_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django_audit_fields import audit_fieldset_tuple
from edc_model_admin.history import SimpleHistoryAdmin
from edc_utils.date import to_local
Expand Down Expand Up @@ -139,7 +140,10 @@ def request_item_count(self, obj):

@admin.display(description="Container", ordering="container_name")
def container_str(self, obj):
return format_html("<BR>".join(str(obj.container).split(" ")))
return format_html(
"{}",
mark_safe("<BR>".join(str(obj.container).split(" "))), # nosec B703, B308
)

@admin.display(description="Task")
def task_status(self, obj):
Expand Down

0 comments on commit 3dcacec

Please sign in to comment.