QSO deleting is now beautiful!
This commit is contained in:
parent
8d716f1a8b
commit
80934bda32
|
@ -62,3 +62,6 @@ class QSO(models.Model):
|
||||||
ref = models.ForeignKey(Reference, null=True, blank=True)
|
ref = models.ForeignKey(Reference, null=True, blank=True)
|
||||||
|
|
||||||
remarks = models.CharField(max_length=50, 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)
|
||||||
|
|
|
@ -88,11 +88,11 @@ def logDelete(request, qsoid):
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if "delete" in request.POST:
|
if "delete" in request.POST:
|
||||||
if request.POST["delete"] == "yes":
|
if request.POST["delete"].lower() == "yes":
|
||||||
qso.delete()
|
qso.delete()
|
||||||
messages.info(request, "QSO has been deleted")
|
messages.info(request, "QSO has been deleted")
|
||||||
return HttpResponseRedirect(reverse("contest:log"))
|
return HttpResponseRedirect(reverse("contest:log"))
|
||||||
elif request.POST["delete"] == "no":
|
elif request.POST["delete"].lower() == "no":
|
||||||
return HttpResponseRedirect(reverse("contest:log"))
|
return HttpResponseRedirect(reverse("contest:log"))
|
||||||
|
|
||||||
return render(request, 'contest/logDelete.html', {"qso": qso})
|
return render(request, 'contest/logDelete.html', {"qso": qso})
|
||||||
|
|
|
@ -3,21 +3,26 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
We have the User {{ user }}, create a ref for them or choose an existing ref!
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Delete QSO</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<p>
|
||||||
Are you sure you want to delete this QSO?
|
Are you sure you want to delete this QSO?
|
||||||
|
</p>
|
||||||
<form method="post" action="{% url "contest:logDelete" qso.id %}">
|
<form method="post" action="{% url "contest:logDelete" qso.id %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<div class="form-group">
|
||||||
<tr>
|
<label for="id-qso-name" class="control-label">QSO</label>
|
||||||
<th>QSO</th><td>{{ qso }}</td>
|
<div id="id-qso-name" class="controls readonly">{{ qso }}</div>
|
||||||
</tr>
|
</div>
|
||||||
</table>
|
<div class="btn-group">
|
||||||
<input type="submit" name="delete" value="yes">
|
<input type="submit" name="delete" class="btn btn-danger" value="Yes">
|
||||||
<input type="submit" name="delete" value="no">
|
<input type="submit" name="delete" class="btn btn-default" value="No">
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue