Friday, August 1, 2014

Re: Image upload problem with UserProfile and my form

This looks wrong to me:
 
<p><img src='/static/userprofile/uploaded_files/Currently: <a href="1406895413_91_tumblr_m5xo9h5X3E1qgfdhto1_500.gif">1406895413_91_tumblr_m5xo9h5X3E1qgfdhto1_500.gif</a> <input id="avatar-clear_id" name="avatar-clear" type="checkbox" /> <label for="avatar-clear_id">Clear</label><br />Change: <input id="id_avatar" name="avatar" type="file" />' width="200" /></p>

so maybe, rearranging your code a bit:
    {% if form.avatar %}
   
<p><img src="/static/userprofile/uploaded_files/{{ userprofile.avatar }}" width="200"></p>
    {% endif %}

   
<p>{{ form.avatar }}</p>


 

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/0a9a9ac1-2f10-420c-aaf0-d3e7b22308ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment