Django
10
Вклад в тег
............
#: minisite/apps/info/forms.py:21
msgid "Product Information"
msgstr ""
..............
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as languages %}
<html lang="{{LANGUAGE_CODE}}">
{% for lang_code, lang_name in languages %}
{% language lang_code %}
{%if LANGUAGE_CODE != lang_code%}
<a class="navbar-brand" href="#">{% trans 'Change language' %}</a>
{%endif%}
{% endlanguage %}
{% endfor %}
</html>
$.ajax({
method: "POST",
url: '/invite/',
data: {
'email': email.val(),
'csrfmiddlewaretoken': CSRF_TOKEN,
'language':lang
},
success: function(response, status) {
alert(response['msg']);
dialog.dialog( "close" );
},
error: function(response) {
alert("Error");
dialog.dialog( "close" );
}
});
<script >var CSRF_TOKEN = "{{ csrf_token }}"</script>