Skip to content

Commit

Permalink
Fixed Django 4.0 compatibility using django-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Nov 18, 2021
1 parent 346fa6b commit 8066c4c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions example/example/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django.conf.urls import include, url
from django.urls import include, path
from django.contrib import admin
from django.urls import reverse_lazy
from django.views.generic import RedirectView

admin.autodiscover()

urlpatterns = [
url(r"^admin/", admin.site.urls),
url(r"^$", RedirectView.as_view(url=reverse_lazy("admin:index"), permanent=False)),
path('admin/', admin.site.urls),
path('', RedirectView.as_view(url=reverse_lazy("admin:index"), permanent=False)),
]
2 changes: 1 addition & 1 deletion example/orders/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models
from django.utils.dates import MONTHS_3
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from polymorphic.models import PolymorphicModel

Expand Down
4 changes: 2 additions & 2 deletions polymorphic/tests/admintestcase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf import settings
from django.conf.urls import include, url
from django.urls import include, path
from django.contrib.admin import AdminSite
from django.contrib.admin.templatetags.admin_urls import admin_urlname
from django.contrib.auth.models import User
Expand Down Expand Up @@ -53,7 +53,7 @@ def admin_register(self, model, admin_site):

# Make sure the URLs are reachable by reverse()
clear_url_caches()
set_urlconf(tuple([url("^tmp-admin/", self.admin_site.urls)]))
set_urlconf(tuple([path('tmp-admin/', self.admin_site.urls)]))

def get_admin_instance(self, model):
try:
Expand Down
1 change: 1 addition & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
env="SECONDARY_DATABASE", default="sqlite://:memory:"
),
},
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
TEST_RUNNER="django.test.runner.DiscoverRunner",
INSTALLED_APPS=(
"django.contrib.auth",
Expand Down

0 comments on commit 8066c4c

Please sign in to comment.