From 421e661a5f68f101fe7a4e79e4274f336102265e Mon Sep 17 00:00:00 2001 From: Shimul Chowdhury Date: Mon, 7 Dec 2020 07:41:46 +0600 Subject: [PATCH] Added new setting CERTIFICATE_DATE_FORMAT for easy customization of certificate issued date --- lms/djangoapps/certificates/views/webview.py | 6 +----- lms/envs/common.py | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index 5f9afcb479..4518a02884 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -108,11 +108,7 @@ def _update_certificate_context(context, course, user_certificate, platform_name # Translators: The format of the date includes the full name of the month date = display_date_for_certificate(course, user_certificate) - context['certificate_date_issued'] = _(u'{month} {day}, {year}').format( - month=strftime_localized(date, "%B"), - day=date.day, - year=date.year - ) + context['certificate_date_issued'] = strftime_localized(date, settings.CERTIFICATE_DATE_FORMAT) # Translators: This text represents the verification of the certificate context['document_meta_description'] = _(u'This is a valid {platform_name} certificate for {user_name}, ' diff --git a/lms/envs/common.py b/lms/envs/common.py index 63c9cdabe9..e14b252dc5 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1047,6 +1047,10 @@ DJFS = { 'url_root': '/static/django-pyfs', } +# Set certificate issued date format. It supports all formats supported by +# `common.djangoapps.util.date_utils.strftime_localized`. +CERTIFICATE_DATE_FORMAT = "%B %-d, %Y" + ### Dark code. Should be enabled in local settings for devel. ENABLE_MULTICOURSE = False # set to False to disable multicourse display (see lib.util.views.edXhome)