Ejemplo n.º 1
0
jaimie = User()
jaimie.username = "******"
jaimie.password = "******"
session.add(jaimie)
session.commit()

#make one user auction a baseball
'''
baseball = Item(name='1986 World Series Baseball', description='A baseball signed by the 1986 NY Mets', start_time='', owner=jp)
'''

baseball = Item()
baseball.name='1986 World Series Baseball'
baseball.description='A baseball signed by the 1986 NY Mets'
baseball.user=jp
session.add(baseball)
session.commit()

#Have each other user place two bids on the baseball
'''
bid1 = Bid(price=75.00, bidder=jenna, auction_item=baseball)
'''

bid1 = Bid()
bid1.price=75.00
bid1.bidder=jenna
bid1.item=baseball
session.add(bid1)
session.commit()
Ejemplo n.º 2
0
jp.username = "******"
jp.password = "******"
session.add(jp)
session.commit()

jenna = User()
jenna.username = "******"
jenna.password = "******"
session.add(jenna)
session.commit()


baseball = Item()
baseball.name='1986 World Series Baseball'
baseball.description='A baseball signed by the 1986 NY Mets'
baseball.user=jp
session.add(baseball)
session.commit()

shirt = Item()
shirt.name='U2 World Tour'
shirt.description='A T-Shirt from the U2 1989 World Tour'
shirt.user=jenna
session.add(shirt)
session.commit()

"""
#make one user auction a baseball
'''
baseball = Item(name='1986 World Series Baseball', description='A baseball signed by the 1986 NY Mets', start_time='', owner=jp)
'''
Ejemplo n.º 3
0
from tbay import Item, User, Bid, session

jp = User()
jp.username = "******"
jp.password = "******"
session.add(jp)
session.commit()

jenna = User()
jenna.username = "******"
jenna.password = "******"
session.add(jenna)
session.commit()

toy = Item()
toy.name = "boat"
toy.user = jp
session.add(toy)
session.commit()

user_jp = session.query(User).filter(User.username == "jpc").first()
print(user_jp)
print(user_jp.username)
print(jp.items)

find_users = session.query(User).all()
print(find_users)