-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#162948923 custom search #29
Conversation
You have 4 commits. Kindly squash them to one |
authors/apps/articles/views.py
Outdated
search_fields = ('title', 'body', | ||
'author__username', 'tags__tag') | ||
|
||
def get_queryset(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a docstring
b0eb96b
to
68dbe24
Compare
68dbe24
to
5754b26
Compare
5754b26
to
32b7567
Compare
32b7567
to
df73ab4
Compare
df73ab4
to
b4cd9f5
Compare
b4cd9f5
to
4ed14ad
Compare
4ed14ad
to
0995486
Compare
0995486
to
097f071
Compare
097f071
to
0d7d29f
Compare
7dc17fb
to
02bd8f8
Compare
9084fd8
to
c7f8326
Compare
format="json" | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual(len(response.data), 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danuluma good job on this test but you can make it even better by checking the response and if there was an article that matched the author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
format="json" | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual(len(response.data), 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same here, test for the actual response data returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done this
format="json" | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual(len(response.data), 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the same for here as well
e54f101
to
b07072b
Compare
- Users can be able to search for articles by title, author or tags [Delivers #162948923]
b07072b
to
94dbfe8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work with solving the CORSB issue we are getting on the frontend. The Pull request is good to go
What does this PR do?
Add a search functionality with custom filters
Description of Task(s) to be completed?
How should this be manually tested?
git fetch origin ft-custom-search-162948923:ft-custom-search-162948923
git checkout ft-custom-search-162948923
pip3 install -r requirements.txt
python3 manage.py runserver
http://127.0.0.1:8000/api/v1/users/
with a body of:http://127.0.0.1:8000/api/v1/users/login/
with your registered email and passwordhttp://127.0.0.1:8000/api/v1/articles
Please go ahead and create several other articles in a similar fashion, with different titles and body content
Now we can filter articles authored by
dann
by sending aGET
request tohttp://127.0.0.1:8000/api/v1/articles?author=dann
We can also filter with the title or body like
http://127.0.0.1:8000/api/v1/articles?title=rick
,http://127.0.0.1:8000/api/v1/articles?body=slowly+fades
. Multiple words should be concatenated with a+
or%20
We can also provide multiple params to filter against
http://127.0.0.1:8000/api/v1/articles?title=rick&author=dann
Any background context you want to provide?
What are the relevant pivotal tracker stories?
#162948923