Hello,
I have following field in my model.
photo = models.ImageField(null=True,blank=True,upload_to="product_images")
I have defined the following layout in forms.py for this field, while
using crispy-form
self.fields['photo'].label = "Asset Image"
self.helper.layout = Layout(
'photo',
HTML("""{% if form.photo.value %}
<img height="80"
width="160"
class="pull-left"
src="{{ MEDIA_URL }}{{ form.photo.value }}">
{% endif %}""", ),
Now I can upload images associated with this particular field just
fine. However when I try to update the image I see the following in my
template:
http://i.imgur.com/wcB1JIP.png
Is there any way I can change the layout so that only the browse
button and existing image are shown when the image field is not empty?
In other words, remove the text Currently: product_images/km_2.jpeg
Clear Change:
-Subodh