示例#1
0
    def select_languages(self, rdata, user):
        form = SelectLanguageForm(rdata)

        response = RpcHttpResponse()

        if form.is_valid():
            form.save(user, response)

        return response
示例#2
0
文件: rpc.py 项目: adncentral/unisubs
 def select_languages(self, rdata, user):
     form = SelectLanguageForm(rdata)
     
     response = RpcHttpResponse()
     
     if form.is_valid():
         form.save(user, response)
         
     return response
示例#3
0
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']
    }
示例#4
0
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)
    }