diff --git a/doorlockd-new/templates/formhelpers.html b/doorlockd-new/templates/formhelpers.html index 8690d30..69a0ae4 100644 --- a/doorlockd-new/templates/formhelpers.html +++ b/doorlockd-new/templates/formhelpers.html @@ -10,3 +10,15 @@ {% endif %} {% endmacro %} + +{% macro render_field(field) %} +
{{ field(**kwargs)|safe }} + {% if field.errors %} + + {% endif %} +
+{% endmacro %} diff --git a/doorlockd-new/templates/index.html b/doorlockd-new/templates/index.html index 4cc4ab5..0a59f16 100644 --- a/doorlockd-new/templates/index.html +++ b/doorlockd-new/templates/index.html @@ -1,4 +1,4 @@ -{% from "formhelpers.html" import render_field_label %} +{% from "formhelpers.html" import render_field_label, render_field %} @@ -37,11 +37,13 @@ margin-top: 40px; } + {{ state_img }}
{{ render_field_label(authentication_form.username) }} {{ render_field_label(authentication_form.password) }} - {{ render_field_label(authentication_form.open) }} - {{ render_field_label(authentication_form.close) }} +
+ {{ render_field(authentication_form.open) }} + {{ render_field(authentication_form.close) }} {{ authentication_form.csrf_token }}
{% if response %} @@ -50,6 +52,5 @@ {% endif %}
Die Kitchen ist: {{ state_text }} - {{ state_img }}