forked from crisbal/Flask-Blog-Blueprint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
72 lines (52 loc) · 1.21 KB
/
setup.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
from blog.models import *
db.connect()
print("Creating 'Post' Table")
Post.create_table(True)
p1 = Post()
p1.title = "POST 1"
p1.url = p1.create_url(p1.title)
p1.body="Lorem ipsum dolor sit amet, consectetur adipisicing elit."
p1.short_description = "Description of post 1"
p1.save()
p2 = Post()
p2.title = "POST 2"
p2.url = p2.create_url(p2.title)
p2.body="Lorem ipsum dolor sit amet, consectetur adipisicing elit."
p2.short_description = "Description of post 2"
p2.save()
p3 = Post()
p3.title = "POST 3"
p3.url = p3.create_url(p3.title)
p3.body="Lorem ipsum dolor sit amet, consectetur adipisicing elit."
p3.short_description = "Description of post 3"
p3.save()
print("Creating 'Tag' Table")
Tag.create_table(True)
tag1 = Tag()
tag1.tag = "test"
tag1.save()
tag2 = Tag()
tag2.tag = "test2"
tag2.save()
tag3 = Tag()
tag3.tag = "test3"
tag3.save()
print("Creating 'Post_To_Tag' Table")
Post_To_Tag.create_table(True)
pt1_p1 = Post_To_Tag()
pt1_p1.tag = tag1
pt1_p1.post = p1
pt1_p1.save()
pt2_p1 = Post_To_Tag()
pt2_p1.tag = tag2
pt2_p1.post = p1
pt2_p1.save()
pt3_p3 = Post_To_Tag()
pt3_p3.tag = tag3
pt3_p3.post = p3
pt3_p3.save()
pt4_p2 = Post_To_Tag()
pt4_p2.tag = tag1
pt4_p2.post = p2
pt4_p2.save()
db.close()