add models and index route

This commit is contained in:
fram3d 2024-01-15 20:15:44 +01:00
parent 872e0e2416
commit dd142693d9
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
2 changed files with 15 additions and 12 deletions

View File

@ -1,7 +1,17 @@
from taskmanager import db
class Table(db.Model):
class Task(db.Model):
id = db.Column(db.Integer, primary_key=True)
variable1 = db.Column(db.Integer, nullable=False)
variable2 = db.Column(db.Integer, nullable=False)
name = db.Column(db.String, nullable=False)
desc = db.Column(db.String, nullable=True)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String, nullable=False)
contact = db.Column(db.String, nullable=False)
class TaskUser(db.Model):
id = db.Column(db.Integer, primary_key=True)
taskid = db.Column(db.Integer, nullable=False)
userid = db.Column(db.Integer, nullable=False)

View File

@ -5,15 +5,8 @@ from taskmanager.models import *
@app.route('/', methods=['GET'])
def index():
if request.method == 'GET':
localvariable1 = "Placeholder1"
localvariable1 = "Placeholder2"
try:
return render_template('index.html', pagevariable1 = localvariable1, pagevariable2 = localvariable2 )
except:
return 'Error retriving page'
else:
return 'HTTP request method not recogniezed'
tasks = Task.query.all()
return render_template('index.html', tasks = tasks)
@app.route('/submit', methods=['POST', 'GET'])
def submit():