Create admin view table (no interaction yet)
This commit is contained in:
parent
0bc9e3fb44
commit
a9abb30810
@ -77,9 +77,22 @@ def questions():
|
|||||||
def result(user_id):
|
def result(user_id):
|
||||||
return render_template('result.html', title='Sortierhut', hausname='Knuth', haustext='Mitglieder dieses Hauses mögen LaTeX-Anzüge und Eisbären.', id=user_id)
|
return render_template('result.html', title='Sortierhut', hausname='Knuth', haustext='Mitglieder dieses Hauses mögen LaTeX-Anzüge und Eisbären.', id=user_id)
|
||||||
|
|
||||||
@app.route('/admin')
|
def convert_csv_to_list_of_lists():
|
||||||
|
list_of_lists = list()
|
||||||
|
|
||||||
|
if not os.path.exists(datafile):
|
||||||
|
open(datafile, 'a').close()
|
||||||
|
|
||||||
|
with open(datafile, 'r', newline='') as f:
|
||||||
|
reader = csv.reader(f)
|
||||||
|
for line in reader:
|
||||||
|
list_of_lists.append(line)
|
||||||
|
return list_of_lists
|
||||||
|
|
||||||
|
@app.route('/admint_rocks_20190417')
|
||||||
def admin():
|
def admin():
|
||||||
return render_template('admin.html', title='Sortierhut', text='Hallo, Admin Fooboar')
|
file_data = convert_csv_to_list_of_lists()
|
||||||
|
return render_template('admin.html', title='Sortierhut', text='Hallo, Admin Fooboar', file_data=file_data)
|
||||||
|
|
||||||
@app.route('/answers', methods=['GET', 'POST'])
|
@app.route('/answers', methods=['GET', 'POST'])
|
||||||
def answers():
|
def answers():
|
||||||
|
|||||||
@ -100,3 +100,9 @@ header h1 {
|
|||||||
.choice {
|
.choice {
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* table for admin view */
|
||||||
|
table, th, td {
|
||||||
|
border: 1px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|||||||
@ -1 +1,24 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<h1>Übersicht</h1>
|
||||||
|
<table style="width: 100%">
|
||||||
|
<tr>
|
||||||
|
<th>id</th>
|
||||||
|
<th>computer</th>
|
||||||
|
<th>status</th>
|
||||||
|
<th>vegetable</th>
|
||||||
|
<th>spirit_animal</th>
|
||||||
|
<th>operating_system</th>
|
||||||
|
</tr>
|
||||||
|
{% for row in file_data %}
|
||||||
|
<tr>
|
||||||
|
<th>{{ row[0] }}</th>
|
||||||
|
<th>{{ row[1] }}</th>
|
||||||
|
<th>{{ row[2] }}</th>
|
||||||
|
<th>{{ row[3] }}</th>
|
||||||
|
<th>{{ row[4] }}</th>
|
||||||
|
<th>{{ row[5] }}</th>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user