problem in using the address stored in imagefield

*this is the news.html:*
<html>
<head>
<title>News</title>
</head>
<body>
{% if news_list %}
    <ul>
        {% for news in news_list %}
            <li><img src="{{ STATIC_URL }}/{{ news.image }}" width="100" 
height="100" />{{ news.image }} || {{ news.news }}</li>
        {% endfor %}
    </ul>
{% endif %}
</body>
</html>

*this  is the views*:
from django.shortcuts import render_to_response
from news.models import MainNews

def display_news(request):
    news_list=MainNews.objects.all().order_by('-date')
    return render_to_response('news/news.html',{'news_list':news_list})

*this is the models.py:*

from django.db import models

class MainNews(models.Model):
    news=models.CharField(max_length=200)
    date=models.DateTimeField('date published')
    image=models.ImageField(upload_to='news')

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/hyLg-1updDYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to