Coverage for django_napse/core/models/transactions/debit.py: 100%
20 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
1from django.db import models
3from django_napse.core.models.transactions.managers import DebitManager
6class Debit(models.Model):
7 wallet = models.ForeignKey("Wallet", on_delete=models.CASCADE, related_name="debits")
8 amount = models.FloatField()
9 ticker = models.CharField(max_length=10)
10 created_at = models.DateTimeField(auto_now_add=True)
12 objects = DebitManager()
14 def __str__(self):
15 return f"DEBIT: {self.pk})"
17 def info(self, verbose=True, beacon=""):
18 string = ""
19 string += f"{beacon}Debit {self.pk=}\n"
20 string += f"{beacon}Args:\n"
21 string += f"{beacon}\t{self.amount=}\n"
22 string += f"{beacon}\t{self.ticker=}\n"
23 string += f"{beacon}Debited Wallet:\n"
24 wall_str = self.wallet.info(verbose=False, beacon=beacon + "\t")
25 string += f"{wall_str}\n"
27 if verbose: # pragma: no cover
28 print(string)
29 return string