Skip to content

Commit

Permalink
replace url() with re_path() and path() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ekinertac committed Aug 21, 2020
1 parent aed55e6 commit d7d4aa4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
9 changes: 4 additions & 5 deletions reversion/admin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from contextlib import contextmanager
from django.db import models, transaction, connection
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.admin import options
from django.contrib.admin.utils import unquote, quote
from django.contrib.contenttypes.admin import GenericInlineModelAdmin
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import PermissionDenied, ImproperlyConfigured
from django.shortcuts import get_object_or_404, render, redirect
from django.urls import reverse
from django.urls import reverse, re_path
from django.utils.text import capfirst
from django.utils.timezone import template_localtime
from django.utils.translation import ugettext as _
Expand Down Expand Up @@ -137,9 +136,9 @@ def get_urls(self):
opts = self.model._meta
info = opts.app_label, opts.model_name,
reversion_urls = [
url(r"^recover/$", admin_site.admin_view(self.recoverlist_view), name='%s_%s_recoverlist' % info),
url(r"^recover/(\d+)/$", admin_site.admin_view(self.recover_view), name='%s_%s_recover' % info),
url(r"^([^/]+)/history/(\d+)/$", admin_site.admin_view(self.revision_view), name='%s_%s_revision' % info),
re_path(r"^recover/$", admin_site.admin_view(self.recoverlist_view), name='%s_%s_recoverlist' % info),
re_path(r"^recover/(\d+)/$", admin_site.admin_view(self.recover_view), name='%s_%s_recover' % info),
re_path(r"^([^/]+)/history/(\d+)/$", admin_site.admin_view(self.revision_view), name='%s_%s_revision' % info),
]
return reversion_urls + urls

Expand Down
10 changes: 5 additions & 5 deletions tests/test_app/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.conf.urls import url
from django.urls import path
from test_app import views


urlpatterns = [
url("^save-obj/", views.save_obj_view),
url("^save-obj-error/", views.save_obj_error_view),
url("^create-revision/", views.create_revision_view),
url("^revision-mixin/", views.RevisionMixinView.as_view()),
path("save-obj/", views.save_obj_view),
path("save-obj-error/", views.save_obj_error_view),
path("create-revision/", views.create_revision_view),
path("revision-mixin/", views.RevisionMixinView.as_view()),
]
8 changes: 4 additions & 4 deletions tests/test_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.conf.urls import url, include
from django.conf.urls import include
from django.urls import path
from django.contrib import admin

admin.autodiscover()

urlpatterns = [

url(r"^admin/", admin.site.urls),

url(r"^test-app/", include("test_app.urls")),
path("admin/", admin.site.urls),
path("test-app/", include("test_app.urls")),

]

0 comments on commit d7d4aa4

Please sign in to comment.