开发者

Django - Remove "Currently" In An Image Edit Form and Replace It With The Actual Image

开发者 https://www.devze.com 2023-02-26 21:08 出处:网络
When editing an object that has an image field, you are pres开发者_如何学运维ented with the current image path and the standard file upload field. What I want to do is to be able to replace the shown

When editing an object that has an image field, you are pres开发者_如何学运维ented with the current image path and the standard file upload field. What I want to do is to be able to replace the shown path(the "Currently: /pathtoimage.jpg" with the actual image. How do I do this?

Thanks in advance!


If you are talking about a form in Django's admin you could override the AdminImageWidget.

There are few snippets and posts that explain the details:

  • Django simple admin ImageField thumbnail
  • ImageField for admin with thumbnail
  • Admin Image Widget

For regular forms you should take a look at 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号