add basic functionality
This commit is contained in:
25
src/anki_creator_flask/mainapp.py
Normal file
25
src/anki_creator_flask/mainapp.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Pip
|
||||
from flask import Blueprint, render_template, request
|
||||
|
||||
mainapp = Blueprint("mainapp", __name__, template_folder="templates", url_prefix="/app", static_folder="static")
|
||||
|
||||
|
||||
@mainapp.route("/", methods=["GET", "POST"])
|
||||
def show():
|
||||
if request.method == "GET":
|
||||
args = request.args.to_dict()
|
||||
deck_type = args.get("deck_type", "")
|
||||
language = args.get("language", "")
|
||||
output_type = args.get("output_type", "")
|
||||
if not deck_type or not language or not output_type:
|
||||
state = "new"
|
||||
else:
|
||||
print()
|
||||
print(deck_type, language, output_type)
|
||||
print()
|
||||
state = "complete"
|
||||
elif request.method == "POST":
|
||||
state = "ready"
|
||||
form = request.form.to_dict()
|
||||
|
||||
return render_template(f"app.html", data=locals())
|
||||
Reference in New Issue
Block a user