From 80934bda32978dc0be7f6b570bf664fc2c139353 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Sat, 21 Jan 2017 01:08:40 +0100 Subject: [PATCH] QSO deleting is now beautiful! --- contest/models.py | 3 +++ contest/views.py | 4 ++-- templates/contest/logDelete.html | 33 ++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/contest/models.py b/contest/models.py index 534859a..0cbf045 100644 --- a/contest/models.py +++ b/contest/models.py @@ -62,3 +62,6 @@ class QSO(models.Model): ref = models.ForeignKey(Reference, null=True, blank=True) remarks = models.CharField(max_length=50, blank=True) + + def __str__(self): + return "QSO no %s at %s with %s@%s %s/%s" % (self.ownNo, self.time.strftime("%H:%M"), self.call, self.refStr, self.reportTX, self.reportRX) diff --git a/contest/views.py b/contest/views.py index cdcefe6..bba8ccc 100644 --- a/contest/views.py +++ b/contest/views.py @@ -88,11 +88,11 @@ def logDelete(request, qsoid): if request.method == 'POST': if "delete" in request.POST: - if request.POST["delete"] == "yes": + if request.POST["delete"].lower() == "yes": qso.delete() messages.info(request, "QSO has been deleted") return HttpResponseRedirect(reverse("contest:log")) - elif request.POST["delete"] == "no": + elif request.POST["delete"].lower() == "no": return HttpResponseRedirect(reverse("contest:log")) return render(request, 'contest/logDelete.html', {"qso": qso}) diff --git a/templates/contest/logDelete.html b/templates/contest/logDelete.html index 9045417..4a1be90 100644 --- a/templates/contest/logDelete.html +++ b/templates/contest/logDelete.html @@ -3,20 +3,25 @@ {% block content %}
- We have the User {{ user }}, create a ref for them or choose an existing ref! - - Are you sure you want to delete this QSO? -
- {% csrf_token %} - - - - -
QSO{{ qso }}
- - - -
+
+
Delete QSO
+
+

+ Are you sure you want to delete this QSO? +

+
+ {% csrf_token %} +
+ +
{{ qso }}
+
+
+ + +
+
+
+
{% endblock %}