-
Notifications
You must be signed in to change notification settings - Fork 729
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
Solution #331
base: master
Are you sure you want to change the base?
Solution #331
Conversation
migrations.CreateModel( | ||
name='CinemaHall', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
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.
change ' to ", you can use Black
cinema/views.py
Outdated
serializer = MovieSerializer(movie, data=request.data) | ||
def put(self, request, pk): | ||
genre = self.get_object(pk) | ||
serializer = GenreSerializer(genre, data=request.data) | ||
if serializer.is_valid(): |
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.
serializer.is_valid(raise_exception=True) use it instead of if serializer.is_valid():
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 it
cinema/views.py
Outdated
MovieSerializer, | ||
GenreSerializer, | ||
ActorSerializer, | ||
CinemaHallSerializer) |
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.
CinemaHallSerializer) | |
CinemaHallSerializer | |
) |
cinema/urls.py
Outdated
from cinema.views import (MovieViewSet, | ||
GenreList, | ||
GenreDetail, | ||
ActorList, | ||
ActorDetail, | ||
CinemaHallViewSet | ||
) |
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.
bad formmating here (
cinema/urls.py
Outdated
from cinema.views import (MovieViewSet, | ||
GenreList, | ||
GenreDetail, | ||
ActorList, | ||
ActorDetail, | ||
CinemaHallViewSet | ||
) |
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.
fix everywhere
you can use black
from cinema.views import (MovieViewSet, | |
GenreList, | |
GenreDetail, | |
ActorList, | |
ActorDetail, | |
CinemaHallViewSet | |
) | |
from cinema.views import ( | |
MovieViewSet, | |
GenreList, | |
GenreDetail, | |
ActorList, | |
ActorDetail, | |
CinemaHallViewSet | |
) |
cinema/views.py
Outdated
class ActorDetail(mixins.RetrieveModelMixin, mixins.UpdateModelMixin, | ||
mixins.DestroyModelMixin, | ||
generics.GenericAPIView): |
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.
bad formmating here (
cinema/views.py
Outdated
serializer = MovieSerializer(movie, data=request.data) | ||
def put(self, request, pk): | ||
genre = self.get_object(pk) | ||
serializer = GenreSerializer(genre, data=request.data) | ||
if serializer.is_valid(): |
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 it
if serializer.is_valid(): | ||
serializer.save() |
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.
replace with serializer.is_valid(raise_exception=True)
here as well
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 it
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.
Тоді падає тест test_post_genres
if serializer.is_valid(): | ||
serializer.save() |
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 it
cinema/urls.py
Outdated
|
||
urlpatterns = [ | ||
path("movies/", movie_list, name="movie-list"), | ||
path("movies/<int:pk>/", movie_detail, name="movie-detail"), | ||
path("", include(router.urls)), |
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.
No need to include if basepath is not provided. Instead use:
urlpatterns = [list of urls] + router.urls
cinema/urls.py
Outdated
path("actors/", ActorList.as_view(), name="actor-list"), | ||
path("actors/<int:pk>/", ActorDetail.as_view(), name="actor-detail"), | ||
|
||
path("", include(router.urls)), |
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.
No need to include if basepath is not provided. Instead use:
urlpatterns = [list of urls] + router.urls
No description provided.