-
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
Develop #1068
base: master
Are you sure you want to change the base?
Develop #1068
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.
Great job!
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! 😊 There are a few critical issues that need to be addressed before we can approve it:
-
Type Annotations for IDs: The functions
get_movie_session_by_id
anddelete_movie_session_by_id
are expected to take a single integer ID, but currently, they are annotated to accept a list. Please update the type annotations toint
to reflect the correct input type. -
Return Type for
get_movie_by_id
: The functionget_movie_by_id
should return a singleMovie
instance, not aQuerySet
. Please adjust the return type annotation toMovie
. -
Misleading
related_name
Attributes: Therelated_name
for themovie
andcinema_hall
ForeignKeys in theMovieSession
model are misleading. They suggest a reverse relation that doesn't accurately represent the relationship. Consider changing them to something like 'movie_sessions' to better reflect the relationship.
Once these issues are addressed, your code will be in great shape! Keep up the great work, and I look forward to seeing the improvements. 🚀
✨ 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.
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.
Great job on your submission! 🎉 You've made significant progress, and your code is mostly well-structured and functional. However, there are a few critical issues that need attention:
-
Misleading
related_name
Attributes:- The
related_name
for theactors
andgenres
fields in theMovie
model is set to 'movies'. Consider changing them to 'actor_movies' and 'genre_movies' for better clarity. - The
related_name
for themovie
andcinema_hall
ForeignKeys in theMovieSession
model is misleading. Changing them to 'movie_sessions' would better reflect the relationship.
- The
-
Return Type Annotations:
- Ensure the
get_movie_by_id
function returns aMovie
instance, not aQuerySet
. - Similarly, the
get_movie_session_by_id
function should return aMovieSession
instance.
- Ensure the
-
Return Statement in
delete_movie_session_by_id
:- Avoid returning the result of the
delete()
method, as its return value is not needed.
- Avoid returning the result of the
These adjustments will enhance the clarity and functionality of your code. Remember, addressing these issues will not only improve your current project but also help you in future endeavors. Keep up the great work, and continue learning from these experiences! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('show_time', models.DateTimeField()), | ||
('cinema_hall', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cinema_halls', to='db.cinemahall')), |
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.
The related_name
for the cinema_hall
ForeignKey is misleading. It suggests a reverse relation that doesn't accurately represent the relationship. Consider changing it to something like 'movie_sessions' to better reflect the relationship.
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('show_time', models.DateTimeField()), | ||
('cinema_hall', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cinema_halls', to='db.cinemahall')), | ||
('movie', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='movies', to='db.movie')), |
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.
The related_name
for the movie
ForeignKey is misleading. It suggests a reverse relation that doesn't accurately represent the relationship. Consider changing it to something like 'movie_sessions' to better reflect the relationship.
migrations.AlterField( | ||
model_name='movie', | ||
name='actors', | ||
field=models.ManyToManyField(related_name='movies', to='db.actor'), |
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.
The related_name
for the actors
ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'actor_movies', to better reflect the relationship.
migrations.AlterField( | ||
model_name='movie', | ||
name='genres', | ||
field=models.ManyToManyField(related_name='movies', 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.
The related_name
for the genres
ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'genre_movies', to better reflect the relationship.
class Movie(models.Model): | ||
title = models.CharField(max_length=255) | ||
description = models.TextField() | ||
actors = models.ManyToManyField(Actor, related_name="movies") |
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.
The related_name
for the actors
ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'actor_movies', to better reflect the relationship.
title = models.CharField(max_length=255) | ||
description = models.TextField() | ||
actors = models.ManyToManyField(Actor, related_name="movies") | ||
genres = models.ManyToManyField(Genre, related_name="movies") |
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.
The related_name
for the genres
ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'genre_movies', to better reflect the relationship.
return queryset | ||
|
||
|
||
def get_movie_by_id(movie_id: int) -> Movie: |
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.
The return type annotation for get_movie_by_id
should be Movie
, as the function returns a single Movie
instance, not a QuerySet
.
return MovieSession.objects.all() | ||
|
||
|
||
def get_movie_session_by_id(movie_session_id: int) -> MovieSession: |
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.
The return type annotation for get_movie_session_by_id
should be MovieSession
, as the function returns a single MovieSession
instance, not a QuerySet
.
|
||
|
||
def delete_movie_session_by_id(session_id: int) -> None: | ||
return 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.
The delete_movie_session_by_id
function should not return the result of the delete()
method. Simply call delete()
without returning its result, as the return value is not needed.
No description provided.