-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (33 loc) · 1.09 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
from tbay import session, Item, User, Bid
chris = User()
chris.username = "rosuav"
chris.password = "thinkful"
session.add(chris)
session.commit()
ashley = User(username = "ashybon", password = "Ashl3y")
session.add(ashley)
session.commit()
lianna = User(username = "nuki", password = "liannaliannal1ann4")
session.add(lianna)
session.commit()
baseball = Item()
baseball.name = "Giants World Series 2014"
baseball.description = "Foul ball in game 2"
chris.items.append(baseball)
session.add(baseball)
session.commit()
guitar = Item(name = "Fender", description = "rock out with this electric guitar")
ashley.items.append(guitar)
session.add(guitar)
session.commit()
bid_ashley = Bid(price = 5000, item = baseball, bidder = ashley)
session.add(bid_ashley)
session.commit()
bid_lianna = Bid(price = 2500, item = baseball, bidder = lianna)
session.add(bid_lianna)
session.commit()
highest_bid = session.query(Bid).filter(Bid.item==baseball).order_by(Bid.price.desc()).first()
#bid = session.query(Bid).(baseball)
#session.query(Bid).filter(price>3000)
print highest_bid.bidder.username