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..77f188dea --- /dev/null +++ b/taxi/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from . import views + +app_name = "taxi" + +urlpatterns = [ + path("", views.index, name="index"), +] diff --git a/taxi/views.py b/taxi/views.py index 91ea44a21..83a491d1c 100644 --- a/taxi/views.py +++ b/taxi/views.py @@ -1,3 +1,16 @@ from django.shortcuts import render +from taxi.models import Driver, Manufacturer, Car -# Create your views here. + +def index(request): + num_drivers = Driver.objects.count() + num_manufacturers = Manufacturer.objects.count() + num_cars = Car.objects.count() + + context = { + "num_drivers": num_drivers, + "num_manufacturers": num_manufacturers, + "num_cars": num_cars, + } + + return render(request, "taxi/index.html", context) diff --git a/taxi_service/settings.py b/taxi_service/settings.py index 00329f55f..f0f5220b5 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": [ @@ -124,6 +124,10 @@ 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..f025b6903 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", "taxi"), namespace="taxi")), ] diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 000000000..ba07c7624 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,25 @@ +{% load static %} + + + + + {% block title %}Taxi Service{% endblock %} + + + + + + + + +
+ {% block content %} + {% endblock %} +
+ + + diff --git a/templates/includes/sidebar.html b/templates/includes/sidebar.html new file mode 100644 index 000000000..b0fe9d3a2 --- /dev/null +++ b/templates/includes/sidebar.html @@ -0,0 +1,6 @@ + diff --git a/templates/taxi/index.html b/templates/taxi/index.html new file mode 100644 index 000000000..d9592e02c --- /dev/null +++ b/templates/taxi/index.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block content %} + +

Taxi Service

+ + + +{% endblock %}