mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-25 16:18:51 +01:00
Merge pull request #426 from meomap/email-fallback-locale
remove hardcode default locale
This commit is contained in:
commit
0d8e81d7f0
@ -68,6 +68,10 @@ These changes are visible throughout django-helpdesk
|
|||||||
|
|
||||||
**Default:** ``HELPDESK_EMAIL_SUBJECT_TEMPLATE = "{{ ticket.ticket }} {{ ticket.title|safe }} %(subject)s"``
|
**Default:** ``HELPDESK_EMAIL_SUBJECT_TEMPLATE = "{{ ticket.ticket }} {{ ticket.title|safe }} %(subject)s"``
|
||||||
|
|
||||||
|
- **HELPDESK_EMAIL_FALLBACK_LOCALE** Fallback locale for templated emails when queue locale not found
|
||||||
|
|
||||||
|
**Default:** ``HELPDESK_EMAIL_FALLBACK_LOCALE= "en"``
|
||||||
|
|
||||||
|
|
||||||
Options shown on public pages
|
Options shown on public pages
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
@ -46,7 +46,7 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
|
|||||||
fail_silently is passed to Django's mail routine. Set to 'True' to ignore
|
fail_silently is passed to Django's mail routine. Set to 'True' to ignore
|
||||||
any errors at send time.
|
any errors at send time.
|
||||||
|
|
||||||
files can be a list of tuple. Each tuple should be a filename to attach,
|
files can be a list of tuple. Each tuple should be a filename to attach,
|
||||||
along with the File objects to be read. files can be blank.
|
along with the File objects to be read. files can be blank.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -56,7 +56,8 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
|
|||||||
from django.template import loader, Context
|
from django.template import loader, Context
|
||||||
|
|
||||||
from helpdesk.models import EmailTemplate
|
from helpdesk.models import EmailTemplate
|
||||||
from helpdesk.settings import HELPDESK_EMAIL_SUBJECT_TEMPLATE
|
from helpdesk.settings import HELPDESK_EMAIL_SUBJECT_TEMPLATE, \
|
||||||
|
HELPDESK_EMAIL_FALLBACK_LOCALE
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# RemovedInDjango110Warning: render() must be called with a dict, not a Context.
|
# RemovedInDjango110Warning: render() must be called with a dict, not a Context.
|
||||||
@ -68,9 +69,9 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
|
|||||||
if hasattr(context['queue'], 'locale'):
|
if hasattr(context['queue'], 'locale'):
|
||||||
locale = getattr(context['queue'], 'locale', '')
|
locale = getattr(context['queue'], 'locale', '')
|
||||||
else:
|
else:
|
||||||
locale = context['queue'].get('locale', 'en')
|
locale = context['queue'].get('locale', HELPDESK_EMAIL_FALLBACK_LOCALE)
|
||||||
if not locale:
|
if not locale:
|
||||||
locale = 'en'
|
locale = HELPDESK_EMAIL_FALLBACK_LOCALE
|
||||||
|
|
||||||
t = None
|
t = None
|
||||||
try:
|
try:
|
||||||
@ -90,7 +91,7 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
|
|||||||
sender = settings.DEFAULT_FROM_EMAIL
|
sender = settings.DEFAULT_FROM_EMAIL
|
||||||
|
|
||||||
footer_file = os.path.join('helpdesk', locale, 'email_text_footer.txt')
|
footer_file = os.path.join('helpdesk', locale, 'email_text_footer.txt')
|
||||||
|
|
||||||
# get_template_from_string was removed in Django 1.8 http://django.readthedocs.org/en/1.8.x/ref/templates/upgrading.html
|
# get_template_from_string was removed in Django 1.8 http://django.readthedocs.org/en/1.8.x/ref/templates/upgrading.html
|
||||||
try:
|
try:
|
||||||
from django.template import engines
|
from django.template import engines
|
||||||
@ -178,7 +179,7 @@ def apply_query(queryset, params):
|
|||||||
params is a dictionary that contains the following:
|
params is a dictionary that contains the following:
|
||||||
filtering: A dict of Django ORM filters, eg:
|
filtering: A dict of Django ORM filters, eg:
|
||||||
{'user__id__in': [1, 3, 103], 'title__contains': 'foo'}
|
{'user__id__in': [1, 3, 103], 'title__contains': 'foo'}
|
||||||
|
|
||||||
search_string: A freetext search string
|
search_string: A freetext search string
|
||||||
|
|
||||||
sorting: The name of the column to sort by
|
sorting: The name of the column to sort by
|
||||||
|
@ -86,6 +86,9 @@ HELPDESK_STAFF_ONLY_TICKET_CC = getattr(settings, 'HELPDESK_STAFF_ONLY_TICKET_CC
|
|||||||
# allow the subject to have a configurable template.
|
# allow the subject to have a configurable template.
|
||||||
HELPDESK_EMAIL_SUBJECT_TEMPLATE = getattr(settings, 'HELPDESK_EMAIL_SUBJECT_TEMPLATE', "{{ ticket.ticket }} {{ ticket.title|safe }} %(subject)s")
|
HELPDESK_EMAIL_SUBJECT_TEMPLATE = getattr(settings, 'HELPDESK_EMAIL_SUBJECT_TEMPLATE', "{{ ticket.ticket }} {{ ticket.title|safe }} %(subject)s")
|
||||||
|
|
||||||
|
# default fallback locale when queue locale not found
|
||||||
|
HELPDESK_EMAIL_FALLBACK_LOCALE = getattr(settings, 'HELPDESK_EMAIL_FALLBACK_LOCALE', 'en')
|
||||||
|
|
||||||
|
|
||||||
''' options for staff.create_ticket view '''
|
''' options for staff.create_ticket view '''
|
||||||
# hide the 'assigned to' / 'Case owner' field from the 'create_ticket' view?
|
# hide the 'assigned to' / 'Case owner' field from the 'create_ticket' view?
|
||||||
|
Loading…
Reference in New Issue
Block a user