Form.html gebaut, Blöcke ausgelagert

This commit is contained in:
2024-01-13 16:19:52 +01:00
parent f3202c7235
commit a1ee5f3ea0
4 changed files with 33 additions and 17 deletions

4
app.py
View File

@@ -6,6 +6,10 @@ app = Flask(__name__)
def home(): def home():
return render_template('index.html') return render_template('index.html')
@app.route ('/form', methods=['GET','POST'])
def form():
return render_template('form.html')
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) app.run(debug=True)

View File

@@ -4,18 +4,6 @@
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
</head> </head>
<body> <body>
<h1>Homepage</h1>
<input type="radio" class="btn-check" name="options-base" id="option5" autocomplete="off" checked>
<label class="btn" for="option5">Fuck yes!</label>
<input type="radio" class="btn-check" name="options-base" id="option6" autocomplete="off">
<label class="btn" for="option6">Fuck no!</label>
<input type="radio" class="btn-check" name="options-base" id="option7" autocomplete="off">
<label class="btn" for="option7">Fuck you!</label>
<button type="button" class="btn btn-primary">Submit</button>
{% block content %}{% endblock %} {% block content %}{% endblock %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body> </body>

18
templates/form.html Normal file
View File

@@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}
Title: Form
{% endblock %}
{% block content %}
<input type="radio" class="btn-check" name="options-base" id="option5" autocomplete="off" checked>
<label class="btn" for="option5">Fuck yes!</label>
<input type="radio" class="btn-check" name="options-base" id="option6" autocomplete="off">
<label class="btn" for="option6">Fuck no!</label>
<input type="radio" class="btn-check" name="options-base" id="option7" autocomplete="off">
<label class="btn" for="option7">Fuck you!</label>
<button type="button" class="btn btn-primary">Submit</button>
{% endblock %}

View File

@@ -1,3 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Homepage{% endblock %}
{% block content %}<h1>Test</h1>{% endblock %} {% block title %}
Title: Index
{% endblock %}
{% block content %}
Content: Index
{% endblock %}