Make sure you don't push db files (files with .sqlite
, .db3
, etc. extension).
Don't override template_name
, context_object_name
and so on if they are the same as default ones.
- Make sure you've added a blank line at the end to all your files including
.css
,.html
and.gitignore
. - Use
()
instead ofbackslash — \
in if-statements.
Good example:
if (first_condition and second_condition
and third_condition):
# some actions
Also possible one:
if (first_condition and
second_condition):
# some actions
Bad example:
if first_condition and second_condition \
and third_condition:
# some actions
- Group imports using
()
if needed.
Good example:
from django.contrib.auth.mixins import (
LoginRequiredMixin,
UserPassesTestMixin,
PermissionRequiredMixin,
)
Bad example:
from django.contrib.auth.mixins import LoginRequiredMixin, \
UserPassesTestMixin, PermissionRequiredMixin
- Use correct path names.
Good example:
path(
"manufacurers/create/",
ManufacturerCreateView.as_view(),
name="manufacturer-create"
),
Bad example:
path(
"manufacturers/manufacturer_create/",
ManufacturerCreateView.as_view(),
name="manufacturer-create"
)
Another bad example:
path("create/", ManufacturerCreateView.as_view(), name="manufacturer-create")
-
Add
Cancel
button apart fromDelete
one. TheCancel
button will lead to the previous page the user was on. -
Make sure you use 2 whitespaces indentations in your
.html
files. -
Use
-
to split words in URL identification parametername
, not the_
.
Good example:
urlpatterns = [
path("buses/", BusListView.as_view(), name="bus-list"),
]
Bad example:
urlpatterns = [
path("buses/", BusListView.as_view(), name="bus_list"),
]
Add comments, prints, and functions to check your solution when you write your code. Don't forget to delete them when you are ready to commit and push your code.