diff --git a/app.py b/app.py index 8834f4d..d21afb1 100644 --- a/app.py +++ b/app.py @@ -1347,6 +1347,19 @@ def delete_printer(id): conn.commit(); conn.close() return redirect(url_for('printers_page')) +@app.route('/printers//edit', methods=['POST']) +@login_required +def edit_printer(id): + name = request.form.get('name','').strip() + ha_prefix = request.form.get('ha_entity_prefix','').strip().lower() + notes = request.form.get('notes','').strip() + if name: + conn = get_db() + conn.execute('UPDATE printers SET name=?, ha_entity_prefix=?, notes=? WHERE id=?', + (name, ha_prefix, notes, id)) + conn.commit(); conn.close() + return redirect(url_for('printers_page')) + @app.route('/working-schedule', methods=['GET','POST']) def working_schedule(): if request.method == 'POST': diff --git a/templates/printers.html b/templates/printers.html index 273bd5b..f2d37ed 100644 --- a/templates/printers.html +++ b/templates/printers.html @@ -38,6 +38,10 @@ {{ p.notes or '—' }}
+
+ + + +{% endblock %} + +{% block scripts %} + {% endblock %}