From 65a0b3cbabcaa6dd2b8de7f98b401ba0cd8d34f5 Mon Sep 17 00:00:00 2001 From: Kilokem Date: Thu, 10 Oct 2024 10:08:42 +0200 Subject: [PATCH] jinja basics --- __pycache__/begin.cpython-312.pyc | Bin 713 -> 812 bytes begin.py | 6 +++++- templates/index.html | 2 +- templates/user.html | 34 ++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 templates/user.html diff --git a/__pycache__/begin.cpython-312.pyc b/__pycache__/begin.cpython-312.pyc index 220c50f77416d28e7353cad6c4e9ed15224de2ec..195e063a6dbe923226a1e5a0e6ad4f7b5a7c2d4c 100644 GIT binary patch delta 360 zcmX@fx`vJSG%qg~0}#yaU{8Ork(Y^)aphzIMjJ-%$-ay-jGU9R80G5Ofbz^h{85hB`+~I^%iS!NoiWzE!LdO;*!)NcA%;vAs|r<(yE}KPz3VVEf$czA~7IS7$m0( zBpMh#urcsjG`Qa45pQt4!!0$#dPT?$MKvJ$!pg*>@qvMfRilU#sM1f9;}&b$WMw8* x6>cCGY)lachy{`bTkwm+CO1E&G$+-rNP2P(leZ8nqsC`e1}5o`EI<}m9RN}GRJH&B delta 246 zcmZ3(c9NC%G%qg~0}yaEv!|PHPO4pz@Z|GM-a?Fw`kz@Dn4~|l09jyl06uCl A`2YX_ diff --git a/begin.py b/begin.py index 14c017d..a6bbf7c 100644 --- a/begin.py +++ b/begin.py @@ -19,4 +19,8 @@ def index(): @app.route('/user/') def user(name): - return "

Hello {}!!!

".format(name) \ No newline at end of file + stuff = "This is some bold text" + liste = [1,2,3,4,5] + return render_template('user.html', name=name, + stuff=stuff, + liste=liste) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index d514b59..c4d0709 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,7 +3,7 @@ - Document + Main

Hello World

diff --git a/templates/user.html b/templates/user.html new file mode 100644 index 0000000..d6d55f1 --- /dev/null +++ b/templates/user.html @@ -0,0 +1,34 @@ + + + + + + {{name | capitalize}}'s page + + +

Hello {{name | upper}}!!

+

Hello {{name | capitalize}}!!

+

Hello {{name | lower}}!!

+

Hello {{name | title}}!!

+

{{ stuff }}

+

{{ stuff | safe }}

+

{{ stuff | striptags }}

+ + {% for item in liste %} + {% if item == 3 %} +

Thiiiiiiiiis is number THREEEEEEEEE!!!!

+ {% else %} +

{{ item }}

+ {% endif %} + {% endfor %} + +

Sahe thing with some math!

+ + {% for item in liste %} +

{{ item **25 }}

+ {% endfor %} + +

The last element of my list is: {{liste[4]}}

+ + + \ No newline at end of file