diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2013-04-15 00:30:25 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2013-04-15 00:30:25 +0200 |
commit | 58165e7f9c72f03604c54f2929b785fc39f760a5 (patch) | |
tree | 8ecff9c6dc18f4032ba9fbe8d4f4437c48b546d8 /templates | |
parent | 9fb5ed666cf428ae24ddcb1d5a306660526162be (diff) | |
download | kosten-58165e7f9c72f03604c54f2929b785fc39f760a5.tar.gz kosten-58165e7f9c72f03604c54f2929b785fc39f760a5.tar.bz2 kosten-58165e7f9c72f03604c54f2929b785fc39f760a5.zip |
Make a 'render_form' macro
Diffstat (limited to '')
-rw-r--r-- | templates/page.jinja | 10 | ||||
-rw-r--r-- | templates/pages/add.jinja | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/templates/page.jinja b/templates/page.jinja index 671f3b2..c09dcde 100644 --- a/templates/page.jinja +++ b/templates/page.jinja @@ -25,3 +25,13 @@ <{{tag}} style="{{style}}">{{caller()}}</{{tag}}> {% endif %} {% endmacro %} + +{% macro render_form(form) %} + <table> + {% for field in form if not field is hidden %} + <tr><th>{{ field.label }}</th><td>{{ field }}</td><td>{{ field.description }}</td> + <td>{% if field.errors %}<span class="error">{{ field.errors[0] }}</span>{% endif %}</td></tr> + {% endfor %} + </table> + {{ form.hidden_tag() }} +{% endmacro %} diff --git a/templates/pages/add.jinja b/templates/pages/add.jinja index 3e3caa2..4728e99 100644 --- a/templates/pages/add.jinja +++ b/templates/pages/add.jinja @@ -17,13 +17,7 @@ {% block content %} <form name="add_expense" method="post"> - <table> - {% for field in form if not field is hidden %} - <tr><th>{{ field.label }}</th><td>{{ field }}</td><td>{{ field.description }}</td> - <td>{% if field.errors %}<span class="error">{{ field.errors[0] }}</span>{% endif %}</td></tr> - {% endfor %} - </table> - {{ form.hidden_tag() }} + {{ render_form(form) }} {% block form_buttons %} <input type="submit" name="changeB"> {% endblock %} |