mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Make message and recipient counters formatters
As formatters we can use them in Jinja or Python code. It also means we don’t need to import them every time we want to use them – they’re always available in the template context. For now this doesn’t remove the macros, it just aliases them to the formatters. This gives us confidence that the formatters are working the same way the old macros did, and reduces the diff size of each commit.
This commit is contained in:
@@ -62,8 +62,14 @@ from app.formatters import (
|
||||
format_thousands,
|
||||
format_time,
|
||||
id_safe,
|
||||
iteration_count,
|
||||
linkable_name,
|
||||
message_count,
|
||||
message_count_label,
|
||||
message_count_noun,
|
||||
nl2br,
|
||||
recipient_count,
|
||||
recipient_count_label,
|
||||
valid_phone_number,
|
||||
)
|
||||
from app.models.organisation import Organisation
|
||||
@@ -548,6 +554,12 @@ def add_template_filters(application):
|
||||
id_safe,
|
||||
convert_to_boolean,
|
||||
format_list_items,
|
||||
iteration_count,
|
||||
recipient_count,
|
||||
recipient_count_label,
|
||||
message_count_label,
|
||||
message_count,
|
||||
message_count_noun,
|
||||
]:
|
||||
application.add_template_filter(fn)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user