initial import

This commit is contained in:
Arne Baeumler 2021-05-31 14:45:59 +02:00
parent 1ec9c03f20
commit 6d29156977
9 changed files with 136 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
env/
__pycache__/

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"python.pythonPath": "/home/arne/Desktop/Development/python3/flask/vocabulary/env/bin/python3.8"
}

View File

@ -1,3 +1,8 @@
# Rechentrainer
Einmaleins Übungsblätter generieren
Einmaleins Übungsblätter generieren
```
. env/bin/activate
pip3 install -r requirements.txt
```

29
app.py Normal file
View File

@ -0,0 +1,29 @@
from flask import Flask, render_template, url_for, request, redirect, Response, abort, session
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
import magic
import random
import string
app = Flask(__name__)
app.secret_key = 'eng5iikeiwah3lae4idoo0woh4eiy6Th'
@app.route('/', methods = ['GET', 'POST'])
def index():
if request.method == 'POST':
alle = []
zufall = []
for r in request.form.getlist('rechenreihen'):
for i in range(1,11):
alle.append({str(r)+"x"+str(i): int(r)*int(i) })
while len(alle):
zufall.append(alle.pop(random.randint(0,len(alle)-1)))
return render_template('arbeitsblatt.html',aufgaben=zufall)
else:
return render_template('generator.html')
if __name__ == "__main__":
app.run(debug=True)

10
requirements.txt Normal file
View File

@ -0,0 +1,10 @@
python-magic==0.4.15
Click==7.0
Flask==1.1.1
Flask-SQLAlchemy==2.4.1
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
SQLAlchemy==1.3.12
Werkzeug==0.16.0

View File

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% block content %}
<div class="w3-responsive">
{% for a in aufgaben %}
{% for k in a %}
<table class="w3-left" width="auto"><tr><td class="w3-right-align" style="width: 3em">{{ k }}</td><td> = </td><td class="w3-border-bottom" style="width: 5em; height: 2em"></td></tr></table>
{% endfor %}
{% endfor %}
</div>
{% endblock %}

22
templates/base.html Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
{% block head %}<title>Rechentrainer</title>{% endblock %}
</head>
<body>
<header class="w3-container w3-blue-grey">
{% block header %}<h1><a class="w3-button" href="/"><i class="material-icons w3-xxlarge">home</i></a>Rechentrainer</h1>{% endblock %}
</header>
<div class="w3-container" style="margin-bottom: 1.5em;">
{% block content %}{% endblock %}
</div>
<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 %}
</footer>
</body>
</html>

33
templates/generator.html Normal file
View File

@ -0,0 +1,33 @@
{% extends 'base.html' %}
{% block content %}
<div class="w3-display-container">
<form method="POST">
<!--label for="rechenreihen">Rechenreihen wählen:</label>
<select name="rechenreihen" id="rechenreihen" multiple>
<option value="1">1er Reihe</option>
<option value="2">2er Reihe</option>
<option value="3">3er Reihe</option>
<option value="4">4er Reihe</option>
<option value="5">5er Reihe</option>
<option value="6">6er Reihe</option>
<option value="7">7er Reihe</option>
<option value="8">8er Reihe</option>
<option value="9">9er Reihe</option>
<option value="10">10er Reihe</option>
</select-->
<input type="checkbox" name="rechenreihen" value="1"> 1er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="2"> 2er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="3"> 3er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="4"> 4er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="5"> 5er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="6"> 6er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="7"> 7er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="8"> 8er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="9"> 9er Reihe<br/>
<input type="checkbox" name="rechenreihen" value="10"> 10er Reihe<br/>
<input type="submit" value="zum Arbeitsblatt">
</form>
</div>
{% endblock %}

20
templates/index.html Normal file
View File

@ -0,0 +1,20 @@
{% extends 'base.html' %}
{% block content %}
<div class="w3-display-container" style="height: 200px">
<div class="w3-row w3-half w3-display-middle">
<div class="w3-blue-grey w3-col w3-mobile s6">
<a class="w3-block w3-button" href="/train">
<i class="material-icons w3-jumbo">school</i>
<p>train</p>
</a>
</div>
<div class="w3-blue-grey w3-col w3-mobile s6">
<a class="w3-block w3-button" href="/manage">
<i class="material-icons w3-jumbo">settings_applications</i>
<p>manage vocabulary</p>
</a>
</div>
</div>
</div>
{% endblock %}