diff options
| author | Magnus Hagander | 2020-04-01 12:15:07 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2020-04-01 12:15:07 +0000 |
| commit | 380b00e130f62bb9a16e029bf1d11a7649d0bd09 (patch) | |
| tree | 6d8e6311cc21fe614b22c183788a05807ec5ebc9 /postgresqleu/transferwise | |
| parent | 76e0d297f37281025cf4170238521840b9fe3987 (diff) | |
Specify on_delete for all ForeignKey and OneToOneFields
This was already done once in 8289e05cd but had not been properly
maintained.
Diffstat (limited to 'postgresqleu/transferwise')
| -rw-r--r-- | postgresqleu/transferwise/models.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/postgresqleu/transferwise/models.py b/postgresqleu/transferwise/models.py index fbca49ad..0659149b 100644 --- a/postgresqleu/transferwise/models.py +++ b/postgresqleu/transferwise/models.py @@ -4,7 +4,7 @@ from postgresqleu.invoices.models import InvoicePaymentMethod class TransferwiseTransaction(models.Model): - paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False) + paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False, on_delete=models.CASCADE) twreference = models.CharField(max_length=100, blank=False, null=False) datetime = models.DateTimeField(null=False, blank=False) amount = models.DecimalField(decimal_places=2, max_digits=20, null=False) @@ -27,8 +27,8 @@ class TransferwiseTransaction(models.Model): class TransferwiseRefund(models.Model): - origtransaction = models.ForeignKey(TransferwiseTransaction, blank=False, null=False, related_name='refund_orig') - refundtransaction = models.OneToOneField(TransferwiseTransaction, blank=True, null=True, related_name='refund_refund', unique=True) + origtransaction = models.ForeignKey(TransferwiseTransaction, blank=False, null=False, related_name='refund_orig', on_delete=models.CASCADE) + refundtransaction = models.OneToOneField(TransferwiseTransaction, blank=True, null=True, related_name='refund_refund', unique=True, on_delete=models.CASCADE) refundid = models.BigIntegerField(null=False, unique=True) uuid = models.UUIDField(blank=False, null=False, unique=True) transferid = models.BigIntegerField(null=False, unique=True) @@ -39,7 +39,7 @@ class TransferwiseRefund(models.Model): class TransferwisePayout(models.Model): - paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False) + paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False, on_delete=models.CASCADE) amount = models.DecimalField(decimal_places=2, max_digits=20, null=False) reference = models.CharField(max_length=100, null=False, blank=False, unique=True) counterpart_name = models.CharField(max_length=100, blank=True, null=False) @@ -51,11 +51,11 @@ class TransferwisePayout(models.Model): createdat = models.DateTimeField(null=False, blank=False, auto_now_add=True) sentat = models.DateTimeField(null=True, blank=True) completedat = models.DateTimeField(null=True, blank=True) - completedtrans = models.ForeignKey(TransferwiseTransaction, blank=True, null=True) + completedtrans = models.ForeignKey(TransferwiseTransaction, blank=True, null=True, on_delete=models.CASCADE) class TransferwiseMonthlyStatement(models.Model): - paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False) + paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False, on_delete=models.CASCADE) month = models.DateField(null=False, blank=False) downloaded = models.DateTimeField(null=False, blank=False, auto_now_add=True) contents = models.BinaryField(null=False) |
