Evan:
> -----
>
> A views.py:
> -----
> def index(request):
> latest_values_list = Entry.objects.values()
>
> return render_to_response('blog/blog_list.html',
> {'latest_values_list': latest_values_list})
> -----
>
> A template blog_list.html:
> -----
> <html>
> <head><title>Blog Homepage</title></head>
>
> <body>
>
> <p><h1>{{title}}</h1></p>
>
> <p>Published on {{pub_date}}</p>
>
> <p>{{body}}</p>
>
> </html>
> -----
>
> My views.py is very wrong. So for now ignore it.
>
> I want to have all the data from Entry visible through the template to a
> web browser. I don't know what is a fast and efficient way to have my
> views.py deal with the database and then have my template show it. If
> anyone has any ideas it would be great.
>
> Thanks, Evan
Why don't you try in views.py
def index(request):
entries = Entry.objects.all().order_by('-pub_date')
t = loader.get_template('blog/index.html')
c = Context({
'posts' : entries,
})
return HttpResponse(t.render(c))
and in your html template something like this:
{% for post in posts %}
<h2><a href="./{{ post.slug }}.html" title="{{ post.title }}">
{{ post.title }}</a></h2>
<div class="postmeta">
<div class="postdate">{{ post.pub_date }}</div>
</div><!-- end postmeta -->
<div class="postcontent">
{{ post.body }}
</div>
{% endfor %}
RobertoZ
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---