diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2016-01-09 23:42:55 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2016-05-01 17:26:45 +0200 |
commit | 23a8a11f0d21cc1b7fb27752c20980b942fa5200 (patch) | |
tree | 51891f7779d2b04359317facd9a66a1c16363e2a | |
parent | 56a5369853a90c5a2689eaf5786f21b7f3e73731 (diff) | |
download | kosten-23a8a11f0d21cc1b7fb27752c20980b942fa5200.tar.gz kosten-23a8a11f0d21cc1b7fb27752c20980b942fa5200.tar.bz2 kosten-23a8a11f0d21cc1b7fb27752c20980b942fa5200.zip |
Removed base 'Expense' class; introduce CategoryModel instead
Diffstat (limited to '')
-rw-r--r-- | app/model.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/model.py b/app/model.py index ec555d3..5ae2ead 100644 --- a/app/model.py +++ b/app/model.py @@ -102,15 +102,12 @@ class Category (UserModel): return '<Category "%s">' % self.name -class Expense (UserModel): +class CategoryModel (db.Model): """Abstract base class for expenses: Adds the common fields and establishes the connection to `Category`. """ __abstract__ = True - description = Column(db.Unicode(50)) - expense = ReqColumn(ExpNum) - @declared_attr def category_id(cls): return ReqColumn(db.Integer, db.ForeignKey(Category.id)) @@ -120,7 +117,9 @@ class Expense (UserModel): return db.relationship(Category, innerjoin = True) -class SingleExpense (Expense): +class SingleExpense (UserModel, CategoryModel): + description = Column(db.Unicode(50)) + expense = ReqColumn(ExpNum) year = ReqColumn(db.Integer) month = ReqColumn(db.SmallInteger) day = ReqColumn(db.SmallInteger) @@ -140,7 +139,9 @@ class SingleExpense (Expense): self.day = d.day -class ConstExpense (Expense): +class ConstExpense (UserModel, CategoryModel): + description = Column(db.Unicode(50)) + expense = ReqColumn(ExpNum) months = ReqColumn(db.SmallInteger) start = ReqColumn(db.Date, index = True) end = ReqColumn(db.Date, index = True) |