add maxPerPage

This commit is contained in:
Arne Baeumler 2021-06-06 14:12:43 +02:00
parent 724ce039da
commit a487d6d70b
3 changed files with 7 additions and 6 deletions

2
app.py
View File

@ -53,7 +53,7 @@ def index():
term.c += ' + ' if random.randint(0,1) else ' - '
term.c += str(random.randint(1,maxValue))
zufall.append(term)
return render_template('arbeitsblatt.html',aufgaben=zufall)
return render_template('arbeitsblatt.html',aufgaben=zufall,maxPerPage=int(request.form.get('maxPerPage')))
else:
return render_template('generator.html', reihen=rt_rechenreihen)

View File

@ -4,7 +4,7 @@
<div class="w3-responsive">
{% for a in aufgaben %}
<table class="w3-left" width="auto"><tr><td class="w3-right-align" style="width: 7em">{{ a.a }} {% if a.t.typ == '*' %}&middot;{% elif a.t.typ == '/'%}:{% else %}{{ a.t.typ }}{% endif %} {{ a.b }}{{ a.c }}</td><td> = </td><td class="w3-border-bottom" style="width: 5em; height: 2em"></td></tr></table>
{% if (loop.index % 60 == 0) and (not loop.last) %}
{% if (loop.index % maxPerPage == 0) and (not loop.last) %}
<div style="break-after: page; clear: both;"></div>
<div style="margin-bottom: 3em"></div>
{% endif %}

View File

@ -29,10 +29,11 @@
<label for="anzahl">max. Aufgaben: </label>
<select name="anzahl">
<option value="">Alle</option>
<option value="80">80</option>
<option value="40">40</option>
<option value="20">20</option>
</select>
<option value="78">78</option>
<option value="39">39</option>
</select><br/>
<label for="maxPerPage">max. Aufgaben pro Seite</label>
<input name="maxPerPage" value="78"><br/>
<br/>
<input type="submit" value="zum Arbeitsblatt">
</form>