Skip to content

Commit 4c18977

Browse files
committed
Minor clarification for filter objects
1 parent 777d136 commit 4c18977

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

django_orm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ You can know have a little fun and add more posts to see how it works. Add 2-3 m
7979

8080
### Filter objects
8181

82-
Big part of QuerySets is an ability to filter them. Let's say, we want to find all posts that are authored by User ola. We will use it instead of `all` in `Post.objects.all()`. In parentheses we will state what condition(s) needs to be met by a blog post to end up in our queryset. In our situation it is `author` that is equal to `user`. The way to write it in Django is: `author=user`. Now our piece of code looks like that:
82+
Big part of QuerySets is an ability to filter them. Let's say, we want to find all posts that are authored by User ola. We will use `filter` instead of `all` in `Post.objects.all()`. In parentheses we will state what condition(s) needs to be met by a blog post to end up in our queryset. In our situation it is `author` that is equal to `user`. The way to write it in Django is: `author=user`. Now our piece of code looks like that:
8383

8484
>>> Post.objects.filter(author = user)
8585
[<Post: Sample title>, <Post: Post number 2>, <Post: My 3rd post!>, <Post: 4th title of post>]

0 commit comments

Comments
 (0)