We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b7dfb93 commit 7b179d5Copy full SHA for 7b179d5
app/models.py
@@ -0,0 +1,31 @@
1
+# -*- encoding: utf-8 -*-
2
+"""
3
+Copyright (c) 2019 - present AppSeed.us
4
5
+
6
+from app import db
7
8
+class Stats(db.Model):
9
10
+ id = db.Column(db.Integer, primary_key=True )
11
+ month = db.Column(db.String(64), unique=True )
12
+ sold_units = db.Column(db.Integer )
13
14
+ def __init__(self, id, month, sold_units):
15
+ self.id = id
16
+ self.month = month
17
+ self.sold_units = sold_units
18
19
+ def __repr__(self):
20
+ return self.month + ' - ' + str(self.sold_units)
21
22
+ # Optional helper
23
+ def save(self):
24
25
+ # inject self into db session
26
+ db.session.add ( self )
27
28
+ # commit change and save the object
29
+ db.session.commit( )
30
31
+ return self
0 commit comments