Compare commits

..

No commits in common. "c121e874c61904358184cbca859207450085ccd3" and "ff94b6221265b30539f57c5276183040ca2bfc34" have entirely different histories.

4 changed files with 18 additions and 12 deletions

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import print_function
# prepare environment # prepare environment
import sys import sys
sys.path.append("..") sys.path.append("..")

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from django.apps import AppConfig from django.apps import AppConfig

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
import datetime import datetime
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
@ -12,7 +14,7 @@ from .validators import CallUsernameValidator
class Contest(models.Model): class Contest(models.Model):
name = models.CharField(max_length=20) name = models.CharField(max_length=20)
shortName = models.CharField(max_length=20, unique=True) shortName = models.CharField(max_length=20, unique=True)
callQrg = models.ForeignKey("Frequency", on_delete=models.SET_NULL, null=True, blank=True) callQrg = models.ForeignKey("Frequency", models.SET_NULL, null=True, blank=True)
deadline = models.DateTimeField() deadline = models.DateTimeField()
qsoStartTime = models.DateTimeField() qsoStartTime = models.DateTimeField()
@ -134,7 +136,7 @@ signals.post_save.connect(checkForShadowCall, sender=User)
class Band(models.Model): class Band(models.Model):
name = models.CharField(max_length=10) name = models.CharField(max_length=10)
contest = models.ForeignKey(Contest, on_delete=models.CASCADE) contest = models.ForeignKey(Contest)
def __str__(self): def __str__(self):
return self.name return self.name
@ -145,7 +147,7 @@ class Frequency(models.Model):
# band # band
channel = models.CharField(max_length=3) channel = models.CharField(max_length=3)
qrg = models.DecimalField(max_digits=7, decimal_places=3) qrg = models.DecimalField(max_digits=7, decimal_places=3)
band = models.ForeignKey(Band, on_delete=models.CASCADE) band = models.ForeignKey(Band)
note = models.CharField(max_length=50, blank=True) note = models.CharField(max_length=50, blank=True)
@ -162,11 +164,11 @@ class QSO(models.Model):
["owner", "call"], ["owner", "call"],
] ]
owner = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True) owner = models.ForeignKey(User, db_index=True)
time = models.DateTimeField(blank=True) time = models.DateTimeField(blank=True)
call = models.CharField(max_length=20, db_index=True) call = models.CharField(max_length=20, db_index=True)
callRef = models.ForeignKey(User, on_delete=models.SET_NULL, related_name='qsoref', null=True, blank=True, default=None) callRef = models.ForeignKey(User, models.SET_NULL, related_name='qsoref', null=True, blank=True, default=None)
band = models.ForeignKey(Band, on_delete=models.CASCADE) band = models.ForeignKey(Band)
reportTX = models.CharField(max_length=7, default=59, verbose_name='RS-S', validators=[reportValidator]) 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]) reportRX = models.CharField(max_length=7, default=59, verbose_name='RS-R', validators=[reportValidator])
@ -176,11 +178,11 @@ class QSO(models.Model):
validators=[MinValueValidator(1), MaxValueValidator(MAX_NO_VALUE)]) validators=[MinValueValidator(1), MaxValueValidator(MAX_NO_VALUE)])
refStr = models.CharField(max_length=20, verbose_name="EXC") refStr = models.CharField(max_length=20, verbose_name="EXC")
ref = models.ForeignKey(Reference, on_delete=models.SET_NULL, null=True, blank=True) ref = models.ForeignKey(Reference, models.SET_NULL, null=True, blank=True)
remarks = models.CharField(max_length=50, blank=True, default=None) remarks = models.CharField(max_length=50, blank=True, default=None)
cfmdQSO = models.ForeignKey("QSO", on_delete=models.SET_NULL, null=True, blank=True, default=None) cfmdQSO = models.ForeignKey("QSO", models.SET_NULL, null=True, blank=True, default=None)
CFMD_SEC = 5 * 60 CFMD_SEC = 5 * 60

View File

@ -1,6 +1,7 @@
from django.core import validators from django.core import validators
from django.utils import six
from django.utils.deconstruct import deconstructible from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import re import re
@ -12,8 +13,7 @@ class CallUsernameValidator(validators.RegexValidator):
'Enter a valid Callsign as Username, ALL UPPERCASE, if needed with -1 / -2,' 'Enter a valid Callsign as Username, ALL UPPERCASE, if needed with -1 / -2,'
'e.g. DL7BST, DN1BER-1, DL/OE1FOO.' 'e.g. DL7BST, DN1BER-1, DL/OE1FOO.'
) )
flags = re.ASCII flags = re.ASCII if six.PY3 else 0
@deconstructible @deconstructible
class CallLogValidator(validators.RegexValidator): class CallLogValidator(validators.RegexValidator):
@ -22,4 +22,4 @@ class CallLogValidator(validators.RegexValidator):
'Enter a valid callsign, ALL UPPERCASE, if needed with -1 / -2,' 'Enter a valid callsign, ALL UPPERCASE, if needed with -1 / -2,'
'e.g. DL7BST, DN1BER-1, DL/OE1FOO, DN1FTW-1/p' 'e.g. DL7BST, DN1BER-1, DL/OE1FOO, DN1FTW-1/p'
) )
flags = re.ASCII flags = re.ASCII if six.PY3 else 0