Dateien
Hetzner-Backup/v2_adminpanel/TEMPLATE_FIXES_NEEDED.md
2025-06-18 00:07:34 +02:00

2.1 KiB

Template Fixes Needed - Tuple to Dictionary Migration

Problem

Die models.py Funktionen geben Dictionaries zurück, aber viele Templates erwarten noch Tupel mit numerischen Indizes.

Betroffene Templates und Routes:

1. FIXED: customers.html

  • Route: /customers
  • Funktion: get_customers()
  • Status: Bereits gefixt

2. FIXED: customers_licenses.html

  • Route: /customers-licenses
  • Status: Teilweise gefixt (customers list)
  • TODO: selected_customer wird per JavaScript geladen

3. FIXED: edit_customer.html

  • Route: /customer/edit/<id>
  • Funktion: get_customer_by_id()
  • Status: Bereits gefixt

4. licenses.html

  • Route: /licenses
  • Funktion: get_licenses()
  • Problem: Nutzt license[0], license[1], etc.
  • Lösung: Ändern zu license.id, license.license_key, etc.

5. edit_license.html

  • Route: /license/edit/<id>
  • Funktion: get_license_by_id()
  • Problem: Nutzt license[x] Syntax

6. sessions.html

  • Route: /sessions
  • Funktion: get_active_sessions()
  • Problem: Nutzt session[x] Syntax

7. audit_log.html

  • Route: /audit
  • Problem: Nutzt entry[x] Syntax

8. resources.html

  • Route: /resources
  • Problem: Nutzt resource[x] Syntax

9. backups.html

  • Route: /backups
  • Problem: Nutzt backup[x] Syntax

10. FIXED: batch_form.html

  • Route: /batch
  • Problem: Fehlende /api/customers Route
  • Status: API Route hinzugefügt

11. dashboard.html (index.html)

  • Route: /
  • Problem: Möglicherweise nutzt auch numerische Indizes

Batch License Problem

  • batch_create.html existiert nicht, stattdessen batch_form.html
  • Template mismatch in batch_routes.py Zeile 118

Empfohlene Lösung

  1. Alle Templates systematisch durchgehen und von Tupel auf Dictionary-Zugriff umstellen
  2. Alternativ: Models.py ändern um Tupel statt Dictionaries zurückzugeben (nicht empfohlen)
  3. Batch template name fix: batch_create.html → batch_form.html

Quick Fix für Batch

Zeile 118 in batch_routes.py ändern:

return render_template("batch_form.html", customers=customers)