예제 #1
0
파일: manage.py 프로젝트: abishek/hawkers
def populatevendor() :
    populateadmin()
    from hawkers.models import db, User
    
    # add a vendor user
    vendor_user = User()
    vendor_user.first_name = 'Test'
    vendor_user.last_name = 'Vendor'
    vendor_user.login = '******'
    vendor_user.email = '*****@*****.**'
    vendor_user.password = generate_password_hash('vndrP')
    vendor_user.hawker = None
    vendor_user.is_admin = False
    db.session.add(vendor_user)
    db.session.commit()
예제 #2
0
파일: manage.py 프로젝트: abishek/hawkers
def populateadmin() :
	from hawkers.models import db, User
	print User.query.delete(), " rows deleted from User"
	
	# add admin user
	admin_user = User()
	admin_user.first_name = 'Admin'
	admin_user.last_name = 'istrator'
	admin_user.login = '******'
	admin_user.email = '*****@*****.**'
	admin_user.password = generate_password_hash(app.config['ADMIN_PASSWORD'])
	admin_user.hawker = None
	admin_user.is_admin = True
	db.session.add(admin_user)
	db.session.commit()
예제 #3
0
파일: vendors.py 프로젝트: abishek/hawkers
def add_owner() :
    user_form = UserForm(request.form)

    if request.method == 'POST' and user_form.validate() :
        user = User()
        user.first_name = user_form.first_name.data
        user.last_name = user_form.last_name.data
        user.login = user_form.login.data
        user.email = user_form.email.data
        user.password = generate_password_hash(user.login)
        db.session.add(user)
        db.session.commit()
        return redirect(url_for('vendor_page.index'))

    return render_template('addowner.html', form=user_form)