diff --git a/__pycache__/app.cpython-310.pyc b/__pycache__/app.cpython-310.pyc index 4fed411..4c2985c 100644 Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ diff --git a/app.py b/app.py index 11cd6e1..3e29b43 100644 --- a/app.py +++ b/app.py @@ -68,20 +68,14 @@ def home(): return render_template('home.html', categories=categories) -# @app.route("/add", methods=['GET', 'POST']) -# def create(): -# # the goal here is to choose from a list of parameters what you want to add -# # 1- ogni blocco del form dovrebbe essere una tabella a parte -# if request.method == 'POST': -# title = request.form.get('title') -# author = request.form.get('author') -# description = request.form.get('description') -# add_book(author, title, description) -# # if author: -# # return url_for('add_new_author') - -# return redirect(url_for('home')) -# return render_template('add_new.html') +@app.route("/add/", methods=['GET', 'POST']) +def create(): + conn = get_db_connection() + + categories = conn.execute('SELECT title FROM categories;').fetchall() + conn.close() + + return render_template('create.html', categories=categories) # app.run(port=3148) diff --git a/templates/add_new.html b/templates/add_new.html deleted file mode 100644 index 019af8e..0000000 --- a/templates/add_new.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - library - - - -
- - diff --git a/templates/base.html b/templates/base.html index 86bb645..de535cf 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,7 +7,7 @@ - + New {% block content %} {% endblock %} diff --git a/templates/create.html b/templates/create.html new file mode 100644 index 0000000..b969f7e --- /dev/null +++ b/templates/create.html @@ -0,0 +1,23 @@ + + + + + library + + + +
+ +