-
Notifications
You must be signed in to change notification settings - Fork 1.2k
S #1341
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?
S #1341
Changes from 3 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 .views import index | ||
|
||
|
|
||
| app_name = 'taxi' | ||
|
|
||
| urlpatterns = [ | ||
| path("", index, name="index") | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,18 @@ | ||
| from django.shortcuts import render | ||
|
|
||
| # Create your views here. | ||
| 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 and ensure appropriate ordering of imports.' Please add a blank line before this line to separate the local application import from the third-party Django import. |
||
|
|
||
|
|
||
| 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 | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,7 @@ | ||
| """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 | ||
| from django.urls import path, include | ||
|
|
||
| urlpatterns = [ | ||
| path("admin/", admin.site.urls), | ||
| path("", include("taxi.urls", namespace="taxi")) | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| {% load static %} | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>{% block title %}Taxi Service{% endblock title %}</title> | ||
|
|
||
| <link rel="stylesheet" href="{% static 'css/styles.css' %}"> | ||
| </head> | ||
| <body> | ||
| {% block sidebar %} | ||
| {% include "includes/sidebar.html" %} | ||
| {% endblock sidebar %} | ||
| {% block content %}{% endblock content %} | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <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,10 @@ | ||
| {% extends "base.html" %} | ||
|
|
||
| {% block content %} | ||
| <ul> | ||
| <li>Number of cars {{ num_cars }}</li> | ||
| <li>Number of drivers {{ num_drivers }}</li> | ||
| <li>Number of manufacturers {{ num_manufacturers }}</li> | ||
| </ul> | ||
|
|
||
| {% endblock content %} | ||
|
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 #1: 'Ensure each file ends with a single blank line.' Please add a single blank line after |
||
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 import statement violates a couple of code style rules from the checklist:
from taxi.views import index, instead of a relative import.