Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Empty file added static/css/styles.css
Empty file.
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 .views import index

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"

You are using a relative import here (from .views import index). Change it to an absolute import, for example:

from taxi.views import index

Using absolute imports is required by the checklist and prevents potential import-resolution issues.


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

app_name = "taxi"
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 django.http import HttpResponse, HttpRequest

Choose a reason for hiding this comment

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

This violates the checklist requirement to group and separate imports: "Add a blank line between different groups of imports and ensure appropriate ordering of imports." Ensure imports are ordered (standard library, third-party, local) and put a blank line between the third-party (django) imports and local taxi imports.


# Create your views here.
from .models import Car, Driver, 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 #3: "Use absolute imports instead of relative imports". Replace the relative import with an absolute import, e.g. from taxi.models import Car, Driver, Manufacturer. Absolute imports are required by the checklist and avoid potential import issues.



def index(requests: HttpRequest) -> HttpResponse:
num_drivers = Driver.objects.count()
num_manufacturers = Manufacturer.objects.count()
num_cars = Car.objects.count()

return render(requests, "taxi/index.html",
{"num_drivers": num_drivers,
"num_manufacturers": num_manufacturers,
"num_cars": num_cars})

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." Make sure the file ends with exactly one newline character (a single blank line at EOF).

5 changes: 4 additions & 1 deletion taxi_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": ["templates"],

Choose a reason for hiding this comment

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

The task requires: “Edit Django settings so that the template engine knows where to look for template source files located in templates.” Using a plain string "templates" can work depending on the working directory, but it's safer and clearer to point to the absolute path relative to BASE_DIR. Consider changing this line to: "DIRS": [BASE_DIR / "templates"], so the template engine always finds the templates directory next to the project root.

"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down Expand Up @@ -123,6 +123,9 @@
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = "static/"
STATICFILES_DIRS = [
BASE_DIR / "static",

Choose a reason for hiding this comment

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

STATICFILES_DIRS is set correctly to include BASE_DIR / 'static', which is required. One small recommendation: use the conventional leading slash in STATIC_URL (i.e. STATIC_URL = '/static/') — this is more standard and avoids potential inconsistencies when building URLs for static files.

]

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". Make sure this file ends with exactly one newline (single blank line) at EOF before committing.


# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
Expand Down
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

urlpatterns = [
path("admin/", admin.site.urls),
path("", include("taxi.urls", namespace="taxi"), name="")

Choose a reason for hiding this comment

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

The call to path that includes taxi.urls sets an empty name argument: path("", include("taxi.urls", namespace="taxi"), name=""). The name parameter is unnecessary when the second argument is an include() and an empty string provides no value — consider removing the name argument or give it a meaningful non-empty name if intended.

]
25 changes: 25 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{% load static %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
<title>{% block title %}{%endblock%}</title>

Choose a reason for hiding this comment

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

This violates the requirement: "Inside <head>: Create block title with Taxi Service title inside" — the title block is empty. Add Taxi Service as the default content of the title block so pages that don't override it still show the required title.

<meta>
</head>
<body>

<div id="sidebar">
{% block sidebar %}
{% include 'includes/sidebar.html' %}
{% endblock %}
</div>

<div id="content">
{% 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.

This violates CHECKLIST ITEM #1: "Ensure each file ends with a single blank line." Make sure this HTML file ends with exactly one newline character (a single blank line at EOF).

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="{% url 'taxi:index' %}">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.

This violates CHECKLIST ITEM #1: "Ensure each file ends with a single blank line." Add exactly one newline at the end of this file so it ends with a single blank line (EOF newline).

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

{% block title %}Home page{% endblock %}

{% block content %}
<ul>
<li>{{num_cars}}</li>
<li>{{num_drivers}}</li>
<li>{{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.

This violates CHECKLIST ITEM #1: "Ensure each file ends with a single blank line." Make sure this template file ends with exactly one newline (a single blank line at EOF).

Loading