From 816f1e5acea2ec43b873a63fa89d5c0b90ca166d Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Thu, 12 Aug 2021 03:16:39 +0200 Subject: [PATCH] fix issue with editing and deleting phonebook numbers starting with one or more 0s, django would remove leading 0s because the url pattern was an int, use a regex expecting 4 digits instead --- src/phonebook/urls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/phonebook/urls.py b/src/phonebook/urls.py index cfe8c4a9..005b84f9 100644 --- a/src/phonebook/urls.py +++ b/src/phonebook/urls.py @@ -1,4 +1,4 @@ -from django.urls import include, path +from django.urls import include, path, re_path from .views import ( DectExportView, @@ -25,8 +25,8 @@ urlpatterns = [ DectRegistrationCreateView.as_view(), name="dectregistration_create", ), - path( - "/", + re_path( + r"^(?P\d{4})/", include( [ path(