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

Solution #704

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

Solution #704

wants to merge 2 commits into from

Conversation

MatvijSafonov
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. 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.

  2. Namespace and app_name Mismatch: Ensure that the cinema.urls and user.urls modules have an app_name attribute defined if you're using the namespace argument in the include function. This is crucial for the URL routing to work correctly.

  3. Password Handling in Update Method: While the current implementation removes the password from validated_data, make sure that the password field is handled correctly during updates, especially if it's optional. Consider explicitly handling cases where the password might be None.

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

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.

Comment on lines +112 to +114
tickets_available=F("cinema_hall__rows") # noqa
* F("cinema_hall__seats_in_row") # noqa
- Count("tickets") # noqa

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")),

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)

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.

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.

3 participants