STATIC_ROOT = os.path.join(BASE_DIR, 'collect_static/')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
var list = {{ car.get_date }}
DatesDisabled: list,
location /static/ {
alias /home/.../django_project/static/;
}
<form action="/your-name/" method="post">
{% csrf_token %}
{{ form }}
<input type="submit" value="Submit" />
</form>
$.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>
var lang = $('html').attr('lang');
$.ajax({
method: "POST",
url: '/invite/',
data: {
'csrfmiddlewaretoken': CSRF_TOKEN,
'language':lang
},
translation.activate(request.POST['language'])
............
#: 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>