Ejemplo n.º 1
0
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'])
Ejemplo n.º 2
0
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,
    )
Ejemplo n.º 3
0
Archivo: views.py Proyecto: PyCon/pycon
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'])
Ejemplo n.º 4
0
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'])