mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-29 18:59:57 +00:00
functionele logs toegevoegd in seed.py AT
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
from application import db, app
|
||||
from application.dashboard.models import AllowedPlate
|
||||
from application.dashboard.models import AllowedPlate, LoggedItem, datetime
|
||||
|
||||
with app.app_context():
|
||||
AllowedPlate.query.delete()
|
||||
db.session.add(AllowedPlate("MUN389"))
|
||||
db.session.commit()
|
||||
|
||||
with app.app_context():
|
||||
LoggedItem.query.delete()
|
||||
db.session.add(LoggedItem("MUN389", datetime.now(), True))
|
||||
db.session.add(LoggedItem("MUN389", datetime.now(), False))
|
||||
db.session.commit()
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for form in recent_logs %}
|
||||
{% for log in logs %}
|
||||
<tr>
|
||||
<td><small class="fs-6">{{ form.timestamp.strftime('%H:%M:%S') }}</small></td>
|
||||
<td><small class="fs-6">{{ plate.plate }}</small></td>
|
||||
<td><small class="fs-6">{{ log.dateLogged.strftime('%H:%M:%S') }}</small></td>
|
||||
<td><small class="fs-6">{{ log.plate }}</small></td>
|
||||
<td>
|
||||
<span class="badge {% if log.status == 'success' %}bg-success{% elif log.status == 'warning' %}bg-warning{% elif log.status == 'error' %}bg-danger{% else %}bg-secondary{% endif %} fs-6">
|
||||
{{ form.allowed }}
|
||||
{{ log.allowed }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -12,8 +12,8 @@ dash_blueprint = Blueprint("dash", __name__, template_folder="templates")
|
||||
#@login_required
|
||||
def dashboard():
|
||||
Plates = AllowedPlate.query.all()
|
||||
recent_logs = LoggedItem.query.order_by(LoggedItem.dateLogged.desc()).limit(50).all()
|
||||
return render_template("dashboard.html", plates=Plates, recent_logs=recent_logs)
|
||||
logs = LoggedItem.query.order_by(LoggedItem.dateLogged.desc()).limit(50).all()
|
||||
return render_template("dashboard.html", plates=Plates, logs=logs)
|
||||
|
||||
|
||||
@dash_blueprint.route('/add', methods=['GET', 'POST'])
|
||||
|
||||
Reference in New Issue
Block a user