mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-17 18:44:11 -05:00
Add a formatter for yes/no
This is a bit neater than a bunch of repetetive ternary statements.
This commit is contained in:
@@ -62,6 +62,7 @@ from app.formatters import (
|
||||
format_number_in_pounds_as_currency,
|
||||
format_thousands,
|
||||
format_time,
|
||||
format_yes_no,
|
||||
id_safe,
|
||||
iteration_count,
|
||||
linkable_name,
|
||||
@@ -567,6 +568,7 @@ def add_template_filters(application):
|
||||
message_count,
|
||||
message_count_noun,
|
||||
format_mobile_network,
|
||||
format_yes_no,
|
||||
]:
|
||||
application.add_template_filter(fn)
|
||||
|
||||
|
||||
@@ -518,3 +518,7 @@ def format_mobile_network(network):
|
||||
|
||||
def format_billions(count):
|
||||
return humanize.intword(count)
|
||||
|
||||
|
||||
def format_yes_no(value):
|
||||
return 'Yes' if value else 'No'
|
||||
|
||||
@@ -9,8 +9,8 @@ Emails in next year: {{ current_service.volume_email|format_thousands }}
|
||||
Text messages in next year: {{ current_service.volume_sms|format_thousands }}
|
||||
Letters in next year: {{ current_service.volume_letter|format_thousands }}
|
||||
|
||||
Consent to research: {{ "Yes" if current_service.consent_to_research else "No" }}
|
||||
Other live services for that user: {{ "Yes" if current_user.live_services else "No" }}
|
||||
Consent to research: {{ current_service.consent_to_research|format_yes_no }}
|
||||
Other live services for that user: {{ current_user.live_services|format_yes_no }}
|
||||
|
||||
Service reply-to address: {{ current_service.default_email_reply_to_address or "not set" }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user