From 58433b9972a50fd31f0a84d4fe6f07575d237adc Mon Sep 17 00:00:00 2001 From: Bohdan Borsuk Date: Sat, 14 Feb 2026 15:51:05 +0000 Subject: [PATCH 1/4] S --- taxi/views.py | 17 ++++++++++++++++- taxi_service/settings.py | 5 ++++- taxi_service/urls.py | 3 ++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/taxi/views.py b/taxi/views.py index 91ea44a21..d1e404c98 100644 --- a/taxi/views.py +++ b/taxi/views.py @@ -1,3 +1,18 @@ from django.shortcuts import render -# Create your views here. +from taxi.models import Driver, Manufacturer, Car + + +def index(request): + num_drivers = Driver.objects.all().count() + num_manufacturers = Manufacturer.objects.all().count() + num_cars = Car.objects.all().count() + + return render( + request, + "taxi/index.html", + { + "num_drivers": num_drivers, + "num_manufacturers": num_manufacturers, + "num_cars": num_cars + }) diff --git a/taxi_service/settings.py b/taxi_service/settings.py index 00329f55f..b2ab65ac0 100644 --- a/taxi_service/settings.py +++ b/taxi_service/settings.py @@ -56,7 +56,7 @@ TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [BASE_DIR / "templates",], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -123,6 +123,9 @@ # https://docs.djangoproject.com/en/4.0/howto/static-files/ 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 diff --git a/taxi_service/urls.py b/taxi_service/urls.py index 57c939e7f..00b0bd895 100644 --- a/taxi_service/urls.py +++ b/taxi_service/urls.py @@ -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")) ] From 5914f131bc1d159f41052467149d5dad7ab52213 Mon Sep 17 00:00:00 2001 From: Bohdan Borsuk Date: Sat, 14 Feb 2026 16:14:33 +0000 Subject: [PATCH 2/4] S2 --- static/css/styles.css | 0 taxi/urls.py | 8 ++++++++ taxi_service/urls.py | 15 --------------- templates/base.html | 16 ++++++++++++++++ templates/includes/sidebar.html | 19 +++++++++++++++++++ templates/taxi/index.html | 10 ++++++++++ 6 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 static/css/styles.css create mode 100644 taxi/urls.py create mode 100644 templates/base.html create mode 100644 templates/includes/sidebar.html create mode 100644 templates/taxi/index.html diff --git a/static/css/styles.css b/static/css/styles.css new file mode 100644 index 000000000..e69de29bb diff --git a/taxi/urls.py b/taxi/urls.py new file mode 100644 index 000000000..f99452c91 --- /dev/null +++ b/taxi/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from .views import index + +app_name = 'taxi' + +urlpatterns = [ + path("", index, name="index") +] \ No newline at end of file diff --git a/taxi_service/urls.py b/taxi_service/urls.py index 00b0bd895..e0890d8d2 100644 --- a/taxi_service/urls.py +++ b/taxi_service/urls.py @@ -1,18 +1,3 @@ -"""taxi_service URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/4.0/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin from django.urls import path, include diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 000000000..2e7bf9ca0 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,16 @@ +{% load static %} + + + + + {% block title %}Taxi Service{% endblock title %} + + + + + {% block sidebar %} + {% include "includes/sidebar.html" %} + {% endblock sidebar %} + {% block content %}{% endblock content %} + + \ No newline at end of file diff --git a/templates/includes/sidebar.html b/templates/includes/sidebar.html new file mode 100644 index 000000000..6188fe126 --- /dev/null +++ b/templates/includes/sidebar.html @@ -0,0 +1,19 @@ + + + + + + diff --git a/templates/taxi/index.html b/templates/taxi/index.html new file mode 100644 index 000000000..d3761b827 --- /dev/null +++ b/templates/taxi/index.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% block content %} + + +{% endblock content %} From a914d30a73cad78639770bdb51a9f3047ced0e84 Mon Sep 17 00:00:00 2001 From: Bohdan Borsuk Date: Sat, 14 Feb 2026 16:26:53 +0000 Subject: [PATCH 3/4] S3 --- taxi/urls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/taxi/urls.py b/taxi/urls.py index f99452c91..d6827e55c 100644 --- a/taxi/urls.py +++ b/taxi/urls.py @@ -1,8 +1,9 @@ from django.urls import path + from .views import index app_name = 'taxi' urlpatterns = [ path("", index, name="index") -] \ No newline at end of file +] From 721bcfe0067b0e1a8f9f9c7c2ad488c48adbebc3 Mon Sep 17 00:00:00 2001 From: Bohdan Borsuk Date: Sat, 14 Feb 2026 16:39:14 +0000 Subject: [PATCH 4/4] S4 --- taxi/urls.py | 2 +- templates/includes/sidebar.html | 5 ----- templates/taxi/index.html | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/taxi/urls.py b/taxi/urls.py index d6827e55c..13125ded2 100644 --- a/taxi/urls.py +++ b/taxi/urls.py @@ -1,6 +1,6 @@ from django.urls import path -from .views import index +from taxi.views import index app_name = 'taxi' diff --git a/templates/includes/sidebar.html b/templates/includes/sidebar.html index 6188fe126..e8fca781c 100644 --- a/templates/includes/sidebar.html +++ b/templates/includes/sidebar.html @@ -12,8 +12,3 @@ Drivers - - - - - diff --git a/templates/taxi/index.html b/templates/taxi/index.html index d3761b827..320edbc01 100644 --- a/templates/taxi/index.html +++ b/templates/taxi/index.html @@ -6,5 +6,4 @@
  • Number of drivers {{ num_drivers }}
  • Number of manufacturers {{ num_manufacturers }}
  • - {% endblock content %}