mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-29 18:59:57 +00:00
Added logs.html for the logs page Changed dashboard.html so the numberplates show on the dashboard Moved models.py to to the dashboard folder
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from flask import Blueprint, render_template
|
|
from flask_login import login_required
|
|
from application.dashboard.models import AllowedPlate, LoggedItem
|
|
from application import db, app
|
|
from application.dashboard.forms import npForm
|
|
|
|
dash_blueprint = Blueprint("dash", __name__, template_folder="templates")
|
|
|
|
|
|
|
|
@dash_blueprint.route('/dashboard')
|
|
#@login_required
|
|
def dashboard():
|
|
#print("test123")
|
|
#with app.app_context():
|
|
Plates = AllowedPlate.query.all()
|
|
print(Plates)
|
|
return render_template("dashboard.html", AllowedPlates = Plates)
|
|
|
|
@dash_blueprint.route('/add', methods=['GET', 'POST'])
|
|
#@login_required
|
|
def add():
|
|
|
|
form = npForm()
|
|
|
|
if form.validate_on_submit():
|
|
if form.numberplate.data:
|
|
print(form.numberplate.data)
|
|
ap = AllowedPlate(plate=form.numberplate.data)
|
|
|
|
db.session.add(ap)
|
|
db.session.commit()
|
|
|
|
|
|
|
|
return render_template("add.html", form=form)
|
|
|
|
@dash_blueprint.route('/logs', methods=['GET', 'POST'])
|
|
#@login_required
|
|
def logs():
|
|
form = LoggedItem.query.all()
|
|
return render_template("logs.html", form=form) |