-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Solution #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Solution #1344
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,3 +9,4 @@ venv/ | |
| *.pyc | ||
| app/db.sqlite3 | ||
| db.sqlite3 | ||
| .venv/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from django.urls import path | ||
| from taxi.views import index | ||
|
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This violates the Code Style requirement [CHECKLIST ITEM #2]: "Add a blank line between different groups of imports and ensure appropriate ordering of imports:
Currently the third-party import (
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Imports should be grouped in the following order: 1.Standard library imports. 2.Related third party imports. 3.Local application/library specific imports." Here you have a third-party import ( |
||
|
|
||
| urlpatterns = [ | ||
| path("", index, name="index"), | ||
| ] | ||
|
|
||
| app_name = "taxi" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,16 @@ | ||
| from django.http import HttpRequest, HttpResponse | ||
| from django.shortcuts import render | ||
|
|
||
| # Create your views here. | ||
| from taxi.models import Driver, Manufacturer, Car | ||
|
|
||
|
|
||
| def index(request: HttpRequest) -> 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) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!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> | ||
| <div class="container-fluid"> | ||
| <div class="row"> | ||
| <div class="col-sm-3"> | ||
| {% block sidebar %} | ||
| {% include "includes/sidebar.html" %} | ||
| {% endblock %} | ||
| </div> | ||
| <div class="col-sm-9"> | ||
| {% block content %} | ||
| {% endblock %} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <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> | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| {% extends "base.html" %} | ||
| {% block title %} | ||
| <title>Home page</title> | ||
| {% endblock %} | ||
| <ul> | ||
| <li>Number of cars: {{ num_cars }}</li> | ||
| <li>Number of drivers: {{ num_drivers }}</li> | ||
| <li>Number of manufacturers: {{ num_manufacturers }}</li> | ||
| </ul> | ||
OlenaPyslar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| {% endblock %} | ||
OlenaPyslar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.