Commit c095f777 authored by Louis's avatar Louis

Utilisation de la méthode GET plutôt que POST

parent 40b626f2
......@@ -32,7 +32,7 @@
{% endfor %}
</ul>
<form method="post" action="{% url 'utiliser:creer' %}" id="idForm">
<form method="get" action="{% url 'utiliser:creer' %}" id="idForm">
{% csrf_token %}
{% for niveau, exercices in BAG.sorted_levels %}
<div id="tabs-{{ forloop.counter0 }}">
......@@ -40,7 +40,7 @@
{% for exo in exercices %}
{% if forloop.counter0|divisibleby:2 %}<tr>{% endif %}
<td>
<select name="exo-{{ exo.name }}">
<select name="{{ exo.name }}">
<option selected="selected">0</option>
<option>1</option>
<option>2</option>
......
......@@ -25,16 +25,16 @@ def choix(request):
def creer(request):
# Génération de la liste d'exercices
exercices = []
for key in request.POST:
if key.startswith("exo-"):
for key in request.GET:
if key in BAG:
number = 0
for string in request.POST[key]:
for string in request.GET[key]:
try:
number += int(string)
except ValueError:
pass
for i in range(number):
exercices.append(BAG[key[4:]]())
exercices.append(BAG[key]())
# Génération du PDF
if exercices:
parametres = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment