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" #731

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

"solution" #731

wants to merge 2 commits into from

Conversation

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

Great job on your submission! 🎉 While there are a few minor issues, such as the DEBUG setting and SECRET_KEY exposure, these are typical for development and can be adjusted for production. The logic in the create method for OrderSerializer and the condition in MovieViewSet can be improved, but they don't critically impact functionality. Keep up the good work and consider these improvements for future projects! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨



class OrderSerializer(serializers.ModelSerializer):
tickets = TicketSerializer(many=True, read_only=True, allow_null=False)

Choose a reason for hiding this comment

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

The tickets field is marked as read_only=True, which means it will not be included in the validated_data during creation. Therefore, attempting to pop it in the create method will raise a KeyError. Consider removing the tickets field from validated_data handling or adjusting the logic to accommodate read-only fields.

@@ -43,6 +55,28 @@ def get_serializer_class(self):

return MovieSerializer

def get_queryset(self):
queryset = super().get_queryset()
if self.action == ("list", "retrieve"):

Choose a reason for hiding this comment

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

The condition if self.action == ('list', 'retrieve'): is incorrect because it checks if self.action is equal to the tuple ('list', 'retrieve'). Instead, use if self.action in ['list', 'retrieve']: to check if the action is either 'list' or 'retrieve'.

SECRET_KEY = (
"django-insecure-6vubhk2$++agnctay_4pxy_8cq)mosmn(*-#2b^v4cgsh-^!i3"
)
SECRET_KEY = "django-insecure-6vubhk2$++agnctay_4pxy_8cq)mosmn(*-#2b^v4cgsh-^!i3"

Choose a reason for hiding this comment

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

The SECRET_KEY is currently hardcoded and exposed in the settings file. For security reasons, especially in production, consider using environment variables to manage sensitive information like the secret key.

SECRET_KEY = (
"django-insecure-6vubhk2$++agnctay_4pxy_8cq)mosmn(*-#2b^v4cgsh-^!i3"
)
SECRET_KEY = "django-insecure-6vubhk2$++agnctay_4pxy_8cq)mosmn(*-#2b^v4cgsh-^!i3"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

Choose a reason for hiding this comment

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

The DEBUG setting is set to True. This is suitable for development but should be set to False in a production environment to avoid exposing sensitive information.

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