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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALr9Q3ZxdpY4eLx1RhwRV8%3D5j9aeysti7NbYuP5bZDZrsNrDPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to