aboutsummaryrefslogtreecommitdiffstats
path: root/python/Dawn/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/Dawn/models.py')
-rw-r--r--python/Dawn/models.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/python/Dawn/models.py b/python/Dawn/models.py
index afee6917..432c9c70 100644
--- a/python/Dawn/models.py
+++ b/python/Dawn/models.py
@@ -64,17 +64,20 @@ class BondDeal(db.Model):
trade_date = db.Column(db.Date, nullable = False, default = datetime.date.today)
settle_date = db.Column(db.Date, nullable = False, default =
lambda : datetime.date.today() + datetime.timedelta(3))
- cusip = db.Column(db.String(9), info={'validators': Length(9,9)})
- isin = db.Column(db.String(12), info={'validator': Length(12, 12)})
- description = db.Column(db.String(32))
+ cusip = db.Column(db.String(9), info={'validators': Length(9,9),
+ 'filters': [lambda x: x or None]})
+ isin = db.Column(db.String(12), info={'validators': Length(12, 12),
+ 'filters': [lambda x: x or None]})
+ description = db.Column(db.String(32), nullable=False)
buysell = db.Column(db.Boolean, nullable = False, info={'choices':[(0, 'sell'), (1, 'buy')]})
faceamount = db.Column(db.Float, nullable=False)
price = db.Column(db.Float, nullable=False)
account = db.Column(db.String(10))
- accrued = db.Column(db.Float)
+ accrued = db.Column(db.Float, nullable = False)
asset_class = db.Column(ASSET_CLASS)
ticket = db.Column(db.String, info={'form_field_class': FileField})
counterparty = db.relationship(Counterparties)
+ __table_args__= (db.CheckConstraint('cusip is not Null or isin is not Null'),)
BaseModelForm = model_form_factory(Form)
class ModelForm(BaseModelForm):