Skip to content

Commit

Permalink
fix: Do not render hidden form fields twice (#1848)
Browse files Browse the repository at this point in the history
* Fix german translation for "user registrations"

* Exlcude hidden fields from render_field
  • Loading branch information
Dosenpfand committed Jul 5, 2022
1 parent 83754b1 commit ccc6292
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions flask_appbuilder/templates/appbuilder/general/lib.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,18 @@


{% macro render_field(field, begin_sep_label='', end_sep_label='', begin_sep_field='', end_sep_field='') %}
{% if field.id != 'csrf_token' %}
{% if field.type == 'HiddenField' %}
{{ field}}
{% else %}
{{begin_sep_label|safe}}
<label for="{{field.id}}" control-label>
{{ field.label.text }}
{% if field.flags.required %}
<strong style="color: red">&#42;</strong>
{% endif %}
</label>
{{end_sep_label|safe}}
{{begin_sep_field|safe}}
{{ field(**kwargs)|safe }}
<span class="help-block">{{ field.description }}</span>
{% endif %}
{% if (field.id != 'csrf_token') and (field.type != 'HiddenField') %}
{{begin_sep_label|safe}}
<label for="{{field.id}}" control-label>
{{ field.label.text }}
{% if field.flags.required %}
<strong style="color: red">&#42;</strong>
{% endif %}
</label>
{{end_sep_label|safe}}
{{begin_sep_field|safe}}
{{ field(**kwargs)|safe }}
<span class="help-block">{{ field.description }}</span>
{% if field.errors %}
<div class="alert alert-danger">
{% for error in field.errors %}
Expand Down

0 comments on commit ccc6292

Please sign in to comment.