Hello,
Just getting started learning django, and I'm having trouble with a
view. Here is the model I've created:
from django.db import models
class Post (models.Model):
text = models.CharField(max_length=30)
def __str__(self):
return self.text
I have a couple test rows of data in my database. From the
interactive shell (manage.py shell), I can return data correctly with
Post.objects.filter(id=1) When I attempt to return the same data with
my view, it does not appear to work. Here is the view:
from django.http import HttpResponse
from board.models import Post
def current_board(request):
posts = Post.objects.filter(id=1)
html = "<html><body> %s</body><html>" % posts
return HttpResponse(html)
The above simply prints "[ ]" Any thoughts? I'm a django newbie with
no programming experience, so I'm sure it's something basic. Thanks
in advance for the help!
-Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---