Skip to content

Commit c76da74

Browse files
committed
Update route and view
1 parent 2e2b20c commit c76da74

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

views/dice.html

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ <h1>Your dice roll result:</h1>
1010
<h2 id="result">{{ random }}</h2>
1111
<br>
1212
<p><a href="/dice">Roll it again</a></p>
13+
<br>
14+
<br>
15+
<p id="time">{{ time }}</p>
1316
</center>
1417
</body>
1518
</html>

web.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
https://realpython.com
55
"""
6+
from datetime import datetime
67
import random
78

89
import bottle
@@ -54,7 +55,9 @@ def dionysus():
5455

5556
@bottle.route('/dice')
5657
def dice():
57-
return bottle.template('views/dice.html', random=random.randint(1, 6))
58+
result = random.randint(1, 6)
59+
time = datetime.now().strftime("%B %d, %Y %I:%M:%S%p")
60+
return bottle.template('views/dice.html', random=result, time=time)
5861

5962

6063
app = bottle.default_app()

0 commit comments

Comments
 (0)