Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Sel-Fisher
Copy link

No description provided.


class GenreSerializer(serializers.Serializer):
id = serializers.IntegerField(read_only=True)
name = serializers.CharField(max_length=255, required=True)
Copy link
Contributor

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:
Copy link
Contributor

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)
Copy link
Contributor

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

Copy link

@fsocie7y fsocie7y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants