-
Notifications
You must be signed in to change notification settings - Fork 722
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
Explore API view sets #411
base: master
Are you sure you want to change the base?
Conversation
cinema/serializers.py
Outdated
|
||
class GenreSerializer(serializers.Serializer): | ||
id = serializers.IntegerField(read_only=True) | ||
name = serializers.CharField(max_length=255, required=True) |
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.
required is True by default, fix everywhere please
cinema/views.py
Outdated
movie = get_object_or_404(Movie, pk=pk) | ||
class GenreDetail(APIView): | ||
def get_object(self, pk): | ||
try: |
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.
optional, you can use get_object_or_404
cinema/views.py
Outdated
def get(self, request, pk): | ||
genre = self.get_object(pk) | ||
serializer = GenreSerializer(genre) | ||
return Response(serializer.data) |
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.
all status codes are set explicitly in other places, so them to responses
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.
well done ^_^
No description provided.