Set direction:rtl in emails

This commit is contained in:
Raphael Michel
2019-12-16 10:27:47 +01:00
parent ba4f00cfc0
commit 488ee19b11
2 changed files with 11 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ from django.core.mail.backends.smtp import EmailBackend
from django.dispatch import receiver from django.dispatch import receiver
from django.template.loader import get_template from django.template.loader import get_template
from django.utils.timezone import now from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import get_language, ugettext_lazy as _
from inlinestyler.utils import inline_css from inlinestyler.utils import inline_css
from pretix.base.i18n import LazyCurrencyNumber, LazyDate, LazyNumber from pretix.base.i18n import LazyCurrencyNumber, LazyDate, LazyNumber
@@ -112,7 +112,8 @@ class TemplateBasedMailRenderer(BaseHTMLMailRenderer):
'site_url': settings.SITE_URL, 'site_url': settings.SITE_URL,
'body': body_md, 'body': body_md,
'subject': str(subject), 'subject': str(subject),
'color': '#8E44B3' 'color': '#8E44B3',
'rtl': get_language() in settings.LANGUAGES_RTL
} }
if self.event: if self.event:
htmlctx['event'] = self.event htmlctx['event'] = self.event

View File

@@ -139,6 +139,14 @@
text-decoration: none; text-decoration: none;
color: {{ color }}; color: {{ color }};
} }
{% if rtl %}
body {
direction: rtl;
}
.content table td {
text-align: right;
}
{% endif %}
{% block addcss %}{% endblock %} {% block addcss %}{% endblock %}
</style> </style>