Hardcoded reference cleaning

This commit is contained in:
Sebastian Lohff 2019-01-22 21:46:44 +01:00 committed by root
parent c188dda016
commit e358da596b
1 changed files with 6 additions and 2 deletions

View File

@ -159,15 +159,19 @@ class QSO(models.Model):
# find reference
changed = False
if self.refStr:
refName = self.refStr.replace("-", "")
if refName == "GX":
refName = "DX"
# Old reference exists?
if self.ref and self.ref.name != self.refStr:
if self.ref and self.ref.name != refName:
self.ref = None
changed = True
if not self.ref:
# find matching ref
try:
self.ref = Reference.objects.get(name=self.refStr)
self.ref = Reference.objects.get(name=refName)
changed = True
except Reference.DoesNotExist:
pass