diff --git a/siteblocks/tests/testapp/urls.py b/siteblocks/tests/testapp/urls.py index 3ce1d1f..67a514d 100644 --- a/siteblocks/tests/testapp/urls.py +++ b/siteblocks/tests/testapp/urls.py @@ -1,25 +1,17 @@ -from django import VERSION -from django.conf.urls import url, include - try: - from django.conf.urls import patterns + from django.urls import re_path, include except ImportError: - patterns = None + from django.conf.urls import url as re_path, include urlpatterns = [ - url(r'^my_named_url/$', lambda r: None, name='named_url'), + re_path(r'^my_named_url/$', lambda r: None, name='named_url'), ] def get_mock_patterns(): - url_ = url(r'^my_another_named_url/$', lambda r: None, name='url') - - if patterns: - return patterns('', url_) - - return [url_] + return [re_path(r'^my_another_named_url/$', lambda r: None, name='url')] class MockUrlconfModule: @@ -27,12 +19,4 @@ class MockUrlconfModule: urlpatterns = get_mock_patterns() -if VERSION < (2, 0): - urlpatterns.append(url(r'^namespace/', include((MockUrlconfModule, None, 'namespaced')))) -else: - urlpatterns.append(url(r'^namespace/', include((MockUrlconfModule, 'app'), namespace='namespaced'))) - - -if VERSION < (1, 10): - urlpatterns.insert(0, '') - urlpatterns = patterns(*urlpatterns) +urlpatterns.append(re_path(r'^namespace/', include((MockUrlconfModule, 'app'), namespace='namespaced')))