Oh.
Boy do I feel stupid.
Thanks for all your help. I'll try to be less careless next time.


On Oct 22, 8:43 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-10-21 at 23:33 -0700, guruyaya wrote:
> > This is actually worse
>
> You mean top-posting? Yes, it's a terrible habit and you should stop
> doing it.
>
>
>
> > blog/models.py
> > ----------------
> > from django.shortcuts import render_to_response as RenderToResponse
> > from myblog.blog.models import Post
> > def listposts(request):
> >         a = Post.objects.all()
> >         a = list(a)
> >         a[0].title = 'hihi'
> >         a[0].content = 'haha'
> >         return RenderToResponse('blog/showlist.html',{'postlist': a});
>
> > Just shows me a blank page (with <h1>Hello</h1> on top).
>
> > What am I missing?
>
> I'll bet you didn't change your template, so it's still trying to
> iterate over postlist.all, rather than just postlist now. Sorry, I cut a
> corner and didn't point out all the changes necessary, just pointing you
> in the right direction. You're passing a list now, not a queryset, so
> you'll need to adjust the template if you really want to make these
> changes in the view like this (although, as I indicated, it's a pretty
> uncommon pattern when you start to do things out of experimentation
> mode, so you might want to avoid the hassle altogether).
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to