You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a WebPage class to store pages scraped from web.
class WebPage(Document):
html = fields.StringField()
top_image = fields.StringField()
images = fields.ListField(fields.StringField())
... other fields.
I Defined a MyImageField to display image fields.
from wtforms import StringField
from wtforms.widgets import Input
from flask import render_template
class MyImageInputWidget(Input):
def __call__(self, field, **kwargs):
return render_template(
"my_image_widget.html",
field=field,
)
class MyImageField(StringField):
widget = MyImageInputWidget()
It is very easy to use with top_image field:
class WebPageModelView(ModelView):
form_overrides = {
'top_image': MyImageField,
}
It looks like
But how to use form_overrides on images field ?
The text was updated successfully, but these errors were encountered:
laiyonghao
changed the title
How to use form_override on ListField(StringField)?
How to use form_overrides on ListField(StringField)?
Dec 30, 2023
I have a
WebPage
class to store pages scraped from web.I Defined a
MyImageField
to display image fields.It is very easy to use with
top_image
field:It looks like
But how to use
form_overrides
onimages
field ?The text was updated successfully, but these errors were encountered: