Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions static/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
margin: 10px;
}
9 changes: 9 additions & 0 deletions taxi/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.urls import path
from taxi.views import index
Comment on lines +1 to +3

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: Standard library imports. Related third party imports. Local application/library specific imports." Add a blank line between from django.urls import path and from taxi.views import index so imports are separated into groups (follow the good example in the checklist).



urlpatterns = [
path("", index, name="index"),
]

app_name = "taxi"
11 changes: 10 additions & 1 deletion taxi/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
from django.shortcuts import render
from .models import Driver, Manufacturer, Car

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" and also violates CHECKLIST ITEM #2 (separate import groups). You're using a relative import from .models import Driver, Manufacturer, Car. Change it to an absolute import: from taxi.models import Driver, Manufacturer, Car and add a blank line between the third-party import (from django.shortcuts import render) and the local app import to follow the required import grouping/order.


# Create your views here.

def index(request):
context = {
"num_drivers": Driver.objects.count(),
"num_manufacturers": Manufacturer.objects.count(),
"num_cars": Car.objects.count(),
}

return render(request, "taxi/index.html", context)
11 changes: 8 additions & 3 deletions taxi_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -56,7 +56,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [os.path.join(BASE_DIR, "templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down Expand Up @@ -122,7 +122,12 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = "static/"
STATIC_URL = "/static/"

STATICFILES_DIRS = [
BASE_DIR / "static",
]


# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
Expand Down
4 changes: 3 additions & 1 deletion taxi_service/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
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


urlpatterns = [
path("admin/", admin.site.urls),
path("", include(("taxi.urls", "taxi"), namespace="taxi")),
]
30 changes: 30 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% load static %} {# !!!important!!! #}

Choose a reason for hiding this comment

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

This line contains a template comment {# !!!important!!! #}. Remove template comments before final commit — the checklist states: "Don't forget to delete comments when you are ready to commit and push your code." Leaving template comments is flagged by the task requirements.

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
{% block title %}
<title>Taxi Service</title>
{% endblock %}
<link rel="stylesheet" href="{% static "css/styles.css" %}">
</head>

<body>
<div>
{% block sidebar %}
{% include "includes/sidebar.html" %}
{% endblock %}
</div>>

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 closing tag </div>> which will produce invalid HTML/template rendering. Change </div>> to </div> so the template renders correctly.

Choose a reason for hiding this comment

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

This line contains invalid HTML: the closing tag is </div>> (extra >). Change it to </div> to produce well-formed markup. This is a high-severity issue because malformed HTML can break page rendering.


<div>
{% block content %}
{% endblock %}
</div>

</body>
</html>

Choose a reason for hiding this comment

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

Confirm the file ends with a single blank line as required by the checklist: "Ensure each file ends with a single blank line." I cannot detect trailing whitespace here, so please make sure you add one if it is missing.

12 changes: 12 additions & 0 deletions templates/includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<a href="#">
Home page
</a>
<a href="#">
Manufacturers
</a>
<a href="#">
Cars
</a>
<a href="#">
Drivers

Choose a reason for hiding this comment

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

This violates the implementation requirement from the description: "Write realization of sidebar include that must have a list of empty links: - Home page - Manufacturers - Cars - Drivers". The file currently contains plain anchor elements but not a list structure. Please wrap the links in a list (for example <ul><li><a href="#">Home page</a></li>...) so the sidebar is rendered as a list.

</a>

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: "Ensure each file ends with a single blank line." Add one trailing newline at the end of this HTML file so it ends with exactly one blank line.

8 changes: 8 additions & 0 deletions templates/taxi/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}

{% block content %}
{{ num_car }}

Choose a reason for hiding this comment

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

This line uses {{ num_car }} but the view passes the context key num_cars. This violates the requirement to display the number of cars — replace with {{ num_cars }}.

{{ num_drivers }}
{{ num_manufacturer }}

Choose a reason for hiding this comment

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

This line uses {{ num_manufacturer }} but the view passes the context key num_manufacturers. Replace with {{ num_manufacturers }} so the template receives the correct value.

Choose a reason for hiding this comment

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

The task description requires: "Override block content and place (as a list) information about: Number of cars, Number of drivers, Number of manufacturers". Currently the values are printed inline. Wrap the items in a list, for example:

<ul>
  <li>Cars: {{ num_cars }}</li>
  <li>Drivers: {{ num_drivers }}</li>
  <li>Manufacturers: {{ num_manufacturers }}</li>
</ul>

{% endblock %}

Choose a reason for hiding this comment

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

Ensure the file ends with a single blank line as required by CHECKLIST ITEM #1: "Ensure each file ends with a single blank line."