Flask-Admin customize datetime view

Yes, you can set the column_type_formatters to define default formats. Also, you can set column_formatters to use custom formats only to one column in your list view.

https://flask-admin.readthedocs.org/en/latest/api/mod_model/#flask.ext.admin.model.BaseModelView.column_formatters https://flask-admin.readthedocs.org/en/latest/api/mod_model/#flask.ext.admin.model.BaseModelView.column_type_formatters


from flask_admin.model import typefmt
from datetime import date


def date_format(view, value):
    return value.strftime('%Y-%m-%d')

MY_DEFAULT_FORMATTERS = dict(typefmt.BASE_FORMATTERS)
MY_DEFAULT_FORMATTERS.update({
    date: date_format
})

form_args = dict(
    time = dict(validators=[DataRequired()],format='%Y-%m-%d %H:%M')
)
form_widget_args = dict(
    time={'data-date-format': u'YYYY-MM-DD HH:mm'} 
)
column_type_formatters = MY_DEFAULT_FORMATTERS

This will change the date format to 2014-02-22 13:30.