-
Notifications
You must be signed in to change notification settings - Fork 697
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 #704
base: master
Are you sure you want to change the base?
Solution #704
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 project! While you've done a great job overall, there are a few critical issues that need to be addressed before we can approve the pull request:
-
Syntax Error in Import Statement: There's a syntax error in the import statement for the custom permission class. Please correct it to
from rest_framework.permissions import BasePermission, SAFE_METHODS
to ensure the code functions properly. -
Namespace and
app_name
Mismatch: Ensure that thecinema.urls
anduser.urls
modules have anapp_name
attribute defined if you're using thenamespace
argument in theinclude
function. This is crucial for the URL routing to work correctly. -
Password Handling in Update Method: While the current implementation removes the
password
fromvalidated_data
, make sure that thepassword
field is handled correctly during updates, especially if it's optional. Consider explicitly handling cases where the password might beNone
.
These issues are important for the functionality and maintainability of your code. Once you address them, your code will be in great shape! Keep up the good work, and I'm looking 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.
@@ -0,0 +1,12 @@ | |||
from rest_framework.permissions import BasePermission, SAFE_METHODS |
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.
There is a syntax error in the import statement. The correct syntax should be from rest_framework.permissions import BasePermission, SAFE_METHODS
. The /
character is not valid here and should be removed.
tickets_available=F("cinema_hall__rows") # noqa | ||
* F("cinema_hall__seats_in_row") # noqa | ||
- Count("tickets") # noqa |
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 # noqa
comments are used to suppress linter warnings. Ensure that these are necessary and that the code is functioning as expected. If the linter warnings are valid, consider refactoring the code to address them instead of suppressing them.
@@ -4,5 +4,6 @@ | |||
urlpatterns = [ | |||
path("admin/", admin.site.urls), | |||
path("api/cinema/", include("cinema.urls", namespace="cinema")), | |||
path("api/user/", include("user.urls", namespace="user")), |
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 include
function is used with a namespace
argument, which requires the included URLconf to define an app_name
attribute. Ensure that the cinema.urls
and user.urls
modules have an app_name
attribute defined. If not, you should remove the namespace
argument or add the app_name
attribute in the respective urls.py
files.
return get_user_model().objects.create_user(**validated_data) | ||
|
||
def update(self, instance, validated_data): | ||
password = validated_data.pop("password", None) |
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 update
method removes the password
from validated_data
before calling super().update()
. This is correct, but ensure that the password
field is always provided when updating a user, as it is required for setting a new password. If the password is optional during updates, consider handling cases where it might be None
more explicitly.
No description provided.