| 1 |
Description: Fix compatibility with Django 4 by replacing django.conf.urls with re_path |
| 2 |
As of Django 4, the django.conf.urls.url() function was removed. The |
| 3 |
recommended replacement is to use re_path for url paths that use regex. This |
| 4 |
patch replaces instances of the url function accordingly. |
| 5 |
Author: Lena Voytek <[email protected]> |
| 6 |
Last-Update: 2023-08-08 |
| 7 |
--- |
| 8 |
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 9 |
--- a/menu_generator/tests/urls.py |
| 10 |
+++ b/menu_generator/tests/urls.py |
| 11 |
@@ -1,11 +1,11 @@ |
| 12 |
|
| 13 |
+from django.urls import re_path |
| 14 |
|
| 15 |
def testview(request): |
| 16 |
return 'foo' |
| 17 |
|
| 18 |
urlpatterns = [ |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
+ re_path(r'named-url', lambda: 'foo', name='named_url'), |
| 24 |
+ re_path(r'named-with-params/(?P<pk>\d+)/', lambda: 'foo', name='named_with_params'), |
| 25 |
+ re_path(r'known-view', testview, name='known_view'), |
| 26 |
+ re_path(r'', lambda: 'foo'), |
| 27 |
] |