Skip to content

Latest commit

 

History

History
104 lines (76 loc) · 2.12 KB

File metadata and controls

104 lines (76 loc) · 2.12 KB

Сheck Your Code Against the Following Points

Don't Push db files

Make sure you don't push db files (files with .sqlite, .db3, etc. extension).

Don't forget to attach all screenshots of created/modified pages.

Code Efficiency

  1. Use UserCreationForm while creating user.

Good example:

class DriverCreationForm(UserCreationForm):
    pass

Bad example:

class DriverCreationForm(forms.ModelForm):
    pass
  1. Validate license_number while creating and updating users.
  2. 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"
),
  1. Use get_user_model() instead of Driver.

Code Style

  1. Make sure you've added a blank line at the end to all your files including .css, .html and .gitignore.
  2. Make sure you use 2 whitespaces indentations in your .html files.
  3. Add Cancel button apart from Delete one. The Cancel button will lead to the previous page the user was on.
  4. 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,
)
  1. Use - to split words in URL identification parameter name, not the _.

Good example:

urlpatterns = [
    path("buses/", BusListView.as_view(), name="bus-list"),
]

Bad example:

urlpatterns = [
    path("buses/", BusListView.as_view(), name="bus_list"),
]

Clean Code

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.