-
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 #690
base: master
Are you sure you want to change the base?
Solution #690
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.
GJ!
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:
-
Password Handling: Ensure that the
create_user
method is used correctly to hash passwords. Double-check your implementation to confirm that the password is being hashed properly. -
Namespace in URLs: Make sure that the
namespace
parameter is defined in bothcinema.urls
anduser.urls
configurations. This is important for the correct functioning of URL namespacing. -
Queryset Consistency: In the
OrderViewSet
, useself.queryset
instead of directly queryingOrder.objects
in theget_queryset
method. This will help maintain consistency and flexibility in your code.
Please address these issues to ensure the functionality and core requirements of the task are fully met. Once these changes are made, we can proceed with approval. Keep up the great work! 🚀
✨ 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.
cinema/views.py
Outdated
def get_queryset(self): | ||
return Order.objects.filter(user=self.request.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.
Consider using self.queryset
instead of directly querying Order.objects
in the get_queryset
method. This approach maintains consistency and allows for easier modifications if the queryset needs to be changed in the future.
@@ -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.
Ensure that the namespace
parameter is defined in the cinema.urls
and user.urls
configurations. The include
function with a namespace
requires the included URLconf to define an app_name
attribute.
extra_kwargs = {"password": {"write_only": True, "min_length": 5}} | ||
|
||
def create(self, validated_data): | ||
return get_user_model().objects.create_user(**validated_data) |
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 create_user
method is used correctly to hash the password. The current implementation seems correct as it uses create_user
, which should handle password hashing. Double-check the create_user
method in your user model to confirm this behavior.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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 progress! 🎉 Your implementation is mostly correct, but there are a few critical issues to address for future improvements:
-
Password Handling: Ensure that the
create_user
method in theUserSerializer
is used correctly to hash passwords. Double-check your implementation to confirm that the password is being hashed properly. -
Namespace in URLs: Make sure the
namespace
parameter is defined in bothcinema.urls
anduser.urls
configurations. This is crucial for the correct functioning of URL namespacing. -
Queryset Consistency: In the
OrderViewSet
, useself.queryset
instead of directly queryingOrder.objects
in theget_queryset
method. This will help maintain consistency and flexibility in your code.
You've done well to address some of the previous issues, and this approval is to help you move forward with your learning. Please review the comments and make the necessary improvements to enhance your code quality. Keep up the good work and continue learning from your experiences! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
def get_queryset(self): | ||
return Order.objects.filter(user=self.request.user) | ||
return self.queryset.filter(user=self.request.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.
In the OrderViewSet
, use self.queryset
instead of directly querying Order.objects
in the get_queryset
method. This will help maintain consistency and flexibility in your code.
@@ -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.
Ensure that the namespace
parameter is defined in both cinema.urls
and user.urls
configurations. This is important for the correct functioning of URL namespacing.
extra_kwargs = {"password": {"write_only": True, "min_length": 5}} | ||
|
||
def create(self, validated_data): | ||
return get_user_model().objects.create_user(**validated_data) |
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 create_user
method is used correctly to hash passwords. Double-check your implementation to confirm that the password is being hashed properly.
class CreateUserView(generics.CreateAPIView): | ||
serializer_class = UserSerializer |
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 create_user
method in the UserSerializer
is used correctly to hash passwords. Double-check your implementation to confirm that the password is being hashed properly.
No description provided.