dev #1

Merged
alientim merged 145 commits from dev into main 2025-10-12 13:44:14 +02:00
Showing only changes of commit 0fd53990e6 - Show all commits

View File

@@ -204,6 +204,21 @@ def devices():
switch_hostname = request.form.get('switch_hostname') or None
is_active = 1 if 'is_active' in request.form else 0
# --- Prüfen, ob es sich um eine Switch-Änderung handelt ---
if mac is None and rpi_ip is None and port is None and name is None and switch_hostname:
# Nur den Switch ändern
try:
conn.execute("""
UPDATE devices
SET switch_hostname=?
WHERE mac=?
""", (switch_hostname, old_mac))
conn.commit()
flash("Switch wurde geändert.")
except sqlite3.IntegrityError:
flash("Fehler beim Ändern des Switch!")
return redirect(url_for('devices'))
if not all([old_mac, mac, rpi_ip, port, name]):
flash("Alle Felder müssen ausgefüllt sein!")
return redirect(url_for('devices'))