-
Notifications
You must be signed in to change notification settings - Fork 1k
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 #1077
base: master
Are you sure you want to change the base?
Solution #1077
Conversation
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.
Thank you for your hard work on this pull request! 😊 While you've made great progress, there are a few critical issues that need to be addressed before we can approve it:
-
Exception Handling: It's important to handle cases where a movie or movie session with a given ID does not exist. Consider using
get_object_or_404
or handling theDoesNotExist
exception forMovieSession.objects.get(id=session_id)
,Movie.objects.get(id=movie_id)
, andCinemaHall.objects.get(id=cinema_hall_id)
. This will prevent the application from crashing when invalid IDs are provided. -
Model References: Please ensure that the
Actor
andGenre
models exist in thedb
app, as they are referenced in theManyToManyField
for theMovie
model. If these models do not exist, it will cause errors during migration.
Once these issues are resolved, your code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
('actors', models.ManyToManyField(to='db.Actor')), | ||
('genre', models.ManyToManyField(to='db.Genre')), |
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.
Ensure that the Actor
and Genre
models exist in the db
app, as they are referenced in the ManyToManyField
for the Movie
model. If they do not exist, this will cause an error during migration.
|
||
|
||
def get_movie_by_id(movie_id: int) -> Movie: | ||
return Movie.objects.get(id=movie_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.
Consider using get_object_or_404
or handling the DoesNotExist
exception to manage cases where a movie with the specified ID does not exist. This will prevent the application from crashing if an invalid ID is provided.
movie=Movie.objects.get(id=movie_id), | ||
cinema_hall=CinemaHall.objects.get(id=cinema_hall_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.
Consider handling the DoesNotExist
exception for Movie.objects.get(id=movie_id)
and CinemaHall.objects.get(id=cinema_hall_id)
to manage cases where the provided IDs do not exist. This will prevent the application from crashing if invalid IDs are provided.
|
||
|
||
def get_movie_session_by_id(movie_session_id: int) -> MovieSession: | ||
return MovieSession.objects.get(id=movie_session_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.
Consider using get_object_or_404
or handling the DoesNotExist
exception to manage cases where a movie session with the specified ID does not exist. This will prevent the application from crashing if an invalid ID is provided.
movie_id: int = None, | ||
cinema_hall_id: int = None | ||
) -> None: | ||
movie_session = MovieSession.objects.get(id=session_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.
Consider handling the DoesNotExist
exception for MovieSession.objects.get(id=session_id)
to manage cases where the provided session ID does not exist. This will prevent the application from crashing if an invalid ID is provided.
|
||
|
||
def delete_movie_session_by_id(session_id: int) -> None: | ||
MovieSession.objects.get(id=session_id).delete() |
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.
Consider handling the DoesNotExist
exception for MovieSession.objects.get(id=session_id)
to manage cases where the provided session ID does not exist. This will prevent the application from crashing if an invalid ID is provided.
No description provided.