python - Django, sending emails through Mandrill without language_code setting -
i'm using mandrill api send emails. problem emails don't have proper language_code
setting used in settings.py
in settings.py file have following lines:
template_context_processors = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.request", "events.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.tz", ) ... language_code = 'es' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true
in managment/commands/sendmails.py
, of code send emails is:
def generate_html(events): template = loader.get_template('mail_request_list.html') return template.render(context({'events': events})) def send_emails(): mandril_client = mandrill.mandrill(key) message = { 'from_email': 'info@myapp.com', 'from_name': 'myapp', 'subject': u'title', } events = get_events() #other function html_request = generate_html(events) message['html'] = html_request message['to'] = [{ 'email': 'test_user@myapp.com', 'type': 'to' }] mandril_client.messages.send( message=message )
the html file mail_request_list.html
:
<!doctype html> <html lang="es"> <body> {% event in events %} mes: {{ event.begin_at|date:'f'|lower }} <br> {% endfor %} </body> </html>
i can send emails, dates shows in english , not in spanish how set in app.
you need appropriately set date_format
in settings
file, language_code
setting not responsible formats of kind.
Comments
Post a Comment