Skip to content

Commit

Permalink
Corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
CheshireKate committed Dec 2, 2024
1 parent ca0a33f commit b6619ef
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion taxi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_absolute_url(self):
def clean_license_number(self):
if len(self.license_number) != 8:
raise forms.ValidationError(
"The license should must of 8 characters"
"The license must be 8 characters long"
)
if (not self.license_number[:3].isupper()
or not self.license_number[:3].isalpha()):
Expand Down
4 changes: 2 additions & 2 deletions taxi/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
path(
"drivers/<int:pk>/", DriverDetailView.as_view(), name="driver-detail"
),
path("drivers/create", DriverCreateView.as_view(), name="driver-create"),
path("drivers/delete", DriverDeleteView.as_view(), name="driver-delete"),
path("drivers/create/", DriverCreateView.as_view(), name="driver-create"),
path("drivers/<int:pk>/delete/", DriverDeleteView.as_view(), name="driver-delete"),
path("drivers/<int:pk>/update/", DriverUpdateView.as_view(),
name="driver-update"),
path("drivers/<int:pk>/assign_to_car/", assign_to_car,
Expand Down
5 changes: 2 additions & 3 deletions taxi/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse_lazy
from django.views import generic
from django.contrib.auth.mixins import LoginRequiredMixin

from templates.taxi.forms import DriverCreationForm, CarCreateForm
from .forms import DriverCreationForm, CarCreateForm
from .models import Driver, Car, Manufacturer


Expand Down Expand Up @@ -75,7 +75,6 @@ def get_context_data(self, **kwargs):
class CarCreateView(LoginRequiredMixin, generic.CreateView):
model = Car
form_class = CarCreateForm
fields = "__all__"
success_url = reverse_lazy("taxi:car-list")


Expand Down
2 changes: 0 additions & 2 deletions taxi_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,3 @@
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

CRISPY_TEMPLATE_PACK="bootstrap4"
4 changes: 2 additions & 2 deletions templates/taxi/car_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ <h1>
Update
</a>
{% if is_driver %}
<a href="{% url "taxi:remove_from_car" car.id %}">Delete me from this car
<a href="{% url "taxi:remove_from_car" pk=car.id %}">Delete me from this car
</a>
{% endif %}
{% if not is_driver %}
<a href="{% url "taxi:assign_to_car" car.id %}">Assign me to this car
<a href="{% url "taxi:assign_to_car" pk=car.id %}">Assign me to this car
</a>
{% endif %}
</h1>
Expand Down
2 changes: 1 addition & 1 deletion templates/taxi/driver_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>
<p><strong>License number:</strong> {{ driver.license_number }}</p>
<p><strong>Is staff:</strong> {{ driver.is_staff }}</p>
<p><a href="{% url "taxi:driver-update" pk=driver.id %}">Update</a></p>
<p><a href={% url "taxi:driver-delete" %}>Delete</a></p>
<p><a href={% url "taxi:driver-delete" pk=driver.id %}>Delete</a></p>

<div class="ml-3">
<h4>Cars</h4>
Expand Down
2 changes: 1 addition & 1 deletion templates/taxi/driver_list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% block content %}
<h1>Driver List <a href="forms.py">+</a>
<h1>Driver List <a href="../../taxi/forms.py">+</a>
</h1>

{% if driver_list %}
Expand Down

0 comments on commit b6619ef

Please sign in to comment.