diff --git a/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc index 46dc301..a80bb68 100644 Binary files a/__pycache__/main.cpython-311.pyc and b/__pycache__/main.cpython-311.pyc differ diff --git a/comments.csv b/comments.csv new file mode 100644 index 0000000..d4e191f --- /dev/null +++ b/comments.csv @@ -0,0 +1,15 @@ +dfgdfgdfg +dfghhh +sdfsdfsdfsd +ghfghfgh +ssdsdf +sdsdf +sdfsdf +dfsdf +sdfsfd +"" +sdfsdf +"" +sdffs +dfgdfgdfgrtyerte +fghfwssdf diff --git a/main.py b/main.py index 080851f..4bee564 100644 --- a/main.py +++ b/main.py @@ -1,30 +1,77 @@ from flask import Flask, make_response, render_template, request, redirect, url_for from markupsafe import escape - +import csv app = Flask(__name__) +class User: + MAX_CHAIR_AMOUNT = 6 + + def __init__( + self, + username, + email + ): + self.username = username + self.email = email + + def save(self): + with open('users.csv', 'a', newline='') as csvfile: + spamwriter = csv.writer(csvfile) + spamwriter.writerow([self.username, self.email]) + @app.route('/') +def home(): + return render_template("home.html") + @app.route('/') def index(username = None): return render_template("index.html", name = username) -@app.route('/contact') -def contact(): +@app.route('/contact', methods=['GET', 'POST']) +def contact(name=None): + if request.method == 'POST': + username = request.form['username'] + return redirect(url_for('contact_name', name=escape(username))) return render_template("contact.html") -@app.route('/') -@app.route('/') -def first_page(): - return render_template("first_page.html") + +@app.route('/contact/', methods=['GET', 'POST']) +def contact_name(name): + if request.method == 'POST': + comment = request.form['subject'] + print(comment) + with open('comments.csv', 'a', newline='') as csvfile: + spamwriter = csv.writer(csvfile) + spamwriter.writerow([comment]) + + comments = [] + with open('comments.csv', 'r', newline='') as csvfile: + spamreader = csv.reader(csvfile) + for row in spamreader: + comments.append(str(row[0])) + + print(comments) + return render_template('contact.html', name=escape(name), comments=comments) + return render_template("contact.html", name=name) + @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': username = request.form['username'] + email = request.form['email'] + remember = request.form.get('remember') + + if remember == 'yes': + user = User(username, email) + user.save() + return redirect(url_for('index', username=escape(username))) return render_template("form.html") -@app.route('/') -def first_page(): - return render_template("test.html") +@app.route('/say_hello/') +def greetings(test): + return render_template("test.html", test=escape(test)) + + import unittest class TestStringMethods(unittest.TestCase): @@ -34,48 +81,12 @@ class TestStringMethods(unittest.TestCase): response = client.get(response.location) self.assertEqual(response.status_code, 200) self.assertIn("Test", response.text) - # ... - -class TestCategorizeByAge(unittest.TestCase): - def test_child(self): - """Test for 'Child'""" - self.assertEqual(categorize_by_age(5), "Child") - - def test_adolescent(self): - """Test for 'Adolescent'""" - self.assertEqual(categorize_by_age(15), "Adolescent") - - def test_adult(self): - """Test for 'Adult'""" - self.assertEqual(categorize_by_age(30), "Adult") - - def test_golden_age(self): - """Test for 'Golden age'""" - self.assertEqual(categorize_by_age(70), "Golden age") - - def test_negative_age(self): - """Test for negative age""" - self.assertEqual(categorize_by_age(-1), "Invalid age: -1") - - def test_too_old(self): - """Test for too old""" - self.assertEqual(categorize_by_age(151), "Invalid age: 151") - - def test_boundary_child_adolescent(self): - """Test for boundary between 'Child' and 'Adolescent'""" - self.assertEqual(categorize_by_age(9), "Child") - self.assertEqual(categorize_by_age(10), "Adolescent") - - def test_boundary_adolescent_adult(self): - """Test for boundary between 'Adolescent' and 'Adult'""" - self.assertEqual(categorize_by_age(18), "Adolescent") - self.assertEqual(categorize_by_age(19), "Adult") - - def test_boundary_adult_golden_age(self): - """Test for boundary between 'Adult' and 'Golden age'""" - self.assertEqual(categorize_by_age(65), "Adult") - self.assertEqual(categorize_by_age(66), "Golden age") + def test_test(self): + client = app.test_client() + response = client.get("/say_hello/Maria") + self.assertEqual(response.status_code, 200) + self.assertIn("Hi Maria!", response.text) if __name__ == "__main__": diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..bfb9576 --- /dev/null +++ b/static/style.css @@ -0,0 +1,17 @@ +.otherStyle { + color: black; + font-size: 60px; + font-family: 'Lucida Handwriting', cursive; + } +h1 { + color: black; + font-size: 50px; + font-family: 'Arial', Sans-serif; + } + +.col-sm-4, .col-sm-3, .col-sm-6, .col-sm-12{ + background-color: purple; + border: 4px solid yellow; + color: white + +} \ No newline at end of file diff --git a/style.css b/style.css deleted file mode 100644 index 578aaba..0000000 --- a/style.css +++ /dev/null @@ -1,5 +0,0 @@ -h1 { - color: red; - font-size: 5px; - } - \ No newline at end of file diff --git a/templates/contact.html b/templates/contact.html index 2b030c3..02e977d 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -1,21 +1,30 @@ +{% extends "navbar.html" %} + {% block title %} Contact + {% endblock title %} - + {{ super () }} + {% block content %}
-

Book your first consultation:

Epasts: example@example.com

+ With whom would you like to book your conslutation? +
+

+ +
+

Book your first consultation with {{name}}:

Epasts: example@example.com

Mūsu konsultācijas maģiskais efekts ir kā burvju triks, kurā pazūd visi jūsu stresi un neērtības. Pēc seansa jūs sajutīsiet, ka jūsu redze ir kļuvusi tik asa, ka jūs spējat saskatīt katru putekli uz sava dīvāna - pat tos, kurus mēģinājāt ignorēt jau mēnešiem. Jūsu acis kļūst tik spēcīgas, ka jūs varētu mierīgi izlasīt smalko druku uz līguma, kuru parasti vienkārši parakstāt, neko nelasot.

@@ -23,5 +32,24 @@

Un, protams, taustes sajūtas pēc mūsu konsultācijas ir kaut kas neizsakāms! Pēc seansa, kad pieskarsieties savai mīļākajai kafijas tasītei, jūs sajutīsiet katru porcelāna izliekumu un katru niecīgāko siltuma viļņu, it kā tā būtu jūsu pašu rokas pagarinājums. Jūsu āda kļūs tik jutīga, ka pat kaķa spalvas kļūs par greznu samtu, un ikviens rokasspiediens - par mīļo apskāvienu. Tas ir kā dzīvot pasakā, kur viss ir daudz krāsaināks, skaļāks un taustāmāks.

+ {% if name %} +
+ + + + + +
+ {% endif %} + + {% if comments %} + {% for comment in comments %} +

{{comment}}

+ {% endfor %} + {% endif %} + + {% endblock content %} + {{ super() }} + \ No newline at end of file diff --git a/templates/first_page.html b/templates/first_page.html deleted file mode 100644 index 2e5a200..0000000 --- a/templates/first_page.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - Vissvarīgākā tēma - - - - - - - -
- - -
-

Mikrobioloģija

-
- -

Mana motivācija

-
-
Man patīk mikrobioloģija, jo tā ir aizraujoša zinātnes joma, kas pēta mikroorganismus - - neredzamos dzīvības veidus, kas ietekmē visu no veselības līdz vides ilgtspējai. - Mikrobioloģija sniedz ieskatu mikroorganismu pasaules sarežģītajā un fascinējošajā dzīvē, atklājot to - lomu cilvēku veselībā, pārtikas ražošanā un dabas ekosistēmās. - Mani aizrauj mikrobioloģijas pētījumi, jo tie dod iespēju iedziļināties mikrobu pasaulē, saprast to - potenciālu un izmantot šo zinātnes jomu, lai risinātu dažādus globālus izaicinājumus.
-
-

Kas ir mikrobioloģija?

-

Mikrobioloģija ir zinātnes joma, kas pēta mikroorganismus - mikroskopiskus dzīvniekus, augus, sēnes un - vīrusus. Šī zinātne aptver plašu spektru tematu, sākot no mikrobu struktūras un fiziskajām īpašībām līdz to - fizjoloģiskajām funkcijām un ekoloģiskajai nozīmei.

-

Mikrobioloģija ir svarīga medicīnā, pārtikas rūpniecībā, - lauksaimniecībā, vides pētījumos un biotehnoloģijās. Tajā tiek izmantotas dažādas metodes, tostarp - mikroskopija, genētika, bioķīmija un molekulārā bioloģija, lai izpētītu un saprastu mikroorganismu uzvedību - un ietekmi uz dzīvo organismu un vidi kopumā. Mikrobioloģija ir dinamisks un strauji attīstošs lauks, kas - sniedz būtisku ieguldījumu cilvēku veselības, pārtikas drošības un vides ilgtspējas uzlabošanā.

- -

Kāpēc mikrobioloģija ir svarīga?

-
    -
  • Veselības uzlabošana
  • -
  • Pārtikas drošība
  • -
  • Ekosistēmu ilgtspēja
  • -
