def change_language(request): form = LanguageForm(request.POST) if form.is_valid(): language = form.cleaned_data['language'] request.session['django_language'] = language if request.user.is_authenticated(): account = request.user.account account.language = language account.save() return redirect(request.POST['next'])
def dashboard(request): if request.session.get("pending-token"): return redirect("speaker_create_token", request.session["pending-token"]) context = {'proposals_are_open': bool(ProposalSection.available()), } context.update(financial_aid(request)) if constance.config.SHOW_LANGUAGE_SELECTOR: context['language_form'] = LanguageForm( initial={'language': request.LANGUAGE_CODE}) return render( request, "dashboard.html", context, )
def change_language(request): form = LanguageForm(request.POST) if form.is_valid(): request.session['django_language'] = form.cleaned_data['language'] return redirect(request.POST['next'])