On Sun, Jun 21, 2009 at 4:05 PM, Vlad(L) <[email protected]> wrote:

>
> 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...
>
>
> >
>
The django-developers mailing list is for the development of Django itself,
not development with Django itself.  Please use the django-users mailing
list or the #django channel on IRC.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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