我试图从data_template中存储的HTML标记中删除delete-checkbox。有没有办法只覆盖data_template或者我必须继承整个ImageUploadField吗?
ImageUploadField:http://flask-admin.readthedocs.io/en/latest/_modules/flask_admin/form/upload/#ImageUploadInput
答案 0 :(得分:1)
您必须先创建窗口小部件的实例,然后重写字段本身。解决方案:
class ImageFieldWidget(admin.form.ImageUploadInput):
data_template = ('<div class="image-thumbnail">'
' <img %(image)s>'
'</div>'
'<input %(file)s>')
class ImageField(admin.form.ImageUploadField):
widget = ImageFieldWidget()