

@login_required
def preferences(request):
    if (request.method == 'POST'):
        for formdef in parameters.get_user_forms(request.user, request.POST):
            form = formdef['form']
            if form.is_valid():
                form.save()
                continue
            return render_to_json_response({
                'prefix': form.app,
                'form_errors': form.errors,
            }, status=400)
        return render_to_json_response(_('Preferences saved'))
    return render_to_json_response({
        'content': _render_to_string(request, 'core/user_preferences.html', {
            'forms': parameters.get_user_forms(request.user),
        }),
    })

dataset/ETHPy150Open tonioo/modoboa/modoboa/core/views/user.py preferences/original