naredil preprost meni
parent
9faee0c32f
commit
91ae04a924
|
@ -0,0 +1,43 @@
|
||||||
|
from flask import (
|
||||||
|
Blueprint, flash, g, redirect, render_template, request, session, url_for
|
||||||
|
)
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
from auth import login_required
|
||||||
|
|
||||||
|
from config import CONFIG
|
||||||
|
from create_db import User
|
||||||
|
|
||||||
|
bp = Blueprint('menu', __name__, url_prefix='/menu')
|
||||||
|
|
||||||
|
engine = create_engine(CONFIG['DB_CONNECTION'])
|
||||||
|
dbsessionmaker = sessionmaker(bind=engine)
|
||||||
|
dbsession = dbsessionmaker()
|
||||||
|
|
||||||
|
@bp.route("/", methods=("GET", "POST"))
|
||||||
|
def index():
|
||||||
|
if 'user_id' in session:
|
||||||
|
user_id = session['user_id']
|
||||||
|
username = session['username']
|
||||||
|
|
||||||
|
print(username)
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
action = request.form.get("menu", False) #internetna rešitev, nevem kako, ampak dela, tj. dobi info iz meni buttonov
|
||||||
|
print(action)
|
||||||
|
if action == "new_session":
|
||||||
|
return redirect(url_for("deck"))
|
||||||
|
elif action == "matches":
|
||||||
|
pass
|
||||||
|
elif action == "upload":
|
||||||
|
pass
|
||||||
|
elif action == "settings":
|
||||||
|
pass
|
||||||
|
elif action == "instructions":
|
||||||
|
pass
|
||||||
|
elif action == "about":
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
return render_template("menu/menu.html", username=username)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
<h1>Menu</h1>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form method="post">
|
||||||
|
<button type="subimt" name="menu" value="new_session">New Session</button> <br />
|
||||||
|
<button type="subimt" name="menu" value="matches">Matches</button> <br />
|
||||||
|
<button type="subimt" name="menu" value="upload">Upload</button> <br />
|
||||||
|
<button type="subimt" name="menu" value="settings">Settings</button> <br />
|
||||||
|
<button type="subimt" name="menu" value="instructions">Instructions</button> <br />
|
||||||
|
<button type="subimt" name="menu" value="about">About</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue