summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2017-04-21 17:54:50 +0200
committerPiotr Dobrowolski <admin@tastycode.pl>2017-04-21 17:54:50 +0200
commit41e652776d16e6cb0067e77464a913e1cf71d9be (patch)
treec2f38548a43f009e7d44872de2f0611da90266d2
parent13e62699690e98ec13cf68da0c5672f647ca2306 (diff)
downloadbitvend-41e652776d16e6cb0067e77464a913e1cf71d9be.tar.gz
bitvend-41e652776d16e6cb0067e77464a913e1cf71d9be.tar.bz2
bitvend-41e652776d16e6cb0067e77464a913e1cf71d9be.tar.xz
bitvend-41e652776d16e6cb0067e77464a913e1cf71d9be.zip
models: Add sensible repr
-rw-r--r--bitvend/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bitvend/models.py b/bitvend/models.py
index 609f311..a11dfa7 100644
--- a/bitvend/models.py
+++ b/bitvend/models.py
@@ -20,6 +20,9 @@ class User(db.Model):
def __str__(self):
return self.uid
+ def __repr__(self):
+ return '<User {0.uid} {0.balance}>'.format(self)
+
@hybrid_property
def balance(self):
return sum((_.amount or 0) for _ in self.transactions)
@@ -97,3 +100,6 @@ class Transaction(db.Model):
__mapper_args__ = {
"order_by": created.desc()
}
+
+ def __repr__(self):
+ return '<Transaction {0.uid} {0.type} {0.amount} {0.created}>'.format(self)