-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
55 lines (41 loc) · 945 Bytes
/
models.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
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
db = SQLAlchemy()
class UserImage(db.Model):
"""Image."""
__tablename__ = "images"
filename = db.Column(
db.String,
primary_key=True
)
published = db.Column(
db.Boolean,
nullable=False,
default=False
)
filter = db.Column(
db.String,
nullable=False,
default='none'
)
description = db.Column(
db.String,
nullable=True
)
content_type = db.Column(
db.String,
nullable=False
)
exifdata = db.Column(
db.String,
nullable=True
)
timestamp = db.Column(
db.DateTime,
nullable=False,
default=datetime.utcnow,
)
def connect_db(app):
"""Connect to database."""
db.app = app
db.init_app(app)