Hey,
I am attempting to create a blog from scratch (it sounds like a great
way to learn something but it is a lot more work if it is the first
project you've done.)
I have a models.py:
-----
class Entry(models.Model):
title = models.CharField(maxlength=255, core=True)
pub_date = models.DateTimeField(core=True)
slug = models.SlugField(maxlength=30, prepopulate_from= ['title'])
body = models.TextField(core=True)
class Admin:
fields = (
(None, {'fields': ('slug', 'title', 'pub_date', 'body',)}),
)
def __str__(self):
return self.title
-----
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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---