如何使用当前图像文件名预填充 WTForm FileField?

问题描述

用户想要使用 WTForm 更新帖子时,我如何在表单上预填充 FileField 输入以显示当前图像名称

目前,用户每次更新帖子的其他方面时都必须上传相同的图片,否则当前图片将被删除,因为帖子正在更新而没有图片

我目前如何预填充表单:

    if request.method == 'GET':
        form.title.data = post.title
        form.language.data = post.language
        form.alt.data = post.alt
        form.text.data = post.content
        form.tag_1.data = post.tag_1
        form.tag_2.data = post.tag_2
        form.tag_3.data = post.tag_3
        form.image.data = post.img # This is the line where I am trying to pre-populate the FieldField

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)