Open
Conversation
mcandidier
reviewed
Jul 16, 2018
questions/views.py
Outdated
| overrides default queryset | ||
| """ | ||
| try: | ||
| keyword = self.request.GET['keyword'] |
There was a problem hiding this comment.
use .get('keyword', ' ') this will return the second arg when keyword is empty.
mcandidier
reviewed
Jul 16, 2018
questions/views.py
Outdated
| lists questions | ||
| """ | ||
|
|
||
| try: |
There was a problem hiding this comment.
same here. use .get('keyword', ' ')
mcandidier
reviewed
Jul 16, 2018
| @@ -0,0 +1,5 @@ | |||
| <form action=""> | |||
There was a problem hiding this comment.
don't leave action attr to empty, better to remove if empty
mcandidier
reviewed
Jul 16, 2018
questions/views.py
Outdated
| Q(tags__name__icontains=keyword)).distinct() | ||
|
|
||
| queryset = questions | ||
| return queryset |
There was a problem hiding this comment.
why not return questions right away? Instead of assigning to another variable.
mcandidier
reviewed
Jul 16, 2018
| <div class="form-group col-sm-4 col-center-block"> | ||
| <form class="form-inline" (ngSubmit)="search(searchForm)" #searchForm="ngForm"> | ||
| <input class="form-control" type="text" name="keyword" ngModel> | ||
| <button style="border-radius: 0px 4px 4px 0px" class="btn" type="submit"> |
There was a problem hiding this comment.
don't use inline css styling. move it to external css.
mcandidier
reviewed
Jul 16, 2018
questions/views.py
Outdated
| serializer = self.serializer_class(data=self.request.data) | ||
| if serializer.is_valid(): | ||
| serializer.update(question.id) | ||
| return Response(status=201) |
There was a problem hiding this comment.
status 201 is for newly created object.
mcandidier
reviewed
Jul 16, 2018
| question = Question.objects.get(code=code) | ||
| serializer = QuestionSerializer(question) | ||
| serializer = self.serializer_class(question) | ||
| return Response(serializer.data, status=200) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.