Implement home page with counters and sidebar for Taxi Service#1343
Implement home page with counters and sidebar for Taxi Service#1343nazarkravets2007 wants to merge 15 commits intomate-academy:masterfrom
Conversation
Add taxi app URLs and set home page route
Add index view for home page with driver, car, and manufacturer counts
Add basic styles for sidebar and content layout
git add templates/base.html templates/includes/sidebar.html git commit -m "Create base.html and sidebar include for template structure"
git add templates/base.html templates/includes/sidebar.html git commit -m "Create base.html and sidebar include for template structure"
git add templates/taxi/index.html git commit -m "Create index.html template showing number of cars, drivers, manufacturers"
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Hello! Your project is off to a great start, and the home page functionality is implemented correctly. However, a few changes are needed before this can be approved.
The most important issue is in templates/base.html. The task required you to wrap the sidebar include in {% block sidebar %} and {% endblock %} tags. This is a key requirement because it allows other templates to override or extend the sidebar in the future.
Additionally, there are a few code style issues that violate the project checklist:
- Please use absolute imports instead of relative ones (e.g.,
from taxi.models import ...). [CHECKLIST ITEM #3] - Remember to separate different import groups with a blank line. [CHECKLIST ITEM #2]
- Please remove the leftover comments from your code. [CHECKLIST ITEM #1 for Clean Code]
Please address these points. I'm looking forward to seeing your updated submission!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
taxi/views.py
Outdated
| @@ -1,3 +1,15 @@ | |||
| from django.shortcuts import render | |||
| from .models import Driver, Car, Manufacturer | |||
There was a problem hiding this comment.
This violates two code style requirements from the checklist:
- Checklist Item Solution #3: Use absolute imports instead of relative imports. It should be
from taxi.models import .... - Checklist Item Black, readme fixed #2: Imports should be grouped and separated by a blank line. There should be an empty line between the Django import on line 1 and this local application import.
| """ | ||
| from django.contrib import admin | ||
| from django.urls import path | ||
| from django.urls import path, include # додаємо include |
There was a problem hiding this comment.
This violates checklist item #1 for Clean Code: "Don't forget to delete comments when you are ready to commit and push your code." Please remove this comment.
|
|
||
| urlpatterns = [ | ||
| path("admin/", admin.site.urls), | ||
| path("", include(("taxi.urls", "taxi"), namespace="taxi")), # домашня сторінка через taxi.urls |
There was a problem hiding this comment.
This violates checklist item #1 for Clean Code: "Don't forget to delete comments when you are ready to commit and push your code." Please remove this comment.
templates/base.html
Outdated
| <div class="sidebar"> | ||
| {% include 'includes/sidebar.html' %} | ||
| </div> |
There was a problem hiding this comment.
The task description requires you to create a sidebar block inside the <body>. While you have included the sidebar template, it needs to be enclosed within {% block sidebar %} and {% endblock %} tags to fully satisfy the requirement.
taxi/urls.py
Outdated
| @@ -0,0 +1,8 @@ | |||
| from django.urls import path | |||
| from . import views | |||
There was a problem hiding this comment.
| app_name = 'taxi' | ||
|
|
||
| urlpatterns = [ | ||
| path('', views.index, name='index'), # головна сторінка |
There was a problem hiding this comment.
This violates the 'Clean Code' section of the checklist: 'Don't forget to delete comments when you are ready to commit and push your code.' Please remove this comment.
nazarkravets2007
left a comment
There was a problem hiding this comment.
git add templates/base.html taxi/views.py
git commit -m "Wrap sidebar in block, use absolute imports, fix code style"
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on implementing the core functionality for the home page and addressing the previous feedback on the base.html file. The application logic is working correctly. However, this submission requires a few changes because several code style requirements from the project checklist have been missed, which is causing the automated flake8 check to fail.
Here are the specific issues to address:
- Imports: In
taxi/urls.py, please use an absolute import (from taxi import views) instead of a relative one. Also, in bothtaxi/urls.pyandtaxi/views.py, add a blank line between the Django imports and the local application imports to follow the project's style guide [CHECKLIST ITEM #2 & #3]. - Code Comments: Please remove the leftover comments from
taxi/urls.pyandtaxi_service/urls.pyto keep the code clean [CHECKLIST ITEM #1 for Clean Code]. - File Formatting: The
templates/includes/sidebar.htmlfile is missing a final blank line. Please add one to meet the formatting requirements [CHECKLIST ITEM #1].
Once these style issues are resolved, the automated checks should pass. You're very close to completing this!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
taxi/urls.py
Outdated
| @@ -0,0 +1,8 @@ | |||
| from django.urls import path | |||
| from . import views | |||
There was a problem hiding this comment.
This import violates two code style requirements from the checklist.
- Checklist item Solution #3: 'Use absolute imports instead of relative imports'. This should be
from taxi import views. - Checklist item Black, readme fixed #2: 'Add a blank line between different groups of imports'. There should be a blank line between the
djangoimport and your localtaxiimport.
| app_name = 'taxi' | ||
|
|
||
| urlpatterns = [ | ||
| path('', views.index, name='index'), # головна сторінка |
There was a problem hiding this comment.
Please remove this comment before submission. This violates checklist item #1 for Clean Code: 'Don't forget to delete comments when you are ready to commit and push your code.'
| """ | ||
| from django.contrib import admin | ||
| from django.urls import path | ||
| from django.urls import path, include # додаємо include |
There was a problem hiding this comment.
Please remove this comment. The checklist requires deleting comments before committing code to keep it clean and readable.
|
|
||
| urlpatterns = [ | ||
| path("admin/", admin.site.urls), | ||
| path("", include(("taxi.urls", "taxi"), namespace="taxi")), # домашня сторінка через taxi.urls |
There was a problem hiding this comment.
This comment should also be removed to adhere to the clean code requirements specified in the checklist.
taxi/views.py
Outdated
| @@ -1,3 +1,15 @@ | |||
| from django.shortcuts import render | |||
| from taxi.models import Driver, Car, Manufacturer | |||
There was a problem hiding this comment.
This violates checklist item #2: 'Add a blank line between different groups of imports and ensure appropriate ordering of imports'. Please add a blank line between the third-party django import and the local taxi application import to improve code readability.
| <li><a href="#">Manufacturers</a></li> | ||
| <li><a href="#">Cars</a></li> | ||
| <li><a href="#">Drivers</a></li> | ||
| </ul> |
There was a problem hiding this comment.
The requirements state that each HTML file must end with a single blank line. Please add an empty line after the closing </ul> tag to meet this requirement.
nazarkravets2007
left a comment
There was a problem hiding this comment.
git add taxi/urls.py taxi/views.py templates/includes/sidebar.html taxi_service/urls.py
git commit -m "Fix code style: absolute imports, blank lines, remove comments, final newline in sidebar"
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution as an educational override so you can keep progressing while you fix a few remaining issues.
You did a solid job on the index view and templates: the view correctly counts num_drivers, num_cars, and num_manufacturers, and base.html / index.html are structured as required with the sidebar include and proper blocks. The main critical issue is in taxi/urls.py, where the line from taxi import views views is a syntax error; replace it with a valid import such as from taxi import views and then reference views.index in your urlpatterns (this is required so the server and tests can run). In taxi_service/urls.py, remove the inline comments on the import and include() lines to comply with the checklist about deleting leftover comments before committing [CHECKLIST ITEM]. Similarly, remove the # головна сторінка comment in taxi/urls.py for the same reason.
Once you correct the import and clean up these comments, your URLs and overall structure will align very well with the project requirements. You are very close to a clean, production-ready solution—nice work getting the core functionality and templates right; focus now on these small syntax and cleanliness details to strengthen your Django practice.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| """ | ||
| from django.contrib import admin | ||
| from django.urls import path | ||
| from django.urls import path, include # додаємо include |
There was a problem hiding this comment.
Remove the inline comment # додаємо include. The project checklist requires removing leftover comments before commit: "Don't forget to delete comments when you are ready to commit and push your code."
|
|
||
| urlpatterns = [ | ||
| path("admin/", admin.site.urls), | ||
| path("", include(("taxi.urls", "taxi"), namespace="taxi")), # домашня сторінка через taxi.urls |
There was a problem hiding this comment.
Remove the inline comment # домашня сторінка через taxi.urls. This also violates the checklist item: "Don't forget to delete comments when you are ready to commit and push your code."
| @@ -0,0 +1,9 @@ | |||
| from django.urls import path | |||
|
|
|||
| from taxi import views views | |||
There was a problem hiding this comment.
This line contains a syntax error: from taxi import views views is invalid and will raise a SyntaxError. Replace it with a correct absolute import, for example:
from taxi import views
or, if you prefer to import only the view function:
from taxi.views import index
Either option uses an absolute import as required and will fix the syntax error.
| app_name = 'taxi' | ||
|
|
||
| urlpatterns = [ | ||
| path('', views.index, name='index'), # головна сторінка |
There was a problem hiding this comment.
This line has a leftover inline comment. The checklist requires removing such comments before committing: "Don't forget to delete comments when you are ready to commit and push your code." Please remove the # головна сторінка comment from this path definition.
Що зроблено:
indexдля підрахунку кількості водіїв, машин та виробниківПеревірка:
Скріншоти додаються у коментар до PR (не в коміт)