diff --git a/apps/dot_ext/models.py b/apps/dot_ext/models.py index c7eb49ab0..2dc23e12a 100644 --- a/apps/dot_ext/models.py +++ b/apps/dot_ext/models.py @@ -158,14 +158,22 @@ class Application(AbstractApplication): verbose_name="Data Access Type:", ) - def access_end_date_mesg(self): + # Text and date must be separated so that built-in Django localization + # will recognize that the date should be localized when tagged + def access_end_date_text(self): if self.has_one_time_only_data_access(): return TEN_HOURS elif "RESEARCH_STUDY" in self.data_access_type: return "no end date." else: + return "until " + + def access_end_date(self): + if self.data_access_type == "THIRTEEN_MONTH": end_date = datetime.now() + relativedelta(months=+13) - return "until " + end_date.strftime("%B %d, %Y") + return end_date.date + else: + return None def scopes(self): scope_list = [] diff --git a/apps/dot_ext/views/authorization.py b/apps/dot_ext/views/authorization.py index 344baf26a..b8ebb3161 100644 --- a/apps/dot_ext/views/authorization.py +++ b/apps/dot_ext/views/authorization.py @@ -65,7 +65,8 @@ def __init__(self, version=1): def get_context_data(self, **kwargs): context = super(AuthorizationView, self).get_context_data(**kwargs) - context['permission_end_date'] = self.application.access_end_date_mesg() + context['permission_end_date_text'] = self.application.access_end_date_text() + context['permission_end_date'] = self.application.access_end_date() return context def dispatch(self, request, *args, **kwargs): diff --git a/templates/design_system/new_authorize_v2.html b/templates/design_system/new_authorize_v2.html index a4915bc07..901288c97 100644 --- a/templates/design_system/new_authorize_v2.html +++ b/templates/design_system/new_authorize_v2.html @@ -1,6 +1,7 @@ {% extends "auth_base.html" %} {% load static %} {% load i18n %} +{% load l10n %} {% load bootstrap %} {% block navigation %}{% endblock %} @@ -141,7 +142,7 @@