Removed underline from links, generated ids
This commit is contained in:
parent
921f3ed582
commit
b64399093a
@ -11,12 +11,12 @@ datafile = "data.csv"
|
|||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
generate_id()
|
|
||||||
return render_template('index.html', title='Test', text='Hallo, Fooboar')
|
return render_template('index.html', title='Test', text='Hallo, Fooboar')
|
||||||
|
|
||||||
@app.route('/form')
|
@app.route('/form')
|
||||||
def 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')
|
@app.route('/result')
|
||||||
def result():
|
def result():
|
||||||
@ -36,9 +36,20 @@ def solution():
|
|||||||
|
|
||||||
def generate_id():
|
def generate_id():
|
||||||
data = list()
|
data = list()
|
||||||
new_id = uuid.uuid1().split("-")[0]
|
|
||||||
|
|
||||||
if not os.path.exists(datafile):
|
if not os.path.exists(datafile):
|
||||||
open(datafile, "a").close()
|
open(datafile, "a").close()
|
||||||
|
|
||||||
with open(datafile, "r") as f:
|
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
|
||||||
|
|||||||
@ -73,6 +73,11 @@ li a{
|
|||||||
background-color: #3e8e41;
|
background-color: #3e8e41;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove underline effect if links are inside a div (cf. index.html) */
|
||||||
|
div a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* logo image class */
|
/* logo image class */
|
||||||
.logo {
|
.logo {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<img src="static/images/WIAILogo.png" alt="Fachschaft WIAI" class="logo"/>
|
<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>
|
</header>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Fooboar says Hi</h2>
|
<h2>Fooboar says Hi to {{ your_id }}</h2>
|
||||||
|
|
||||||
<form action="/action_page.php">
|
<form action="/action_page.php">
|
||||||
<p>Fiktionaler Computer<br>
|
<p>Fiktionaler Computer<br>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user