I have a simple model Call and I'm using Flask-Admin to create/edit/delete instances of this model.
One of the field of Call is the path to an audio file. I would like to be able to play the file in the admin by adding some html code. I checked the template flask_admin/templates/bootstrap3/admin/model/list.html
and it seems that the only way to do what I want is to add a cell at the end of the row, which means extending list.html, copying the whole block list_row
and adding my cell.
Is it the only way? Or is there any way to add a "fake" field with my audio player (basically an html5 ) to the form?
flask_admin/templates/bootstrap3/admin/model/list.html
....
{% for c, name in list_columns %}
<td class="col-{{c}}">
{% if admin_view.is_editable(c) %}
{% if form.csrf_token %}
{{ form[c](pk=get_pk_value(row), value=get_value(row, c), csrf=form.csrf_token._value()) }}
{% else %}
{{ form[c](pk=get_pk_value(row), value=get_value(row, c)) }}
{% endif %}
{% else %}
{{ get_value(row, c) }}
{% endif %}
</td>
{% endfor %}
<td>ADD MY CUSTOM CELL HERE?</td>
....
models.py
class Call(db.Model):
__tablename__ = 'calls'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Unicode(64))
path = db.Column(db.Unicode(128))
def __unicode__(self):
return self.name
audio
html 5 tag though. – Ankh