How do I override the default registration form in Flask-Security is to remove all label attributes. In the documentation there is a section of the customizing view, but in the example is to add the fields to the form, and I need to change the default.
Asked
Active
Viewed 1,087 times
1 Answers
2
I did this by editing the _macros.html file in the flask-security library, by default it looks like this:
{% macro render_field_with_errors(field) %}
<p>
{{ field.label }} {{ field(**kwargs)|safe }}
{% if field.errors %}
<ul>
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
{% endmacro %}
To remove labels, remove the label expansion:
{% macro render_field_with_errors(field) %}
<p>
{{ field(**kwargs)|safe }}
{% if field.errors %}
<ul>
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
{% endmacro %}
The file for me (using venv) was in this path, you might want to find it with find or otherwise: ./venv/lib/python3.4/site-packages/flask_security/templates/security/_macros.html

DevOops
- 943
- 2
- 10
- 21