Compare commits

...

6 Commits

Author SHA1 Message Date
Sebastian Lohff efcea4d2df Add registration hints to user landing page 2020-01-20 23:24:22 +01:00
Sebastian Lohff 1f2d34c8b4 Don't error out when newRef already exist, use it instead
Before this commit when a newRef was entered on user registration and
that ref already existed we errored out. Now we use exactly that
reference when it already exists.
2020-01-20 22:52:23 +01:00
Sebastian Lohff 2b42f6cea6 Nr -> No in QSO table, because consistency 2020-01-20 22:48:37 +01:00
Sebastian Lohff 8ad2013fb2 Disable "verbose" log messages 2020-01-20 22:16:43 +01:00
Sebastian Lohff d38c6ada3f Draft for a clear contest script
Script clears calls, users, references and shadow calls from the
database to clean up after the last contest.
2020-01-20 22:14:22 +01:00
Sebastian Lohff 500b79e67a Disable DN/Rig fields on registration for DN calls
When a user enters a call beginning with DN on the registration page we
now disable the DN-call and rig question fields, so we don't confuse
our SWLs.
2020-01-20 22:13:06 +01:00
5 changed files with 72 additions and 4 deletions

28
clear_contest.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
from __future__ import print_function
import datetime
# prepare environment
import sys
sys.path.append("..")
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cqtu.settings")
import django
django.setup()
confirm = raw_input("Do are you sure you want to clear all contest data? Answer with uppercase YES: ")
if confirm != "YES":
print("Aborting")
sys.exit(1)
from contest.models import QSO, ShadowCall, Reference, User
print("{0} QSOs deleted".format(*QSO.objects.all().delete()))
print("{0} ShadowCalls deleted".format(*ShadowCall.objects.all().delete()))
print("{0} References deleted".format(*Reference.objects.all().delete()))
print("{0} Users deleted".format(*User.objects.filter(is_superuser=0).delete()))
print()
print("Good to go!")

View File

@ -27,8 +27,6 @@ class UpdateRefForm(forms.Form):
def clean_newRefName(self):
data = self.cleaned_data["newRefName"].strip().upper()
if Reference.objects.filter(name=data).count() > 0:
raise forms.ValidationError("Reference already exists")
return data
@ -38,6 +36,14 @@ class UpdateRefForm(forms.Form):
existingRef = cleaned_data.get("existingRef")
newRefName = cleaned_data.get("newRefName")
if newRefName:
try:
ref = Reference.objects.get(name=newRefName)
self.cleaned_data['newRefName'] = None
self.cleaned_data['existingRef'] = ref
except Reference.DoesNotExist:
pass
if existingRef and newRefName:
raise forms.ValidationError("Select an existing exchange or create a new one, not both!")
if not existingRef and not newRefName:

View File

@ -34,6 +34,14 @@
<p>
Get yourself registered on <strong>{{ contest.callQrg }}</strong>!
</p>
<p>
<ul>
<li>Remember to SPELL all call signs, exchanges and names (Delta ...)</li>
<li>For the registration transmit your call sign, exchange, exact location (e.g. room number), all operator names</li>
<li>Your Exchange needs to be a TU Berlin building code (H, MA, TEL, ...) or DX</li>
<li>During the constest ONLY use your exchange, not the exact location</li>
</ul>
</p>
</div>
</div>
</div>

View File

@ -55,7 +55,7 @@
<table class="table">
<thead>
<tr>
<th>Nr</th>
<th>No</th>
<th>Band</th>
<th>UTC</th>
<th>Call</th>

View File

@ -21,5 +21,31 @@
</div>
</div>
</div>
{% endblock %}
<script type="text/javascript">
$(document).ready(function() {
function isDNCall(e) {
var call = $("#id_username").val().toUpperCase();
var disableState = false;
if(call.startsWith("DN")) {
var disableState = true;
}
$("#id_dncall").prop("disabled", disableState);
$("#id_qrv2m").prop("disabled", disableState);
$("#id_qrv70cm").prop("disabled", disableState);
$("#id_extra2m70cm").prop("disabled", disableState);
if(disableState) {
$("#id_dncall").prop("value", "");
$("#id_qrv2m").prop("checked", false);
$("#id_qrv70cm").prop("checked", false);
$("#id_extra2m70cm").prop("checked", false);
}
console.log($("#id_dncall"));
}
$("#id_username").on("input", isDNCall);
$("#id_username").change(isDNCall);
});
</script>
{% endblock %}