-
Notifications
You must be signed in to change notification settings - Fork 693
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-py-token-authentication #695
base: master
Are you sure you want to change the base?
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.
except for one flaw, you've made a good solution
authentication_classes = (TokenAuthentication,) | ||
permission_classes = (IsAdminOrIfAuthenticatedReadOnly,) |
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.
you can write it in settings and not dublicate it across all views
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! 😊 There are a few critical issues that need to be addressed before we can approve the pull request. Specifically, there's a syntax error in the import statement of your custom permission class, which could impact the functionality of your code. Additionally, there are duplicate files and a missing blank line at the end of some files, which could lead to confusion and maintenance challenges in the future. Please resolve these issues, and feel free to reach out if you need any help! 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.
@@ -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
without the slash /
.
from rest_framework.pagination import PageNumberPagination | ||
from rest_framework.permissions import IsAuthenticated |
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 IsAuthenticated
permission is imported but not used in this file. Consider removing it if it's not needed to keep the code clean.
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 addressing the initial issues with the syntax error and duplicate files! 🎉 While there are still a few areas that need attention, such as the duplicate user/urls.py
file and the missing blank line at the end of files, these are minor and can be easily fixed.
Key Points to Address:
- Duplicate Files: Remove the duplicate
user/urls.py
file to avoid confusion. - Code Style: Ensure all files end with a blank line as per coding standards.
- Import Syntax: Correct the syntax error in the import statement by using a comma to separate modules.
- Permission Classes: Verify that the
OrderViewSet
uses the correct permission class (IsAuthenticated
vs.IsAdminOrIfAuthenticatedReadOnly
) to match your intended access control logic. - Settings Configuration: Remember to set
DEBUG
toFalse
and secure theSECRET_KEY
for production environments. Also, consider settingUSE_TZ
toTrue
to handle time zones properly. - Namespace Definition: Ensure that the
cinema
anduser
apps define their namespaces to prevent potential errors.
These improvements will enhance the functionality and maintainability of your code. Keep up the good work, and make sure to address these points in future iterations to continue growing as a developer! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -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. You should use a comma to separate the imported modules: from rest_framework.permissions import BasePermission, SAFE_METHODS
.
queryset = Order.objects.prefetch_related( | ||
"tickets__movie_session__movie", "tickets__movie_session__cinema_hall" | ||
) | ||
serializer_class = OrderSerializer | ||
pagination_class = OrderPagination | ||
authentication_classes = (TokenAuthentication,) | ||
permission_classes = (IsAuthenticated,) |
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 OrderViewSet
uses IsAuthenticated
for permission_classes
, which is different from the other viewsets that use IsAdminOrIfAuthenticatedReadOnly
. Ensure this is intentional and aligns with the intended permission logic for orders.
@@ -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 cinema.urls
and user.urls
modules define the namespaces cinema
and user
, respectively. If not, this will cause a NamespaceNotFound
error.
No description provided.