add models and index route
This commit is contained in:
parent
872e0e2416
commit
dd142693d9
@ -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)
|
||||
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user