Paul's Programming Notes     Archive     Feed     Github

Checkmark "column_formatters" - Flask-Admin

In your custom ModelView, you need to add the following lines:
from flask.ext.admin.model.template import macro
column_formatters = dict(your_column=macro('render_your_column'))
list_template = 'list.html'

In your custom list.html template, you need to add the following jinja2 code:
{% macro render_your_column(model, column) %}
{% if model.your_column%}<i class="icon-ok"></i>{% endif %}
{% endmacro %}

If your row has a value in "your_column", then it will show as a checkmark. You need to make a new macro for each column.