def createUser(name, email, picture):
	user = User(name=name, email=email)
	session.add(user)
	session.commit()
	newUserID = session.query(User).filter_by(email=email).one().id
	if picture.startswith("https"):
		attach_picture_url(User, newUserID, picture)
	else:
		attach_picture(User, newUserID, picture)
예제 #2
0
def create_user(name, email, picture):
    user = User(name=name, email=email)
    session.add(user)
    session.commit()
    new_user_id = session.query(User).filter_by(email=email).one().id
    if picture.startswith("https"):
        attach_picture_url(User, new_user_id, picture)
    else:
        attach_picture(User, new_user_id, picture)
				error = False
				adclot = AdcLot(date=createRandomDate(),
					  aggregate=randint(0, 5)+round(random(), 2),
					  endotoxin=randint(0, 10)+round(random(), 2),
					  concentration=randint(0, 10)+round(random(), 2),
					  vialVolume=choice([1, 0.2, 0.5]),
					  vialNumber=randint(1, 100),
					  adc_id=randomlot,
					  antibodylot_id=id1,
                      cytotoxinlot_id=id2,
					  user_id=randint(1, 3))
        session.add(adclot)
        session.commit()


if __name__ == '__main__':
	createUser('Wiseley Wu', '*****@*****.**', 'https://lh6.googleusercontent.com/-45KCJFuShPk/AAAAAAAAAAI/AAAAAAAArRw/E7__AYvGSOQ/photo.jpg')
	createUser('John Doe', '*****@*****.**', os.path.join(app_path, 'static/images/user.png'))
	createUser('Jane Doe', '*****@*****.**', os.path.join(app_path, 'static/images/user.png'))
	createAntibody()
	createAntibodyLot()
	createCytotoxin()
	createCytotoxinLot()
	createADC()
	createADCLot()
	for x in range(1,6):
	    attach_picture(Antibody, x, os.path.join(app_path, 'static/images/antibody.png'))
	    attach_picture(Cytotoxin, x, os.path.join(app_path, 'static/images/cytotoxin.png'))
	    attach_picture(Adc, x, os.path.join(app_path, 'static/images/adc.png'))
	print 'Database Populated'
예제 #4
0
                                adc_id=randomlot,
                                antibodylot_id=id1,
                                cytotoxinlot_id=id2,
                                user_id=randint(1, 3))
        session.add(adclot)
        session.commit()


if __name__ == '__main__':
    create_user(
        'Wiseley Wu', '*****@*****.**',
        'https://lh6.googleusercontent.com/-45KCJFuShPk/AAAAAAAAAAI/AAAAAAAArRw/E7__AYvGSOQ/photo.jpg'
    )
    create_user('John Doe', '*****@*****.**',
                os.path.join(app_path, 'static/images/user.png'))
    create_user('Jane Doe', '*****@*****.**',
                os.path.join(app_path, 'static/images/user.png'))
    create_antibody()
    create_antibody_lot()
    create_cytotoxin()
    create_cytotoxin_lot()
    create_adc()
    create_adc_lot()
    for x in range(1, 6):
        attach_picture(Antibody, x,
                       os.path.join(app_path, 'static/images/antibody.png'))
        attach_picture(Cytotoxin, x,
                       os.path.join(app_path, 'static/images/cytotoxin.png'))
        attach_picture(Adc, x, os.path.join(app_path, 'static/images/adc.png'))
    print 'Database Populated'