diff --git a/contest/views.py b/contest/views.py index a9f5b5d..cad2dc3 100644 --- a/contest/views.py +++ b/contest/views.py @@ -40,6 +40,7 @@ def log(request): if request.method == 'POST': form = QSOForm(user=request.user, data=request.POST) + form.helper.form_tag = False if form.is_valid(): l = form.instance if not l.time: @@ -63,6 +64,7 @@ def log(request): data["band"] = qsos[0].band form = QSOForm(request.user, initial=data) + form.helper.form_tag = False return render(request, 'contest/log.html', {'form': form, 'qsos': qsos}) diff --git a/templates/contest/log.html b/templates/contest/log.html index 997ccfc..5227840 100644 --- a/templates/contest/log.html +++ b/templates/contest/log.html @@ -28,7 +28,15 @@ - {% crispy form %} +
@@ -130,6 +138,21 @@ $(document).ready(function() { $("#id_otherNo").on("keydown", function(e) { return mvFocusOnSpace(e, "#id_refStr"); }); $("#id_refStr").on("keydown", function(e) { return mvFocusOnSpace(e, "#submit-id-submit"); }); + // display current time in log form + function zeropad(n) { + // srsly, how can javascript not have a printf/zeropad function? + if(n < 10) + return "0" + n; + else + return "" + n; + } + + function displayTimeInForm() { + var d = new Date(); + dstr = zeropad(d.getHours()) + ":" + zeropad(d.getMinutes()) + ":" + zeropad(d.getSeconds()); + $("#id_curr_time").text(dstr); + } + window.setInterval(displayTimeInForm, 200); });