add models and index route
This commit is contained in:
parent
872e0e2416
commit
dd142693d9
@ -1,7 +1,17 @@
|
|||||||
from taskmanager import db
|
from taskmanager import db
|
||||||
|
|
||||||
class Table(db.Model):
|
class Task(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
variable1 = db.Column(db.Integer, nullable=False)
|
name = db.Column(db.String, nullable=False)
|
||||||
variable2 = db.Column(db.Integer, 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'])
|
@app.route('/', methods=['GET'])
|
||||||
def index():
|
def index():
|
||||||
if request.method == 'GET':
|
tasks = Task.query.all()
|
||||||
localvariable1 = "Placeholder1"
|
return render_template('index.html', tasks = tasks)
|
||||||
localvariable1 = "Placeholder2"
|
|
||||||
try:
|
|
||||||
return render_template('index.html', pagevariable1 = localvariable1, pagevariable2 = localvariable2 )
|
|
||||||
except:
|
|
||||||
return 'Error retriving page'
|
|
||||||
else:
|
|
||||||
return 'HTTP request method not recogniezed'
|
|
||||||
|
|
||||||
@app.route('/submit', methods=['POST', 'GET'])
|
@app.route('/submit', methods=['POST', 'GET'])
|
||||||
def submit():
|
def submit():
|
||||||
|
Loading…
Reference in New Issue
Block a user