Commit 24074499 by Patryk Czarnik

rozmowa

parent 72a0277a
<!DOCTYPE html>
{% load static %}
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>Rozmowa</title>
<link rel="stylesheet" type="text/css" href="{% static 'styl.css' %}">
</head>
<body>
<h1>Rozmowa z Pythonem</h1>
<form>
<label for="imie">Jak masz na imię?</label><br>
<input type="text" name="imie" id="imie"><br>
<button>Wyślij</button>
</form>
<div class="wynik">
{{powitanie}}
</div>
</body>
</html>
\ No newline at end of file
......@@ -35,3 +35,10 @@ def czas_szablon(request:HttpRequest) -> HttpResponse:
def index(request:HttpRequest) -> HttpResponse:
return render(request=request, template_name='index.html')
def rozmowa(request:HttpRequest) -> HttpResponse:
imie = request.GET.get('imie', 'Anonim')
powitanie = f'Witaj {imie}!'
return render(request=request,
template_name='rozmowa.html',
context={'powitanie': powitanie})
......@@ -25,4 +25,5 @@ urlpatterns = [
path("czas.txt", czas_txt),
path("czas.html", czas_html),
path("czas_szablon", czas_szablon),
path("rozmowa", rozmowa),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment