File tree Expand file tree Collapse file tree 5 files changed +56
-3
lines changed
bottle/primeri/01_primeri-bottle Expand file tree Collapse file tree 5 files changed +56
-3
lines changed Original file line number Diff line number Diff line change 1+ auth = dict (
2+ host = "baza.fmf.uni-lj.si" ,
3+ dbname = "ime_baze" ,
4+ user = "uporabnisko_ime" ,
5+ password = "geslo"
6+ )
Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
2+ from datetime import datetime
3+
4+
5+ @dataclass
6+ class Kraj :
7+ posta : int
8+ kraj : str
9+
10+
11+ @dataclass
12+ class Oseba :
13+ emso : str
14+ ime : str
15+ priimek : str
16+ naslov : str
17+ kraj : Kraj
18+
19+
20+ @dataclass
21+ class Racun :
22+ stevilka : int
23+ lastnik : Oseba
24+
25+
26+ @dataclass
27+ class Transakcija :
28+ id : int
29+ racun : Racun
30+ znesek : int
31+ cas : datetime = None
32+ opis : str = None
Original file line number Diff line number Diff line change 77
88@route ('/' )
99def index ():
10- return 'ŽIVJO svet!'
10+ return 'Živjo svet!'
1111
1212# Če dopišemo reloader=True, se bo sam restartal vsakič, ko spremenimo datoteko
1313run (host = 'localhost' , port = 8080 , reloader = True )
Original file line number Diff line number Diff line change @@ -39,11 +39,12 @@ def ucitelji_slabi():
3939
4040
4141@get ('/ucitelji/' )
42+ @view ('ucitelji.html' )
4243def ucitelji ():
4344 c = baza .cursor ()
4445 c .execute ("SELECT id,ime,povezava FROM ucitelj ORDER BY ime" )
4546 # TAKO SE DELA!
46- return template ( 'ucitelji.html' , ucitelji = c )
47+ return dict ( ucitelji = c )
4748
4849
4950
@@ -54,4 +55,4 @@ def ucitelji():
5455baza = sqlite3 .connect (baza_datoteka , isolation_level = None )
5556
5657# poženemo strežnik na portu 8080, glej http://localhost:8080/
57- run (host = 'localhost' , port = 8080 )
58+ run (host = 'localhost' , port = 8080 , reloader = True )
Original file line number Diff line number Diff line change @@ -49,6 +49,20 @@ def odjava():
4949 redirect ('/prijava' )
5050
5151
52+ @get ("/google" )
53+ def google ():
54+ q = request .query .q
55+ return f"""
56+ <html>
57+ <form action="/google" method="GET">
58+ <input name="q" type="text" />
59+ <input type="submit" value="Išči" />
60+ </form>
61+
62+ <a href="https://www.google.com/search?q={ q } ">Poguglaj { q } !</iframe>
63+ </html>
64+ """
65+
5266def preveri (uime , geslo ):
5367 return uime == "janez" and geslo == "kranjski"
5468
You can’t perform that action at this time.
0 commit comments