{% extends "base.html" %} {% block title %}LabRat Setup{% endblock %} {% block content %}

LabRat Setup

Logging

{{ set_mess }} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %}
{{ message }}
{% endfor %} {% endif %} {% endwith %}

Database Configuration

{{ db_form.hidden_tag() }}

{{ db_form.file_path.label }} {{ db_form.file_path(size=60) }} {% for error in db_form.file_path.errors %} {{ error }} {% endfor %}

{{ db_form.submit() }}


Device Configuration

{{ device_form.hidden_tag() }}
{# Render any server-side entries (e.g. on validation failure / repopulation) #} {% for device in device_form.devices %}

Device {{ loop.index }}

{% for field in device %} {% if field.name not in ['csrf_token', 'sensors', 'controls'] %}

{{ field.label }} {{ field() }} {% for error in field.errors %} {{ error }} {% endfor %}

{% endif %} {% endfor %}
{% for sensor in device.sensors %}

Sensor {{ loop.index }}

{% for field in sensor %} {% if field.name != 'csrf_token' %}

{{ field.label }} {{ field() }}

{% endif %} {% endfor %}
{% endfor %}
{% for control in device.controls %}

Control {{ loop.index }}

{% for field in control %} {% if field.name != 'csrf_token' %}

{{ field.label }} {{ field() }}

{% endif %} {% endfor %}
{% endfor %}
{% endfor %}

{{ device_form.submit() }}

{# Pass the schema to JS as JSON - single source of truth #} {% endblock %} {% block scripts %} {{ super() }} {% endblock %}