diff options
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) |