Skip to content

Commit

Permalink
fix: fix admin URLs in Django 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Jul 21, 2021
1 parent e88a334 commit f77af40
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mezzanine/boot/lazy_admin.py
Expand Up @@ -57,7 +57,7 @@ def lazy_registration(self):

@property
def urls(self):
urls = [url(r"", super().urls)]
urls = []

# Filebrowser admin media library.
fb_name = getattr(settings, "PACKAGE_NAME_FILEBROWSER", "")
Expand All @@ -66,7 +66,7 @@ def urls(self):
fb_urls = import_dotted_path("%s.sites.site" % fb_name).urls
except ImportError:
fb_urls = "%s.urls" % fb_name
urls = [
urls += [
# This gives the media library a root URL (which filebrowser
# doesn't provide), so that we can target it in the
# ADMIN_MENU_ORDER setting, allowing each view to correctly
Expand All @@ -77,7 +77,7 @@ def urls(self):
name="media-library",
),
url(r"^media-library/", include(fb_urls)),
] + urls
]

# Give the urlpattern for the user password change view an
# actual name, so that it can be reversed with multiple
Expand All @@ -87,13 +87,13 @@ def urls(self):
user_change_password = getattr(admin, "user_change_password", None)
if user_change_password:
bits = (User._meta.app_label, User._meta.object_name.lower())
urls = [
urls += [
url(
r"^%s/%s/(\d+)/password/$" % bits,
self.admin_view(user_change_password),
name="user_change_password",
),
] + urls
]
break

# Misc Mezzanine urlpatterns that should reside under /admin/ url,
Expand All @@ -117,12 +117,12 @@ def urls(self):
if "mezzanine.pages" in settings.INSTALLED_APPS:
from mezzanine.pages.views import admin_page_ordering

urls.append(
urls += [
url(
r"^admin_page_ordering/$",
admin_page_ordering,
name="admin_page_ordering",
)
)
]

return urls
return urls + [url(r"", super().urls)]

0 comments on commit f77af40

Please sign in to comment.