Skip to content

Saving language does not update the session #387

@frlan

Description

@frlan

When using account_settings to save changes for a user -- e.g. language -- it's getting updated in database, but does not update the users's session

I think it should upgrade the language for the user to the just picked one

I did a q'n'dirty fix for my project by little updating the original one

class SettingsView(account.views.SettingsView):
    template_name = "user_home.html"

    def form_valid(self, form):
        response = super().form_valid(form)
        lang = form.cleaned_data["language"]
        translation.activate(lang)
        response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang)
        return response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions