-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.urls import path | ||
|
||
from taxi.views import index | ||
|
||
urlpatterns = [ | ||
path("", index, name="index") | ||
] | ||
|
||
app_name = "taxi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
from django.core.handlers.wsgi import WSGIRequest | ||
from django.http import HttpResponse | ||
from django.shortcuts import render | ||
|
||
# Create your views here. | ||
from taxi.models import Driver, Manufacturer, Car | ||
|
||
|
||
def index(request: WSGIRequest) -> HttpResponse: | ||
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=context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
{% block title %} | ||
<title>Taxi Service</title> | ||
{% endblock %} | ||
{% load static %} | ||
<link rel="stylesheet" href="{% static 'css/styles.css' %}"> | ||
</head> | ||
<body> | ||
{% block sidebar %} | ||
{% include "includes/sidebar.html" %} | ||
{% endblock %} | ||
{% block content %} | ||
{% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<li> | ||
<ul>Number of cars: {{num_cars}}</ul> | ||
<ul>Number of drivers: {{num_drivers}}</ul> | ||
<ul>Number of manufacturers: {{num_manufacturers}}</ul> | ||
</li> | ||
{% endblock %} |