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)
|
||||
|
||||
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 "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})
|
||||
|
|
|
@ -3,20 +3,25 @@
|
|||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
We have the User {{ user }}, create a ref for them or choose an existing ref!
|
||||
|
||||
Are you sure you want to delete this QSO?
|
||||
<form method="post" action="{% url "contest:logDelete" qso.id %}">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<tr>
|
||||
<th>QSO</th><td>{{ qso }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" name="delete" value="yes">
|
||||
<input type="submit" name="delete" value="no">
|
||||
|
||||
</form>
|
||||
<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?
|
||||
</p>
|
||||
<form method="post" action="{% url "contest:logDelete" qso.id %}">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label for="id-qso-name" class="control-label">QSO</label>
|
||||
<div id="id-qso-name" class="controls readonly">{{ qso }}</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<input type="submit" name="delete" class="btn btn-danger" value="Yes">
|
||||
<input type="submit" name="delete" class="btn btn-default" value="No">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue