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

Add Taxi service user form and validation solution #832

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

Conversation

charmheroku
Copy link

image
image
image
image
image
image
image

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! There are a few critical issues that need to be addressed before we can approve the pull request. These include the missing trailing slash in the URL pattern for 'drivers/create', which can lead to inconsistencies, and the lack of LoginRequiredMixin in DriverDeleteView, which is important for security. Additionally, please correct the typo in the inline style for the 'Create' link, update the URL pattern for 'driver-update' to use 'pk', and improve the clarity of the error message in DriverCreationForm. Once these changes are made, your code will be in great shape! 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.

taxi/forms.py Outdated
Comment on lines 29 to 30
"Ensure that license_number start with 3 UPPER"
"symbols and last 5 characters are digits"

Choose a reason for hiding this comment

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

The error message for the license_number validation in DriverCreationForm is missing a space between 'UPPER' and 'symbols'. Consider updating it to: 'Ensure that license_number starts with 3 UPPER symbols and the last 5 characters are digits'.

taxi/urls.py Outdated
Comment on lines 55 to 56
path(
"drivers/create", DriverCreateView.as_view(), name="driver-create"

Choose a reason for hiding this comment

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

The URL pattern for 'drivers/create' is missing a trailing slash. Consider adding a trailing slash to maintain consistency with other URL patterns: 'drivers/create/'.

taxi/views.py Outdated
success_url = reverse_lazy("taxi:driver-list")


class DriverDeleteView(generic.DeleteView):

Choose a reason for hiding this comment

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

Consider adding LoginRequiredMixin to DriverDeleteView to ensure that only authenticated users can delete a driver. This is consistent with other views that require login.

Delete
</a>

<a href="{% url 'taxi:driver-update' pk=driver.id %}" class="btn btn-secondary">

Choose a reason for hiding this comment

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

Ensure that the URL pattern for 'driver-update' uses 'pk' instead of 'id' to match the URL configuration: {% url 'taxi:driver-update' pk=driver.pk %}.

@@ -1,8 +1,7 @@
{% extends "base.html" %}

{% block content %}
<h1>Driver List
</h1>
<h1>Driver List <a style="float:rigt" href="{% url 'taxi:driver-create' %}">+</a></h1>

Choose a reason for hiding this comment

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

There is a typo in the inline style for the 'Create' link. It should be 'float:right' instead of 'float:rigt'.

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 addressing the previous review comments and making the necessary improvements to your code! 🎉

Here's a summary of the review:

  • Trailing Slash in URL Patterns: You've correctly added a trailing slash to the 'drivers/create' URL pattern, ensuring consistency.

  • LoginRequiredMixin in DriverDeleteView: Including LoginRequiredMixin in DriverDeleteView is a crucial step to ensure only authenticated users can access this view.

  • Typo in Inline Style: The typo in the inline style for the 'Create' link has been corrected. For future improvements, consider using CSS classes instead of inline styles for better maintainability.

  • URL Pattern for 'driver-update': The use of 'pk' instead of 'id' in the 'driver-update' URL pattern is now correct.

  • Error Message in DriverCreationForm: The error message has been improved for clarity. Remember to ensure that error messages are descriptive to guide users effectively.

Your code is in good shape and ready to proceed. While there are minor issues, such as the inline style usage and error message clarity, these do not hinder the functionality of your application. Keep these points in mind for future projects to enhance your code quality. Keep up the great work and continue learning from these experiences! 🚀

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

Comment on lines +29 to +30
"Ensure that license_number start with 3 UPPER"
" symbols and last 5 characters are digits"

Choose a reason for hiding this comment

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

The error message here is unclear. Consider rephrasing it to: 'Ensure that the license number starts with 3 uppercase letters followed by 5 digits.' This will make it clearer for users to understand the requirement.

Comment on lines +55 to +56
"Ensure that license_number start with 3 UPPER symbols"
" and last 5 characters are digits"

Choose a reason for hiding this comment

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

The error message here is unclear. Consider rephrasing it to: 'Ensure that the license number starts with 3 uppercase letters followed by 5 digits.' This will make it clearer for users to understand the requirement.

@@ -1,8 +1,7 @@
{% extends "base.html" %}

{% block content %}
<h1>Driver List
</h1>
<h1>Driver List <a style="float:right" href="{% url 'taxi:driver-create' %}">+</a></h1>

Choose a reason for hiding this comment

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

There is a typo in the inline style for the 'Create' link. Consider using a CSS class instead of inline styles for better maintainability and consistency.

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.

2 participants