Make sure you don't push db files (files with .sqlite
, .db3
, etc. extension).
- Use
UserCreationForm
while creating user.
Good example:
class DriverCreationForm(UserCreationForm):
pass
Bad example:
class DriverCreationForm(forms.ModelForm):
pass
- Validate
license_number
while creating and updating users. - Don't forget to add
/
at the end of the URLs.
Good example:
path(
"manufacurers/create/",
ManufacturerCreateView.as_view(),
name="manufacturer-create"
),
Bad example:
path(
"manufacurers/create",
ManufacturerCreateView.as_view(),
name="manufacturer-create"
),
- Use
get_user_model()
instead ofDriver
.
- Make sure you've added a blank line at the end to all your files including
.css
,.html
and.gitignore
. - Make sure you use 2 whitespaces indentations in your
.html
files. - Add
Cancel
button apart fromDelete
one. TheCancel
button will lead to the previous page the user was on. - 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
Another bad example:
from django.contrib.auth.mixins import (
LoginRequiredMixin,
UserPassesTestMixin, PermissionRequiredMixin,
)
- 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.