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 #690

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

Solution #690

wants to merge 2 commits into from

Conversation

Le0n-K
Copy link

@Le0n-K Le0n-K commented Dec 12, 2024

No description provided.

Copy link

@94nj111 94nj111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ!

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

  2. Namespace in URLs: Make sure that the namespace parameter is defined in both cinema.urls and user.urls configurations. This is important for the correct functioning of URL namespacing.

  3. Queryset Consistency: 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.

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
Comment on lines 171 to 172
def get_queryset(self):
return Order.objects.filter(user=self.request.user)

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

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)

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.

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.

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.

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.

Great job on your progress! 🎉 Your implementation is mostly correct, but there are a few critical issues to address for future improvements:

  1. Password Handling: 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.

  2. Namespace in URLs: Make sure the namespace parameter is defined in both cinema.urls and user.urls configurations. This is crucial for the correct functioning of URL namespacing.

  3. Queryset Consistency: 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.

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! ✨

Comment on lines 171 to +172
def get_queryset(self):
return Order.objects.filter(user=self.request.user)
return self.queryset.filter(user=self.request.user)

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

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)

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.

Comment on lines +10 to +11
class CreateUserView(generics.CreateAPIView):
serializer_class = UserSerializer

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.

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