forked from DGNum/gestioCOF
Add str to Transfer model
+ PEP8 this model
This commit is contained in:
parent
78aa5df350
commit
f6022ecf7d
1 changed files with 16 additions and 11 deletions
|
@ -476,24 +476,29 @@ class TransferGroup(models.Model):
|
||||||
related_name = "+",
|
related_name = "+",
|
||||||
blank = True, null = True, default = None)
|
blank = True, null = True, default = None)
|
||||||
|
|
||||||
|
|
||||||
class Transfer(models.Model):
|
class Transfer(models.Model):
|
||||||
group = models.ForeignKey(
|
group = models.ForeignKey(
|
||||||
TransferGroup, on_delete = models.PROTECT,
|
TransferGroup, on_delete=models.PROTECT,
|
||||||
related_name = "transfers")
|
related_name="transfers")
|
||||||
from_acc = models.ForeignKey(
|
from_acc = models.ForeignKey(
|
||||||
Account, on_delete = models.PROTECT,
|
Account, on_delete=models.PROTECT,
|
||||||
related_name = "transfers_from")
|
related_name="transfers_from")
|
||||||
to_acc = models.ForeignKey(
|
to_acc = models.ForeignKey(
|
||||||
Account, on_delete = models.PROTECT,
|
Account, on_delete=models.PROTECT,
|
||||||
related_name = "transfers_to")
|
related_name="transfers_to")
|
||||||
amount = models.DecimalField(max_digits = 6, decimal_places = 2)
|
amount = models.DecimalField(max_digits=6, decimal_places=2)
|
||||||
# Optional
|
# Optional
|
||||||
canceled_by = models.ForeignKey(
|
canceled_by = models.ForeignKey(
|
||||||
Account, on_delete = models.PROTECT,
|
Account, on_delete=models.PROTECT,
|
||||||
null = True, blank = True, default = None,
|
null=True, blank=True, default=None,
|
||||||
related_name = "+")
|
related_name="+")
|
||||||
canceled_at = models.DateTimeField(
|
canceled_at = models.DateTimeField(
|
||||||
null = True, blank = True, default = None)
|
null=True, blank=True, default=None)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '{} -> {}: {}€'.format(self.from_acc, self.to_acc, self.amount)
|
||||||
|
|
||||||
|
|
||||||
class OperationGroup(models.Model):
|
class OperationGroup(models.Model):
|
||||||
on_acc = models.ForeignKey(
|
on_acc = models.ForeignKey(
|
||||||
|
|
Loading…
Reference in a new issue