-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
21 lines (16 loc) · 704 Bytes
/
models.py
File metadata and controls
21 lines (16 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from app import db
from datetime import datetime
class PageViews(db.Model):
__tablename__ = 'PageViews'
view_num = db.Column(db.Integer, primary_key=True, autoincrement=True)
ip_address = db.Column(db.String(), index=True)
location = db.Column(db.String())
time_stamp = db.Column(db.DateTime(timezone=True))
def __init__(self, ip_address, location, time_stamp):
self.ip_address = ip_address
self.location = location
self.time_stamp = time_stamp
def __repr__(self):
return '<View #{} from {} [{}] at {}>'.format(self.view_num, self.location,
self.ip_address, self.time_stamp)
db.create_all()