Пример #1
0
def has_user_done_register_step_2(user):
    '''
    Returns whether or not, to the best of our knowledge, the user
    has completed step 2 (or a later step) of registration yet.
    '''

    return len(user.skills) > 0 or RegisterStep2Form.is_not_empty(user)
Пример #2
0
def get_best_registration_step_url(user):
    '''
    Assuming the user is not yet fully registered, returns the URL
    of the most appropriate step in the registration flow for
    them to complete.
    '''

    if len(user.skills) > 0 or RegisterStep2Form.is_not_empty(user):
        return url_for('views.register_step_3')
    return url_for('views.register_step_2')
Пример #3
0
Файл: views.py Проект: tekd/noi2
def get_best_registration_step_url(user):
    '''
    Assuming the user is not yet fully registered, returns the URL
    of the most appropriate step in the registration flow for
    them to complete.
    '''

    if len(user.skills) > 0 or RegisterStep2Form.is_not_empty(user):
        return url_for('views.register_step_3')
    return url_for('views.register_step_2')
Пример #4
0
def register_step_2():
    '''
    Let user edit a simplified version of their profile as part
    of their registration.
    '''

    form = RegisterStep2Form(obj=current_user)
    if request.method == 'POST':
        if form.validate():
            form.populate_obj(current_user)
            db.session.add(current_user)
            db.session.commit()
            return redirect(url_for('views.register_step_3'))
        else:
            flash(gettext(u'Could not save, please correct errors below'))

    return render_template('register-step-2.html', form=form)