Django QuerySet Not returning all data

Question:

I am trying to return all the data in queryset which is saved in my model. But when I try to print it only returns the title nothing else.

Bellow are the screenshots attached for refrence.

Please assist

Code:
enter image description here

and here is the data which i have saved in my model

enter image description here

Asked By: Mumin Bhat

||

Answers:

You will only see what you have used in str in models.py for the given instance



def __str__():
    return self.title + ' ' + '|' + ' ' + self.author


In your print message you only see ({'post':{title|author}}) that is returned from __str__

In your print message you will see the content that you have provided in str
but you can access other fields using below code,for example


post = Post.objects.filter(slug = slug)
print(post.read_time,post.hero_image, post.content)


I hope you got it.If not let me know.

Answered By: Nirmal Pandey