How to show content only to user that created it?

Question:

I have program like todo list. And I need to filter db to show only content that user created

I have code like this:

name = Gift.objects.filter(author=request.user)

But it show error

Cannot resolve keyword 'author' into field. Choices are: gift_name, id, person_name, user, user_id
Asked By: frod wii

||

Answers:

Try this:
Also it is mentioned in the warning to use which attriubutes as a hint.
since author is not preset you have to use user

name = Gift.objects.filter(user=request.user)
Answered By: Gunesh Shanbhag
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.