def select_languages(self, rdata, user): form = SelectLanguageForm(rdata) response = RpcHttpResponse() if form.is_valid(): form.save(user, response) return response
def select_language_form(context): user_langs = get_user_languages_from_request(context['request'], guess=False) initial_data = {} for i, l in enumerate(user_langs): initial_data['language%s' % (i+1)] = l form = SelectLanguageForm(initial=initial_data) return { 'form': form, 'redirect' : 'redirect' in context and context['redirect'] }
def select_language_dialog(context, option=None): user_langs = get_user_languages_from_request(context['request']) initial_data = {} for i, l in enumerate(user_langs): initial_data['language%s' % (i + 1)] = l form = SelectLanguageForm(initial=initial_data) return { 'form': form, 'force_ask': (option == 'force') and _user_needs_languages(context) }