page break nach 80 Aufgaben und Drop Down Aufgaben

This commit is contained in:
Arne Baeumler 2021-06-05 15:01:11 +02:00
parent 6b1c0eb192
commit d12eae4830
4 changed files with 19 additions and 2 deletions

8
app.py
View File

@ -39,7 +39,13 @@ def index():
zufall = [] zufall = []
for r in request.form.getlist('rechenreihen'): for r in request.form.getlist('rechenreihen'):
alle.extend(rechenreihen[r]) alle.extend(rechenreihen[r])
while len(alle):
if request.form.get('anzahl'):
count = (int(request.form.get('anzahl')) + 1)
else:
count = len(alle)
for i in range(1,count):
zufall.append(alle.pop(random.randint(0,len(alle)-1))) zufall.append(alle.pop(random.randint(0,len(alle)-1)))
return render_template('arbeitsblatt.html',aufgaben=zufall) return render_template('arbeitsblatt.html',aufgaben=zufall)
else: else:

View File

@ -4,6 +4,9 @@
<div class="w3-responsive"> <div class="w3-responsive">
{% for a in aufgaben %} {% for a in aufgaben %}
<table class="w3-left" width="auto"><tr><td class="w3-right-align" style="width: 5em">{{ a }}</td><td> = </td><td class="w3-border-bottom" style="width: 5em; height: 2em"></td></tr></table> <table class="w3-left" width="auto"><tr><td class="w3-right-align" style="width: 5em">{{ a }}</td><td> = </td><td class="w3-border-bottom" style="width: 5em; height: 2em"></td></tr></table>
{% if loop.index % 80 == 0 %}
<div style="break-after: page;"></div>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -16,7 +16,7 @@
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
<footer class="w3-container w3-blue-grey w3-center" style="position: fixed; bottom: 0; width: 100vw; height: 1.5em"> <footer class="w3-container w3-blue-grey w3-center" style="position: fixed; bottom: 0; width: 100vw; height: 1.5em">
{% block footer %}<span>(c) br0tkasten.de</span>{% endblock %} {% block footer %}<span>{{ request.base_url }}</span>{% endblock %}
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -38,6 +38,14 @@
</td> </td>
</tr> </tr>
</table> </table>
<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>
<br/>
<input type="submit" value="zum Arbeitsblatt"> <input type="submit" value="zum Arbeitsblatt">
</form> </form>
</div> </div>