[REFACTOR] Use constance variables in email template and add login URL

This commit is contained in:
2023-01-07 18:44:30 +00:00
parent cbd2158307
commit 4e82d363bc
3 changed files with 11 additions and 3 deletions

View File

@@ -348,6 +348,9 @@ CONSTANCE_CONFIG = {
'RELATIONSHIP_FORM_HELP': ( 'RELATIONSHIP_FORM_HELP': (
'', '',
'Help text to display at the top of relationship forms.'), 'Help text to display at the top of relationship forms.'),
'DEPLOYMENT_URL': (
'http://localhost',
'URL at which this mapper tool is accessible'),
'PARENT_PROJECT_NAME': ( 'PARENT_PROJECT_NAME': (
'', '',
'Parent project name'), 'Parent project name'),
@@ -441,6 +444,9 @@ CONSTANCE_CONFIG_FIELDSETS = {
'ORGANISATION_LIST_HELP', 'ORGANISATION_LIST_HELP',
'RELATIONSHIP_FORM_HELP', 'RELATIONSHIP_FORM_HELP',
), ),
'Deployment': (
'DEPLOYMENT_URL',
),
} # yapf: disable } # yapf: disable
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend' CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'

View File

@@ -6,9 +6,9 @@
"description": "Default welcome email template", "description": "Default welcome email template",
"created": "2020-04-27T12:13:30.448Z", "created": "2020-04-27T12:13:30.448Z",
"last_updated": "2020-04-27T14:45:27.152Z", "last_updated": "2020-04-27T14:45:27.152Z",
"subject": "Welcome to {{settings.PROJECT_LONG_NAME}}", "subject": "Welcome to {{config.PROJECT_LONG_NAME}}",
"content": "Dear {{ user.get_full_name }},\r\n\r\nWelcome to {{ settings.PROJECT_LONG_NAME }}.\r\n\r\nThanks,\r\n\r\nThe {{ settings.PROJECT_LONG_NAME }} team", "content": "Dear {{ user.get_full_name }},\r\n\r\nWelcome to {{ config.PROJECT_LONG_NAME }}. You can sign in at {{ config.DEPLOYMENT_URL }}.\r\n\r\nThanks,\r\n\r\nThe {{ config.PROJECT_SHORT_NAME }} team",
"html_content": "<h1>{{ settings.PROJECT_LONG_NAME }}</h1>\r\n\r\nDear {{ user.get_full_name }},\r\n\r\nWelcome to {{ settings.PROJECT_LONG_NAME }}.\r\n\r\nThanks,\r\n\r\nThe {{ settings.PROJECT_LONG_NAME }} team", "html_content": "<h1>{{ config.PROJECT_LONG_NAME }}</h1>\r\n\r\nDear {{ user.get_full_name }},\r\n\r\nWelcome to {{ config.PROJECT_LONG_NAME }}. You can sign in <a href='{{ config.DEPLOYMENT_URL }}'>here</a>.\r\n\r\nThanks,\r\n\r\nThe {{ config.PROJECT_SHORT_NAME }} team",
"language": "", "language": "",
"default_template": null "default_template": null
} }

View File

@@ -14,6 +14,8 @@ from post_office import mail
from .organisation import Organisation from .organisation import Organisation
from .question import AnswerSet, Question, QuestionChoice from .question import AnswerSet, Question, QuestionChoice
from constance import config
logger = logging.getLogger(__name__) # pylint: disable=invalid-name logger = logging.getLogger(__name__) # pylint: disable=invalid-name
__all__ = [ __all__ = [