fixing language swticher

This commit is contained in:
Levi 2017-01-13 12:26:03 -05:00
parent 83b135763d
commit 896c07930b
2 changed files with 11 additions and 4 deletions

View file

@ -72,14 +72,14 @@
<li> <li>
<select class="selectpicker" data-width="fit" onchange="location = this.value;" style="margin-top:10px;"> <select class="selectpicker" data-width="fit" onchange="location = this.value;" style="margin-top:10px;">
{% if LANGUAGE_CODE == 'en-us'%} {% if LANGUAGE_CODE == 'en-us'%}
<option selected="selected" value="http://localhost:8000/en-us/datacenterlight/">English</option> <option selected="selected" value="{{base_url}}/en-us/datacenterlight/">English</option>
{% else %} {% else %}
<option value="http://localhost:8000/en-us/datacenterlight/">English</option> <option value="{{base_url}}/en-us/datacenterlight/">English</option>
{% endif %} {% endif %}
{% if LANGUAGE_CODE == 'de'%} {% if LANGUAGE_CODE == 'de'%}
<option selected="selected" value="http://localhost:8000/de/datacenterlight/">Deutsch</option> <option selected="selected" value="{{base_url}}/de/datacenterlight/">Deutsch</option>
{% else %} {% else %}
<option value="http://localhost:8000/de/datacenterlight/">Deutsch</option> <option value="{{base_url}}/de/datacenterlight/">Deutsch</option>
{% endif %} {% endif %}
</select> </select>

View file

@ -18,6 +18,13 @@ class IndexView(CreateView):
success_url += "#requestform" success_url += "#requestform"
return success_url return success_url
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context.update({
'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host())
})
return context
def form_valid(self, form): def form_valid(self, form):
context = { context = {