Removed underline from links, generated ids

This commit is contained in:
Sauer 2019-04-12 14:35:12 +02:00
parent 921f3ed582
commit b64399093a
4 changed files with 21 additions and 5 deletions

View File

@ -11,12 +11,12 @@ datafile = "data.csv"
@app.route('/')
def index():
generate_id()
return render_template('index.html', title='Test', text='Hallo, Fooboar')
@app.route('/form')
def form():
return render_template('form.html', title='Test', text='Hallo, Fooboar')
id = generate_id()
return render_template('form.html', title='Test', text='Hallo, Fooboar', your_id=id)
@app.route('/result')
def result():
@ -36,9 +36,20 @@ def solution():
def generate_id():
data = list()
new_id = uuid.uuid1().split("-")[0]
if not os.path.exists(datafile):
open(datafile, "a").close()
with open(datafile, "r") as f:
reader = csv.reader(f)
for line in reader:
data.append(line[0])
# best loop ever
while True:
new_id = str(uuid.uuid1()).split("-")[0]
if new_id in data:
break
else:
return new_id

View File

@ -73,6 +73,11 @@ li a{
background-color: #3e8e41;
}
/* Remove underline effect if links are inside a div (cf. index.html) */
div a {
text-decoration: none;
}
/* logo image class */
.logo {
width: 10%;

View File

@ -9,7 +9,7 @@
<body>
<header>
<img src="static/images/WIAILogo.png" alt="Fachschaft WIAI" class="logo"/>
<h1>Das Spiel der 1001 Möglichkeiten</h1>
<h1>Sorting is Fun! The Importance of Being Sorted</h1>
</header>
<nav>
<ul>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<h2>Fooboar says Hi</h2>
<h2>Fooboar says Hi to {{ your_id }}</h2>
<form action="/action_page.php">
<p>Fiktionaler Computer<br>