-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Develop #1363
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?
Develop #1363
Changes from all 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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from django.urls import path | ||
|
|
||
| from . import views | ||
|
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 #3: 'Use absolute imports instead of relative imports'. Please change this relative import to an absolute import, such as |
||
|
|
||
| app_name = "taxi" | ||
|
|
||
| urlpatterns = [ | ||
| path("", views.index, name="index"), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,16 @@ | ||
| from django.shortcuts import render | ||
| from taxi.models import Driver, Manufacturer, Car | ||
|
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...'. According to the code style guidelines, you should separate third-party imports (like |
||
|
|
||
| # 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) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| {% load static %} | ||
|
|
||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>{% block title %}Taxi Service{% endblock %}</title> | ||
|
|
||
| <link rel="stylesheet" href="{% static 'css/styles.css' %}"> | ||
| </head> | ||
|
|
||
| <body> | ||
|
|
||
| <div class="sidebar"> | ||
| {% block sidebar %} | ||
| {% include "includes/sidebar.html" %} | ||
| {% endblock %} | ||
| </div> | ||
|
|
||
| <div class="content"> | ||
| {% block content %} | ||
| {% endblock %} | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
| 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> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| {% extends "base.html" %} | ||
|
|
||
| {% block content %} | ||
|
|
||
| <h1>Taxi Service</h1> | ||
|
|
||
| <ul> | ||
| <li>Number of cars: {{ num_cars }}</li> | ||
| <li>Number of drivers: {{ num_drivers }}</li> | ||
| <li>Number of manufacturers: {{ num_manufacturers }}</li> | ||
| </ul> | ||
|
|
||
| {% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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...'. A blank line should be added before this line to separate third-party imports (like Django) from local application imports.