Allow No-R to be empty in QSO log

This commit is contained in:
Sebastian Lohff 2017-01-26 21:24:23 +01:00
parent 34f14c58a0
commit 70629673cf
4 changed files with 33 additions and 4 deletions

View File

@ -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]")

View File

@ -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'),
),
]

View File

@ -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)

View File

@ -55,13 +55,13 @@
<table class="table">
<thead>
<tr>
<th>Nr-S</th>
<th>NroS</th>
<th>Band</th>
<th>UTC</th>
<th>Call</th>
<th class="hidden-xs">RS-S</th>
<th class="hidden-xs">RS-R</th>
<th class="hidden-xs">Nr-R</th>
<th class="hidden-xs">No-R</th>
<th>EXC</th>
<th class="hidden-xs">Remarks</th>
<th></th>
@ -76,7 +76,7 @@
<td>{{ qso.call }}</td>
<td class="hidden-xs">{{ qso.reportTX }}</td>
<td class="hidden-xs">{{ qso.reportRX }}</td>
<td class="hidden-xs">{{ qso.otherNo }}</td>
<td class="hidden-xs">{{ qso.otherNo|default:"&nbsp&nbsp;---" }}</td>
<td>{{ qso.refStr }}</td>
<td class="hidden-xs">{{ qso.remarks }}</td>
<td><a href="{% url "contest:logEdit" qso.id %}"><span class="glyphicon glyphicon-pencil"></span></a> <a href="{% url "contest:logDelete" qso.id %}"><span class="glyphicon glyphicon-trash"></span></a></td>