-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock_data.py
129 lines (115 loc) · 3.32 KB
/
mock_data.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
from models import Venue, Artist, Show, Show, Genre, Venue_Genre, Artist_Genre, Area
import faker, random
choices=[
('AL', 'AL'),
('AK', 'AK'),
('AZ', 'AZ'),
('AR', 'AR'),
('CA', 'CA'),
('CO', 'CO'),
('CT', 'CT'),
('DE', 'DE'),
('DC', 'DC'),
('FL', 'FL'),
('GA', 'GA'),
('HI', 'HI'),
('ID', 'ID'),
('IL', 'IL'),
('IN', 'IN'),
('IA', 'IA'),
('KS', 'KS'),
('KY', 'KY'),
('LA', 'LA'),
('ME', 'ME'),
('MT', 'MT'),
('NE', 'NE'),
('NV', 'NV'),
('NH', 'NH'),
('NJ', 'NJ'),
('NM', 'NM'),
('NY', 'NY'),
('NC', 'NC'),
('ND', 'ND'),
('OH', 'OH'),
('OK', 'OK'),
('OR', 'OR'),
('MD', 'MD'),
('MA', 'MA'),
('MI', 'MI'),
('MN', 'MN'),
('MS', 'MS'),
('MO', 'MO'),
('PA', 'PA'),
('RI', 'RI'),
('SC', 'SC'),
('SD', 'SD'),
('TN', 'TN'),
('TX', 'TX'),
('UT', 'UT'),
('VT', 'VT'),
('VA', 'VA'),
('WA', 'WA'),
('WV', 'WV'),
('WI', 'WI'),
('WY', 'WY'),
]
def seed_venues():
for i in range(15):
fake = faker.Faker()
# i need the same image size
area = Area(city=fake.city(), state=random.choice(choices)
)
area.add()
venue = Venue(
name = fake.company(),
address = fake.address(),
phone = fake.phone_number(),
facebook_link = fake.url(),
image_link = fake.image_url(width=800, height=600),
website_link = fake.url(),
seeking_talent = True,
seeking_description = fake.text(),
area = area
)
venue.add()
for i in range(3):
genre = Genre(name=fake.word())
genre.add()
venue_genre = Venue_Genre(venue=venue, genre=genre)
venue_genre.add()
print("venues seeded")
def seed_artists():
for i in range(20):
fake = faker.Faker()
artist = Artist(
name = fake.name(),
phone = fake.phone_number(),
facebook_link = fake.url(),
image_link = fake.image_url(width=800, height=600),
website_link = fake.url(),
seeking_venue = True,
seeking_description = fake.text()
)
artist.add()
for i in range(3):
genre = Genre(name=fake.word())
genre.add()
artist_genre = Artist_Genre(artist=artist, genre=genre)
artist_genre.add()
print("artists seeded")
def seed_shows():
venues = Venue.query.all()
artists = Artist.query.all()
for i in range(20):
fake = faker.Faker()
show = Show(
venue = random.choice(venues),
artist = random.choice(artists),
start_time = fake.date_time()
)
show.add()
print("shows seeded")
def seed_database():
seed_venues()
seed_artists()
seed_shows()