diff --git a/contest/models.py b/contest/models.py index 674b004..b7bc648 100644 --- a/contest/models.py +++ b/contest/models.py @@ -12,7 +12,7 @@ from .validators import CallUsernameValidator class Contest(models.Model): name = models.CharField(max_length=20) shortName = models.CharField(max_length=20, unique=True) - callQrg = models.ForeignKey("Frequency", models.SET_NULL, null=True, blank=True) + callQrg = models.ForeignKey("Frequency", on_delete=models.SET_NULL, null=True, blank=True) deadline = models.DateTimeField() qsoStartTime = models.DateTimeField() @@ -134,7 +134,7 @@ signals.post_save.connect(checkForShadowCall, sender=User) class Band(models.Model): name = models.CharField(max_length=10) - contest = models.ForeignKey(Contest) + contest = models.ForeignKey(Contest, on_delete=models.CASCADE) def __str__(self): return self.name @@ -145,7 +145,7 @@ class Frequency(models.Model): # band channel = models.CharField(max_length=3) qrg = models.DecimalField(max_digits=7, decimal_places=3) - band = models.ForeignKey(Band) + band = models.ForeignKey(Band, on_delete=models.CASCADE) note = models.CharField(max_length=50, blank=True) @@ -162,11 +162,11 @@ class QSO(models.Model): ["owner", "call"], ] - owner = models.ForeignKey(User, db_index=True) + owner = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True) time = models.DateTimeField(blank=True) call = models.CharField(max_length=20, db_index=True) - callRef = models.ForeignKey(User, models.SET_NULL, related_name='qsoref', null=True, blank=True, default=None) - band = models.ForeignKey(Band) + callRef = models.ForeignKey(User, on_delete=models.SET_NULL, related_name='qsoref', null=True, blank=True, default=None) + band = models.ForeignKey(Band, on_delete=models.CASCADE) reportTX = models.CharField(max_length=7, default=59, verbose_name='RS-S', validators=[reportValidator]) reportRX = models.CharField(max_length=7, default=59, verbose_name='RS-R', validators=[reportValidator]) @@ -176,11 +176,11 @@ class QSO(models.Model): validators=[MinValueValidator(1), MaxValueValidator(MAX_NO_VALUE)]) refStr = models.CharField(max_length=20, verbose_name="EXC") - ref = models.ForeignKey(Reference, models.SET_NULL, null=True, blank=True) + ref = models.ForeignKey(Reference, on_delete=models.SET_NULL, null=True, blank=True) remarks = models.CharField(max_length=50, blank=True, default=None) - cfmdQSO = models.ForeignKey("QSO", models.SET_NULL, null=True, blank=True, default=None) + cfmdQSO = models.ForeignKey("QSO", on_delete=models.SET_NULL, null=True, blank=True, default=None) CFMD_SEC = 5 * 60