mardi 19 mai 2015

Django Post.objects.all() does not show object attributes

Hey I am currently going through the Django girls tutorial http://ift.tt/1HRLb72

I am trying to display all of my Post objects in the python shell using

from blog.models import Post
Post.objects.all()

It should display

[<Post: Title>, <Post: Title2>]

but instead it displays

[<Post: Post object>, <Post: Post object>]

It just says "Post object" instead of the title. What is the reason why? I have been following the tutorial exactly and can't understand why it displays it like that. It's hard to organize all of the posts when it says "Post object" for all of them.

I am using Python version 3.4.1 and Djangon version 1.8.1.




Aucun commentaire:

Enregistrer un commentaire