Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions static/css/styles.css
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;
}
8 changes: 8 additions & 0 deletions taxi/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path
from . import views

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

Choose a reason for hiding this comment

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

This import violates two code style requirements from the checklist.

  1. Checklist item Solution #3: 'Use absolute imports instead of relative imports'. This should be from taxi import views.
  2. Checklist item Black, readme fixed #2: 'Add a blank line between different groups of imports'. There should be a blank line between the django import and your local taxi import.


app_name = 'taxi'

urlpatterns = [
path('', views.index, name='index'), # головна сторінка

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

The 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.'

Choose a reason for hiding this comment

The 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 # головна сторінка comment from this path definition.

]
14 changes: 13 additions & 1 deletion taxi/views.py
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

Choose a reason for hiding this comment

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

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.


# 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)
3 changes: 2 additions & 1 deletion taxi_service/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

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

]
20 changes: 20 additions & 0 deletions templates/base.html
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>
6 changes: 6 additions & 0 deletions templates/includes/sidebar.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>

Choose a reason for hiding this comment

The 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 </ul> tag to meet this requirement.

10 changes: 10 additions & 0 deletions templates/taxi/index.html
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 %}
Loading