-
Notifications
You must be signed in to change notification settings - Fork 1
/
seed.py
56 lines (46 loc) · 1.01 KB
/
seed.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
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Seed file for sample data"""
from models import db, User, SavedSearch
from app import app
# Drop all tables, and create them
db.drop_all()
db.create_all()
# Sample users
u1 = User.signup(
username = 'DemoUser',
email='[email protected]',
password='password',
)
u2 = User.signup(
username = 'BobsonDugnutt99',
email='[email protected]',
password='dumdumdum',
)
u3 = User.signup(
username = 'SmeveMcBichael05',
email='[email protected]',
password='banana',
)
db.session.add_all([u1, u2, u3])
db.session.commit()
s1 = SavedSearch(
user_id=u2.id,
name="My favorite Poo-poo spot",
query_string="",
lon=37.954,
lat=-75.944,
accessible=False,
unisex=True,
changing_table=False,
)
s2 = SavedSearch(
user_id=u2.id,
name="My second favorite Poo-poo spot",
query_string="",
lon=31.05714,
lat=75.75145,
accessible=False,
unisex=False,
changing_table=False,
)
db.session.add_all([s1, s2])
db.session.commit()