-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfill_catalog.py
336 lines (261 loc) · 19 KB
/
fill_catalog.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Category, Item
#from flask.ext.sqlalchemy import SQLAlchemy
from random import randint
import datetime
import random
engine = create_engine('sqlite:///catalog.db')
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSession()
# Delete all the categories to avoid repetition
session.query(Category).delete()
session.commit()
# Delete all the items to avoid repetition
session.query(Item).delete()
session.commit()
# Start new entries
# Creating a new Category
category1 = Category(name="Cricket")
session.add(category1)
session.commit()
# Creating an item in the category
item1 = Item(name="Bat", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category1)
session.add(item1)
session.commit()
item1 = Item(name="Ball", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category1)
session.add(item1)
session.commit()
item2 = Item(name="Batting Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category1)
session.add(item2)
session.commit()
item3 = Item(name="Helmet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category1)
session.add(item3)
session.commit()
item4 = Item(name="Leg Pads", description="Leg pads serve to protect the legs from impact by a hard ball or puck at high speed which could otherwise cause injuries to the lower leg.",
price="$7.50", size="Large", category=category1)
session.add(item4)
session.commit()
item5 = Item(name="Wicket-keeper's Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category1)
session.add(item5)
session.commit()
item6 = Item(name="Abdominal Guard", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category1)
session.add(item6)
session.commit()
category2 = Category(name="Hockey")
session.add(category2)
session.commit()
item7 = Item(name="Stick", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category2)
session.add(item7)
session.commit()
item8 = Item(name="Hockey Ball", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category2)
session.add(item8)
session.commit()
item9 = Item(name="Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category2)
session.add(item9)
session.commit()
item10 = Item(name="Helmet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category2)
session.add(item10)
session.commit()
item11 = Item(name="Leg pads", description="Leg pads serve to protect the legs from impact by a hard ball or puck at high speed which could otherwise cause injuries to the lower leg.",
price="$7.50", size="Large", category=category2)
session.add(item11)
session.commit()
item12 = Item(name="Abdominal guard", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category2)
session.add(item12)
session.commit()
category3 = Category(name="Football")
session.add(category3)
session.commit()
item13 = Item(name="Soccer Cleats", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category3)
session.add(item13)
session.commit()
item14 = Item(name="Soccer Ball", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category3)
session.add(item14)
session.commit()
item15 = Item(name="Goalkeeper's Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category3)
session.add(item15)
session.commit()
item16 = Item(name="Shin Guards", description="Shin guards serve to protect the legs from impact by a hard ball or puck at high speed which could otherwise cause injuries to the lower leg.",
price="$7.50", size="Large", category=category3)
session.add(item16)
session.commit()
item17 = Item(name="Abdominal guard", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category3)
session.add(item17)
session.commit()
category4 = Category(name="Tennis")
session.add(category4)
session.commit()
item18 = Item(name="Tennis Racquet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category4)
session.add(item18)
session.commit()
item19 = Item(name="Tennis Ball", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category4)
session.add(item19)
session.commit()
category5 = Category(name="Baseball")
session.add(category5)
session.commit()
item20 = Item(name="Bat", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item20)
session.commit()
item21 = Item(name="Baseballs", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item21)
session.commit()
item22 = Item(name="Batting Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item22)
session.commit()
item1 = Item(name="Batter's Helmet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item1)
session.commit()
item1 = Item(name="Leg Guards", description="Leg pads serve to protect the legs from impact by a hard ball or puck at high speed which could otherwise cause injuries to the lower leg.",
price="$7.50", size="Large", category=category5)
session.add(item1)
session.commit()
item1 = Item(name="Catcher's Helmet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item1)
session.commit()
item1 = Item(name="Chest Protectors", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item1)
session.commit()
item1 = Item(name="Abdominal guard", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category5)
session.add(item1)
session.commit()
category6 = Category(name="Biking")
session.add(category6)
session.commit()
item1 = Item(name="Mountain Bike", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$500.00", size="Medium", category=category6)
session.add(item1)
session.commit()
item1 = Item(name="Road Bike", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$800.00", size="Large", category=category6)
session.add(item1)
session.commit()
item1 = Item(name="Commute Bike", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$450.00", size="Large", category=category6)
session.add(item1)
session.commit()
item1 = Item(name="Helmet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category6)
session.add(item1)
session.commit()
item1 = Item(name="Comfy seat", description="Leg pads serve to protect the legs from impact by a hard ball or puck at high speed which could otherwise cause injuries to the lower leg.",
price="$8.50", size="Large", category=category6)
session.add(item1)
session.commit()
item1 = Item(name="Bike Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category6)
session.add(item1)
session.commit()
category7 = Category(name="Snowboarding")
session.add(category7)
session.commit()
item1 = Item(name="Snow Board", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category7)
session.add(item1)
session.commit()
item1 = Item(name="Winter Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category7)
session.add(item1)
session.commit()
item1 = Item(name="Helmet", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Medium", category=category7)
session.add(item1)
session.commit()
item1 = Item(name="Sun-glasses", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category7)
session.add(item1)
session.commit()
category8 = Category(name="Skiing")
session.add(category8)
session.commit()
item1 = Item(name="Snow Jacket", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category8)
session.add(item1)
session.commit()
item1 = Item(name="Jumper", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category8)
session.add(item1)
session.commit()
item1 = Item(name="Ski Gloves", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category8)
session.add(item1)
session.commit()
item1 = Item(name="Ski Poles", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category8)
session.add(item1)
session.commit()
category9 = Category(name="Volleyball")
session.add(category9)
session.commit()
item1 = Item(name="Shorts", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category9)
session.add(item1)
session.commit()
item1 = Item(name="Ball", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category9)
session.add(item1)
session.commit()
item1 = Item(name="Net", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category9)
session.add(item1)
session.commit()
item1 = Item(name="Poles", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$7.50", size="Large", category=category9)
session.add(item1)
session.commit()
category10 = Category(name="Basketball")
session.add(category10)
session.commit()
category11 = Category(name="Fencing")
session.add(category11)
session.commit()
item1 = Item(name="Sword", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$200.00", size="Large", category=category11)
session.add(item1)
session.commit()
item2 = Item(name="Plastron", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$100.00", size="Large", category=category11)
session.add(item2)
session.commit()
item3 = Item(name="Glove", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$20.00", size="Large", category=category11)
session.add(item3)
session.commit()
item4 = Item(name="Chest protector", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$150.50", size="Large", category=category11)
session.add(item4)
session.commit()
item5 = Item(name="Mask", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$175.50", size="Large", category=category11)
session.add(item5)
session.commit()
item6 = Item(name="Breeches/Knickers ", description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget ligula convallis, pellentesque tortor id, aliquet dui. Vestibulum vulputate ultricies nisi. Vivamus fringilla lacinia sodales.",
price="$178.50", size="Large", category=category11)
session.add(item6)
session.commit()