Start generate_id() function

This commit is contained in:
Sauer 2019-04-11 21:54:30 +02:00
parent 6c1ae9b7ae
commit 921f3ed582

View File

@ -1,10 +1,17 @@
from flask import Flask, render_template
import uuid
import csv
import os
app = Flask(__name__)
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
datafile = "data.csv"
@app.route('/')
def index():
generate_id()
return render_template('index.html', title='Test', text='Hallo, Fooboar')
@app.route('/form')
@ -27,3 +34,11 @@ def answers():
def solution():
return render_template('solution.html', title='Test', text='Hallo, Lösung')
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: