diff --git a/contest/forms.py b/contest/forms.py index c01838b..b531101 100644 --- a/contest/forms.py +++ b/contest/forms.py @@ -109,6 +109,10 @@ class QSOForm(forms.ModelForm): def clean_otherNo(self): data = self.cleaned_data["otherNo"] + if not data: + # empty value + return None + if data < 1 or data > 100000: raise forms.ValidationError("Number has to be in range of [1, 1000000]") diff --git a/contest/migrations/0015_auto_20170126_2016.py b/contest/migrations/0015_auto_20170126_2016.py new file mode 100644 index 0000000..4c82667 --- /dev/null +++ b/contest/migrations/0015_auto_20170126_2016.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-01-26 20:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contest', '0014_contest_deadline'), + ] + + operations = [ + migrations.AlterField( + model_name='qso', + name='otherNo', + field=models.IntegerField(blank=True, null=True, verbose_name='No-R'), + ), + migrations.AlterField( + model_name='qso', + name='ownNo', + field=models.IntegerField(verbose_name='No-S'), + ), + ] diff --git a/contest/models.py b/contest/models.py index a4f5ec9..badcb8c 100644 --- a/contest/models.py +++ b/contest/models.py @@ -93,7 +93,7 @@ class QSO(models.Model): reportRX = models.CharField(max_length=7, default=59, verbose_name='RST-R', validators=[reportValidator]) ownNo = models.IntegerField(verbose_name='No-S') - otherNo = models.IntegerField(verbose_name='No-R') + otherNo = models.IntegerField(verbose_name='No-R', null=True, blank=True) refStr = models.CharField(max_length=20, verbose_name="EXC") ref = models.ForeignKey(Reference, models.SET_NULL, null=True, blank=True) diff --git a/templates/contest/log.html b/templates/contest/log.html index 39df524..521545d 100644 --- a/templates/contest/log.html +++ b/templates/contest/log.html @@ -55,13 +55,13 @@