python - Django - 在图像编辑表单中删除 "Currently"并将其替换为实际图像

标签 python django django-forms

在编辑具有图像字段的对象时,您会看到当前图像路径和标准文件上传字段。我想要做的是能够用实际图像替换显示的路径(“当前:/pathtoimage.jpg”。我该怎么做?

提前致谢!

最佳答案

如果您在讨论 Django 管理中的表单,您可以覆盖 AdminImageWidget。

有几个片段和帖子解释了细节:

对于常规表格,您应该查看 django-form-utils :

This application provides utilities for enhancing Django's form handling:

An ImageWidget which display a thumbnail of the image rather than just the filename.

关于python - Django - 在图像编辑表单中删除 "Currently"并将其替换为实际图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5722899/

相关文章:

python - 在 Django 中将 Postgres 与 Oscar 同步时出现编程错误

python - "norm"是否等同于 "Euclidean distance"?

python - 无法让 python.manage.pysyncdb 工作

python - 比较日期字段的年月是否大于

Django:切换从管理面板发送的消息的语言

python - 对 Django 表单 POST 请求的结果进行分页

python - tensorflow 获取 string_input_producer 的大小

Python:在为 __init__subclass__() 提供参数的同时动态创建类

Django表单覆盖ForeignKey查询集

python - Django modelForm 和 html 模板 - 安全问题