26👍
✅
What you want to achieve is subset of fields dumped to json.
What you’re doing is serializing whole django’s ORM objects. Not good.
Keep it simple:
import json
posts = (Post.objects.filter(owner=authenticated_user)
.values('id', 'title', 'summary'))
json_posts = json.dumps(list(posts))
Source:stackexchange.com