Skip to content

Commit

Permalink
zmena
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Vybíhal committed Nov 3, 2022
1 parent 34ef0bf commit 1b09f90
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 52 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-c66648af7eb3fe8bc4f294546bfd86ef473780cde1dea487d3c4ff354943c9ae.svg)](https://classroom.github.com/online_ide?assignment_repo_id=8703052&assignment_repo_type=AssignmentRepo)
Flask Start OneFile
=========================

Expand Down
Binary file added static/img/maliny.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 4 additions & 12 deletions static/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion templates/abc.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ <h1>Flask <a href="{{ url_for('index') }}">pokus</a></h1>


{% endblock obsah %}

20 changes: 0 additions & 20 deletions templates/banan.html

This file was deleted.

18 changes: 11 additions & 7 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,26 @@
<li><a href="{{ url_for('index') }}">Index</a></li>
<li><a href="{{ url_for('info') }}">Info</a></li>
<li><a href="{{ url_for('abc') }}">ABC</a></li>
<li><a href="{{ url_for('banan') }}">Banan</a></li>
<li><a href="{{ url_for('malina') }}">Malina</a></li>
</ul></nav>


{% block obsah %}

{#{% filter markdown %}#}

# Flask
<h1>Flask</h1>

Startovací šablona pro webový framework Flask.

![Flaštička]({{ url_for('static', filename='flask.png') }})
![Flaštičky]({{ url_for('static', filename='flasks.png') }})
<p>Startovací šablona pro webový framework Flask.</p>

{#{% endfilter %}#}
<p><img src="{{ url_for('static', filename='flask.png') }}" alt=""></p>

<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.
Laboriosam velit ut, ipsam sit a, quod et quia ducimus dolor vitae
recusandae! Exercitationem quae expedita cum delectus laboriosam
minus voluptatem rerum.</p>

<p><img src="{{ url_for('static', filename='flasks.png') }}" alt=""></p>



Expand Down
50 changes: 50 additions & 0 deletions templates/malina.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% extends 'base.html' %}


{% block obsah %}

<h1>Malina a BMI</h1>

<h2>formulář</h2>
<form action="" method="GET">
<p>Hmotnost:<br>
<input type="text" name="hmotnost" placeholder="hmotnost v kg"
value="{{ request.args.get('hmotnost') or '' }}">kg
</p>
<p>Výška: <br>
<input type="text" name="vyska" placeholder="výška v cm"
value="{{ request.args.get('vyska') or '' }}">cm
</p>
<p><input type="submit" value="Vypočítej mi to!"></p>
</form>
{% if bmi != none %}
<p>BMI={{bmi}}</p>

{% if bmi < 18.5%}
<p>0 až 18.5 podváha</p>
{% elif bmi < 25%}
<p>18.5 až 25 normalni vaha </p>
{% elif bmi < 30%}
<p>25 až 30 nadvaha </p>
{% elif bmi < 35%}
<p>30 až 35 mirna obezita </p>
{% elif bmi < 40%}
<p>35 až 40 obezita </p>
{% elif bmi > 40%}
<p> více než 40 extrem obezita </p>
{% endif %}


{% else %}
<p>je treba zadat dve nenulova cisla!</p>
{% endif %}


<p><img src="{{ url_for('static', filename='img/maliny.jpg') }}" alt=""></p>

{% for i in range(7) %}
<p>Maliny jsou nejlepší!</p>
{% endfor %}


{% endblock obsah %}
27 changes: 16 additions & 11 deletions webface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from crypt import methods
from decimal import DivisionByZero
from flask import Flask, render_template, request, redirect, url_for, session
import functools

Expand Down Expand Up @@ -37,18 +37,23 @@ def info():
def abc():
return render_template("abc.html", slova=slova)

@app.route("/banan/", methods=["GET", "POST"])
def banan():
return render_template("banan.html")



@app.route("/text/")
def text():
return """
@app.route("/malina/", methods=['GET', 'POST'])
def malina():
hmotnost = request.args.get('hmotnost')
vyska = request.args.get('vyska')

<h1>Text</h1>
print(hmotnost, vyska)
if hmotnost and vyska:
try:
hmotnost = float(hmotnost)
vyska=float(vyska)
bmi = hmotnost/(0.01*vyska)**2
except (DivisionByZero, ValueError):
bmi = None
else:
bmi = None

<p>toto je text</p>
"""
return render_template('malina.html', bmi=bmi)

0 comments on commit 1b09f90

Please sign in to comment.