Skip to content

Commit b22a173

Browse files
atodorovclaudep
authored andcommitted
Try using django.urls.re_path() instead of django.conf.urls.url()
but keep compatibility with older Django versions. RemovedInDjango40Warning: django.conf.urls.url() is deprecated in favor of django.urls.re_path().
1 parent dcecd75 commit b22a173

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

django_comments/urls.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from django.conf.urls import url
1+
try:
2+
from django.urls import re_path as url
3+
except ImportError:
4+
from django.conf.urls import url
25
from django.contrib.contenttypes.views import shortcut
36

47
from .views.comments import post_comment, comment_done

tests/testapp/urls.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from django.conf.urls import url
1+
try:
2+
from django.urls import re_path as url
3+
except ImportError:
4+
from django.conf.urls import url
25
from django.contrib.contenttypes.views import shortcut
36

47
from django_comments.feeds import LatestCommentFeed

tests/testapp/urls_admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from django.conf.urls import url
1+
try:
2+
from django.urls import re_path as url
3+
except ImportError:
4+
from django.conf.urls import url
25
from django.contrib import admin
36
from django_comments.admin import CommentsAdmin
47
from django_comments.models import Comment

tests/testapp/urls_default.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from django.conf.urls import include, url
1+
try:
2+
from django.urls import re_path as url
3+
except ImportError:
4+
from django.conf.urls import url
5+
from django.conf.urls import include
26
from django.contrib.auth.views import LoginView, LogoutView
37

48

0 commit comments

Comments
 (0)