Repository: openwisp/openwisp-utils (language: python)

Issue:
[enhancement] Change url to path
In most of the openwisp modules, "path" has been used and also Django in transitioning to "path". But in this module "url" is being used so I think it should be changed to "path". document may also need to improve in this issue if needed.
[enhancement] Change url to path
In most of the openwisp modules, "path" has been used and also Django in transitioning to "path". But in this module "url" is being used so I think it should be changed to "path". document may also need to improve in this issue if needed.


Discussion / hints:
@nemesisdesign if this issue is relevant then I would like to work on it. 
@niteshsinha17 It's not urgent to do this right now, we should focus our efforts on the issues in the board because we're almost ready to issue new releases of OpenWISP which will benefit the community and that's our goal.
@nemesisdesign I will try to give contributions to those issues for now. 
@nemesisdesign if this issue is relevant then I would like to work on it. 
@niteshsinha17 It's not urgent to do this right now, we should focus our efforts on the issues in the board because we're almost ready to issue new releases of OpenWISP which will benefit the community and that's our goal.
@nemesisdesign I will try to give contributions to those issues for now. 

Fix patch:
diff --git a/openwisp_utils/api/urls.py b/openwisp_utils/api/urls.py
index a89c9131..49b855e1 100644
--- a/openwisp_utils/api/urls.py
+++ b/openwisp_utils/api/urls.py
@@ -1,5 +1,5 @@
 from django.conf import settings
-from django.conf.urls import url
+from django.urls import path, re_path
 from drf_yasg import openapi
 from drf_yasg.views import get_schema_view
 from openwisp_utils import settings as app_settings
@@ -17,18 +17,18 @@
     )
 
     urlpatterns += [
-        url(
+        re_path(
             r'^docs(?P<format>\.json|\.yaml)$',
             schema_view.without_ui(cache_timeout=0),
             name='schema-json',
         ),
-        url(
-            r'^docs/$',
+        path(
+            'docs/',
             schema_view.with_ui('swagger', cache_timeout=0),
             name='schema-swagger-ui',
         ),
-        url(
-            r'^redoc/$',
+        path(
+            'redoc/',
             schema_view.with_ui('redoc', cache_timeout=0),
             name='schema-redoc',
         ),


Test patch:
diff --git a/tests/test_project/api/urls.py b/tests/test_project/api/urls.py
index 969c37b0..bb73395b 100644
--- a/tests/test_project/api/urls.py
+++ b/tests/test_project/api/urls.py
@@ -1,9 +1,9 @@
-from django.conf.urls import url
+from django.urls import re_path
 
 from . import views
 
 urlpatterns = [
-    url(
+    re_path(
         r'^receive_project/(?P<pk>[^/\?]+)/$',
         views.receive_project,
         name='receive_project',
diff --git a/tests/urls.py b/tests/urls.py
index 269445a7..1f8c73cb 100644
--- a/tests/urls.py
+++ b/tests/urls.py
@@ -1,9 +1,8 @@
-from django.conf.urls import url
 from django.contrib import admin
-from django.urls import include
+from django.urls import include, path
 
 urlpatterns = [
-    url(r'^admin/', admin.site.urls),
-    url(r'^api/v1/', include('openwisp_utils.api.urls')),
-    url(r'^api/v1/', include('test_project.api.urls')),
+    path('admin/', admin.site.urls),
+    path('api/v1/', include('openwisp_utils.api.urls')),
+    path('api/v1/', include('test_project.api.urls')),
 ]