But I unfortunately cannot still make.
My problem: that in the Template the picture was displayed
For example, I load in Django Admin article, I write title, anonce,
body and I load Image... It is necessary For me, that Image it was
deduced on a site together with title, anonce, body

My new code:


settings.py


MEDIA_ROOT = 'C:/booksite/media/'
MEDIA_URL = 'http://127.0.0.1:8000/media'


models.py


class Article(models.Model):
        title = models.CharField(max_length=200)
        anonce = models.TextField()
        body = models.TextField()
        url = models.URLField(unique=True)
        date = models.DateTimeField()
        image = models.ImageField(upload_to='media/')


views.py


def art(request):
        art = Article.objects.all()
        return render_to_response('art.html', {'art': art})


art.html


{% for art in art %}
    <h1>{{ art.title }}</h1>
    <h3>{{art.anonce }}</h3>
     <p><img src="{{art.image}}" alt= "" width="200" height="100" ></
p>


urls.py


urlpatterns = patterns('',
        ('^$', index),
        (r'^books/$', archive),
        (r'^pub/$', publisher),
        (r'^article/$', art),
        (r'^admin/(.*)', admin.site.root),


)


For some reason for me title, anonce are output well, and image it is
not output - there an empty square with a red dagger in a browser...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to