-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdb_seed.py
112 lines (91 loc) · 2.63 KB
/
db_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
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
#!flask/bin/python
from app import models, db
from datetime import datetime
section_sample = models.Section(name = "humor",
slug = "humorstuff",
description = "this is the humor department",
parent_slug = "humor")
subsection_sample = models.Subsection(name = "year_review",
slug = "more_humor_stuff",
description = "this is humor department",
)
article_sample = models.Article(
title = "george thingy",
slug = "george_thingy",
content = "good riddance and thank god",
date_time = datetime.today(),
volume = 111,
issue = 12,
is_draft = False,
section = section_sample,
subsection = subsection_sample
)
more_sample = models.Article(
title = "jason thingy",
slug = "jason_thingy",
content = "gasdsaood riddance and thank god",
date_time = datetime.today(),
volume = 111,
issue = 12,
is_draft = False,
section = section_sample,
subsection = subsection_sample
)
db.session.add(section_sample)
db.session.add(subsection_sample)
db.session.add(article_sample)
db.session.add(more_sample)
db.session.commit()
article_sample = models.Article(
title = "geoasdsadrge potato",
slug = "geoasfe_thingy",
content = "good fsafagod",
date_time = datetime.today(),
volume = 5,
issue = 112,
is_draft = False,
section = section_sample,
subsection = subsection_sample
)
more_sample = models.Article(
title = "jasonasnj thingy",
slug = "jasond_thingy",
content = "gsfaafagod",
date_time = datetime.today(),
volume = 5,
issue = 112,
is_draft = True,
section = section_sample,
subsection = subsection_sample
)
db.session.add(article_sample)
db.session.add(more_sample)
db.session.commit()
issuu_one = models.Issuu(code = "111/12",
volume = 111,
issue = 12)
issuu_two = models.Issuu(code = "5/112",
volume = 5,
issue = 112)
db.session.add(issuu_one)
db.session.add(issuu_two)
db.session.commit()
issuu_one = models.User(
first_name = "jason",
last_name = "kao",
username = "jkao",
password = "donut",
email = "jkao@stuy.edu",
description = "avocado"
)
issuu_two = models.User(
first_name = "geprge",
last_name = "zheng",
username = "gz",
password = "asad",
email = "gzhen@stuy.edu",
description = "peanut"
)
db.session.add(issuu_one)
db.session.add(issuu_two)
db.session.commit()