HTML corrections ; stupidtable injection

This commit is contained in:
Ludovic Stephan 2019-01-07 14:43:32 +01:00
parent 66104e1137
commit a30955fb75
3 changed files with 29 additions and 9 deletions

View file

@ -4,9 +4,8 @@
{% block realcontent %} {% block realcontent %}
<h2>Gestion des places que je revends</h2> <h2>Gestion des places que je revends</h2>
{% with resell_attributions=resellform.attributions annul_reventes=annulform.reventes sold_reventes=soldform.reventes %}
{% if resell_attributions %} {% if resell_exists %}
<br /> <br />
<h3>Places non revendues</h3> <h3>Places non revendues</h3>
@ -29,7 +28,7 @@
<hr /> <hr />
{% endif %} {% endif %}
{% if annul_reventes %} {% if annul_exists %}
<h3>Places en cours de revente</h3> <h3>Places en cours de revente</h3>
<form action="" method="post"> <form action="" method="post">
<div class="bg-info text-info center-block"> <div class="bg-info text-info center-block">
@ -52,7 +51,7 @@
<hr /> <hr />
{% endif %} {% endif %}
{% if sold_reventes %} {% if sold_exists %}
<h3>Places revendues</h3> <h3>Places revendues</h3>
<form action="" method="post"> <form action="" method="post">
<div class="bg-info text-info center-block"> <div class="bg-info text-info center-block">
@ -72,9 +71,15 @@
<button type="submit" class="btn btn-primary" name="reinit">Réinitialiser</button> <button type="submit" class="btn btn-primary" name="reinit">Réinitialiser</button>
</form> </form>
{% endif %} {% endif %}
{% if not resell_attributions and not annul_reventes and not sold_reventes %} {% if not resell_exists and not annul_exists and not sold_exists %}
<p>Plus de reventes possibles !</p> <p>Plus de reventes possibles !</p>
{% endif %} {% endif %}
{% endwith %} <script type="text/javascript" src="{% static "js/joequery-Stupid-Table-Plugin/stupidtable.js" %}"></script>
<script language="JavaScript">
$(function(){
$("table.stupidtable").stupidtable();
});
</script>
{% endblock %} {% endblock %}

View file

@ -8,9 +8,10 @@
{% if annul_exists %} {% if annul_exists %}
<h3>Les reventes auxquelles vous êtes inscrit·e</h3> <h3>Les reventes auxquelles vous êtes inscrit·e</h3>
<form class="form-horizontal" action="" method="post"> <form class="form-horizontal" action="" method="post">
<p> <div class="bg-info text-info center-block">
Voici la liste des reventes auxquelles vous êtes inscrit·e ; si vous ne souhaitez plus participer au tirage au sort vous pouvez vous en désister. <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</p> Voici la liste des reventes auxquelles vous êtes inscrit·e ; si vous ne souhaitez plus participer au tirage au sort vous pouvez vous en désister.
</div>
{% csrf_token %} {% csrf_token %}
<table class="table table-striped stupidtable"> <table class="table table-striped stupidtable">
<thead> <thead>
@ -80,5 +81,12 @@
</div> </div>
{% endif %} {% endif %}
<script type="text/javascript" src="{% static "js/joequery-Stupid-Table-Plugin/stupidtable.js" %}"></script>
<script language="JavaScript">
$(function(){
$("table.stupidtable").stupidtable();
});
</script>
{% endblock %} {% endblock %}

View file

@ -450,6 +450,10 @@ def revente_manage(request, tirage_id):
new_date = timezone.now() - SpectacleRevente.remorse_time new_date = timezone.now() - SpectacleRevente.remorse_time
revente.reset(new_date=new_date) revente.reset(new_date=new_date)
sold_exists = soldform.fields["reventes"].queryset.exists()
annul_exists = annulform.fields["reventes"].queryset.exists()
resell_exists = resellform.fields["attributions"].queryset.exists()
return render( return render(
request, request,
"bda/revente/manage.html", "bda/revente/manage.html",
@ -458,6 +462,9 @@ def revente_manage(request, tirage_id):
"soldform": soldform, "soldform": soldform,
"annulform": annulform, "annulform": annulform,
"resellform": resellform, "resellform": resellform,
"sold_exists": sold_exists,
"annul_exists": annul_exists,
"resell_exists": resell_exists,
}, },
) )