- - Vairāk - informācijas par mikrobioloģiju - -
- - Skaistums - Zils skaistums - Cits skaistums - -
- - -

Pagājušo gadu ZPD tēmas

-
-
-
Mikrobiālā daudzveidība un ekosistēmu stabilitāte
-
Antibiotiku rezistence: Izšķirošais izaicinājums mūsdienu medicīnā
-
Probiotikas un cilvēka veselība
-
-
-
Mikrobiālās infekcijas un to kontrole
-
Mikrobioloģija un pārtikas drošība
-
Mikrobiālās saskares ar cilvēku: Symbioze un patogēnija
-
-
-
Mikrobioloģija un vides ilgtspēja
-
Infekcijas slimību izplatīšanās
-
-
-

Citas jautrās mikrobioloģijas tēmas:

- - - - - - - - - - - - - - -
Interesanti Eksotiski
Mikrobu dzīvesveidsBiotehnoloģijas un mikrobioloģija
Bakteriju nomenklatūra Mikrobu laboratorijas procedūras
- -
-

Citi raksti par mikrobioloģiju

- -
-
- ... -
-
Bakterioloģija
-

Pētījumi par baktērijām, to struktūru, ģenētiku un funkcijām. -

- Vairāk -
-
- -
- ... -
-
Vīrusoloģija
-

Zinātne par vīrusiem, to ietekmi uz dzīvajiem organismiem un - infekciju mehānismiem.

- Vairāk -
-
- -
- ... -
-
Mikoloģija
-

Pētījumi par sēnēm un to īpašībām, tostarp sēnīšu infekcijām un to - bioloģiju.

- Vairāk -
-
-
- - -
-

Vairāk pirekšmetu:

-
- - - - - -
- - - diff --git a/templates/form.html b/templates/form.html index 458db3e..2463e02 100644 --- a/templates/form.html +++ b/templates/form.html @@ -1,3 +1,4 @@ +{% extends "navbar.html" %} @@ -13,13 +14,43 @@ integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"> + + + + {{ super () }} + {% block content %}
+ +
-

-

-

+

+

+ + Show Password +

+

+

+ Remember Me +

+

+ + +
+ {% endblock content %} + {{ super() }} \ No newline at end of file diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..f256b3d --- /dev/null +++ b/templates/home.html @@ -0,0 +1,29 @@ +{% extends "navbar.html" %} + + + + + + + + HTML 5 Boilerplate + + + + + + {{ super () }} + {% block content %} +
+

Get to know your true self!

+ Book your ticket to the paradise! +

or read about microbiology! Firstly, login

! +
+ + {% endblock content %} + {{ super() }} + + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 6eb566e..e9d1501 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,3 +1,4 @@ +{% extends "navbar.html" %} @@ -8,55 +9,18 @@ HTML 5 Boilerplate - + + {{ super () }} + {% block content %}
{% if name %}

Hello, {{ name }}

{% else %} -

Hello, unknown

+

Hello, unknow

{% endif %}
- -

Mikrobioloģija

@@ -107,18 +71,19 @@

Pagājušo gadu ZPD tēmas

-
Mikrobiālā daudzveidība un ekosistēmu stabilitāte
-
Antibiotiku rezistence: Izšķirošais izaicinājums mūsdienu medicīnā
-
Probiotikas un cilvēka veselība
+ +
Mikrobiālā daudzveidība un ekosistēmu stabilitāte
+
Antibiotiku rezistence: Izšķirošais izaicinājums mūsdienu medicīnā
+
Probiotikas un cilvēka veselība
-
Mikrobiālās infekcijas un to kontrole
-
Mikrobioloģija un pārtikas drošība
-
Mikrobiālās saskares ar cilvēku: Symbioze un patogēnija
+
Mikrobiālās infekcijas un to kontrole
+
Mikrobioloģija un pārtikas drošība
+
Mikrobiālās saskares ar cilvēku: Symbioze un patogēnija
-
Mikrobioloģija un vides ilgtspēja
-
Infekcijas slimību izplatīšanās
+
Mikrobioloģija un vides ilgtspēja
+
Infekcijas slimību izplatīšanās

Citas jautrās mikrobioloģijas tēmas:

@@ -186,8 +151,8 @@
-

Get to know your true self!

- Book your ticket to the paradise! -
- + + {% endblock content %} + {{ super() }} + \ No newline at end of file diff --git a/templates/navbar.html b/templates/navbar.html new file mode 100644 index 0000000..7130db5 --- /dev/null +++ b/templates/navbar.html @@ -0,0 +1,70 @@ + + + + + + + + + HTML 5 Boilerplate + + {% block title %} + My Webpage + {% endblock %} + + + +