Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia15031988 committed Jan 4, 2025
1 parent b2bfd97 commit d335426
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions taxi/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def clean_license_number(self):
license_number = self.cleaned_data.get("license_number")

if len(license_number) != 8:
raise forms.ValidationError("license_number must have 8 characters")
raise forms.ValidationError(
"license_number must have 8 characters")

if not re.match(r"^[A-Z]{3}\d{5}$", license_number):
raise forms.ValidationError(
Expand All @@ -35,7 +36,8 @@ def clean_license_number(self):
license_number = self.cleaned_data.get("license_number")

if len(license_number) != 8:
raise forms.ValidationError("license_number must have 8 characters")
raise forms.ValidationError(
"license_number must have 8 characters")

if not re.match(r"^[A-Z]{3}\d{5}$", license_number):
raise forms.ValidationError(
Expand Down
4 changes: 3 additions & 1 deletion taxi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,7 @@ class DriverUpdateView(LoginRequiredMixin, generic.UpdateView):
success_url = reverse_lazy("taxi:driver-list")

def form_valid(self, form):
messages.success(self.request, "Driver information updated successfully.")
messages.success(
self.request, "Driver information "
"updated successfully.")
return super().form_valid(form)

0 comments on commit d335426

Please sign in to comment.