Home > other >  How to show content only to user that created it?
How to show content only to user that created it?

Time:12-26

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

CodePudding user response:

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)
  • Related