-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement home page with counters and sidebar for Taxi Service #1343
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
base: master
Are you sure you want to change the base?
Changes from 12 commits
7ea77a4
1f61585
3e9a447
c3d2733
33990da
5b0257f
47f262b
ccae5d5
29bd99f
a2ce587
4a2c6b1
836b7c8
b62ec44
e85d3ed
cb63c31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| .sidebar { | ||
| width: 200px; | ||
| float: left; | ||
| background-color: #f0f0f0; | ||
| padding: 10px; | ||
| height: 100vh; | ||
| } | ||
|
|
||
| .content { | ||
| margin-left: 220px; | ||
| padding: 10px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from django.urls import path | ||
| from . import views | ||
|
||
|
|
||
| app_name = 'taxi' | ||
|
|
||
| urlpatterns = [ | ||
| path('', views.index, name='index'), # головна сторінка | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,15 @@ | ||
| from django.shortcuts import render | ||
| from taxi.models import Driver, Car, Manufacturer | ||
|
||
|
|
||
| # Create your views here. | ||
| def index(request): | ||
| num_drivers = Driver.objects.count() | ||
| num_cars = Car.objects.count() | ||
| num_manufacturers = Manufacturer.objects.count() | ||
|
|
||
| context = { | ||
| 'num_drivers': num_drivers, | ||
| 'num_cars': num_cars, | ||
| 'num_manufacturers': num_manufacturers, | ||
| } | ||
|
|
||
| return render(request, 'taxi/index.html', context) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,9 @@ | |
| 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
| """ | ||
| from django.contrib import admin | ||
| from django.urls import path | ||
| from django.urls import path, include # додаємо include | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this comment. The checklist requires deleting comments before committing code to keep it clean and readable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the inline comment |
||
|
|
||
| urlpatterns = [ | ||
| path("admin/", admin.site.urls), | ||
| path("", include(("taxi.urls", "taxi"), namespace="taxi")), # домашня сторінка через taxi.urls | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment should also be removed to adhere to the clean code requirements specified in the checklist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the inline comment |
||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| {% load static %} | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>{% block title %}Taxi Service{% endblock %}</title> | ||
| <link rel="stylesheet" href="{% static 'css/styles.css' %}"> | ||
| </head> | ||
| <body> | ||
| <div class="sidebar"> | ||
| {% block sidebar %} | ||
| {% include 'includes/sidebar.html' %} | ||
| {% endblock %} | ||
| </div> | ||
|
|
||
| <div class="content"> | ||
| {% block content %}{% endblock %} | ||
| </div> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <ul> | ||
| <li><a href="#">Home page</a></li> | ||
| <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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The requirements state that each HTML file must end with a single blank line. Please add an empty line after the closing |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| {% extends 'base.html' %} | ||
|
|
||
| {% block content %} | ||
| <h1>Welcome to Taxi Service</h1> | ||
| <ul> | ||
| <li>Number of cars: {{ num_cars }}</li> | ||
| <li>Number of drivers: {{ num_drivers }}</li> | ||
| <li>Number of manufacturers: {{ num_manufacturers }}</li> | ||
| </ul> | ||
| {% endblock %} |
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.
This violates checklist item #3: 'Use absolute imports instead of relative imports'. Please change this to an absolute import, like
from taxi import views.Additionally, checklist item #2 requires a blank line between different import groups (in this case, third-party and local imports).