Thursday, July 31, 2014

Re: image upload

Are you using <img src="{{ image.image.url }}" >  ?

On Thursday, July 31, 2014 7:20:19 AM UTC-4, ngangsia akumbo wrote:
i have a problem of displaying my image on my web page.

i have upload my pic in admin and when i display it it shows me the  this

media/Lighthouse_1.jpg

models.py

class Image(models.Model):
    title = models.CharField(max_length=60, blank=True, null=True)
    image = models.FileField(upload_to="images")


<div id="content">
<div id="content_plate">

<h2> {{ blogs.title }} - Date Published: {{blogs.pub_date}} </h2>
<p> {{ blogs.content|safe}} <br />Tags: {{ blogs.photo }}</p> 
<h2> Reported By: {{blogs.reporter}} </h2>
</div>
<div id='link_back'>
<ul>
<p>Return back to Main Page</p>
<li><a href="/blog/">News</a></li>
</ul>
 
</div>
{% endblock %}




MEDIA_ROOT = 'C:/Python27/Scripts/testproject/Django-1.4.3/django/bin/test0/images/'
MEDIA_URL = '/media/'

STATIC_ROOT = '' "
STATIC_URL = '/static/'







--
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/a39e3250-7ded-4d1a-8a48-7b026d4a81b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment