Beispiel #1
0
def applicants_view():
    appliers = applicants.get_applicants(db.session)
    if request.method == 'GET':
        return render_template('applicants.html', applicants=appliers)
    elif request.method == 'POST':
        if 'applicant-accept' in request.form:
            applicants.accept_applicant(db.session, int(request.form['applicant-accept']), current_user)
            db.session.commit()
            return redirect(url_for('applicants_view'))
        elif 'applicant-reject' in request.form:
            applicants.reject_applicant(db.session, int(request.form['applicant-reject']), current_user)
            db.session.commit()
            return redirect(url_for('applicants_view'))
        else:
            return redirect(url_for('user_profile'))
Beispiel #2
0
def applicants_view():
    appliers = applicants.get_applicants(db.session)
    if request.method == 'GET':
        return render_template('applicants.html', applicants=appliers)
    elif request.method == 'POST':
        if 'applicant-accept' in request.form:
            applicants.accept_applicant(db.session,
                                        int(request.form['applicant-accept']),
                                        current_user)
            db.session.commit()
            return redirect(url_for('applicants_view'))
        elif 'applicant-reject' in request.form:
            applicants.reject_applicant(db.session,
                                        int(request.form['applicant-reject']),
                                        current_user)
            db.session.commit()
            return redirect(url_for('applicants_view'))
        else:
            return redirect(url_for('user_profile'))
Beispiel #3
0
    db.drop_all()

    db.create_all()

    print 'Tables created...'

    if args.opt == 'production':
        # Do a real install...
        # Don't know what that will look like yet?
        print 'Create a user'
        print '-------------'
        name = raw_input('Name: ')
        try:
            password = getpass.getpass()
        except getpass.GetPassWarning:
            print '***WARNING: Password may be visible in the terminal!'
            password = getpass.getpass()
        email = raw_input('Email: ')

        user = users.create_user(db.session, name, password, email)
        applicant = applicants.create_applicant(db.session, user, 'ingroup creator')
        db.session.flush()
        applicants.accept_applicant(db.session, applicant.id, user)
        db.session.commit()
        print 'User successfully created.'
    else:
        # Don't add any defaults to the database.
        print 'Note: Tables are empty without data.'

print 'Done.'