summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-07-19 02:17:40 +0700
committerSimon Charette <charette.s@gmail.com>2013-07-18 18:18:30 -0400
commit2fc6c9472cd25910f978fe1d18de5c350370f901 (patch)
treefbebb156963f35a19c2c2b73086f38de91c82fbf /django
parent9a2715da8b4c196e1cccd3241f6f585da53359a6 (diff)
Fixed #20767 -- Fixed ModelAdmin.preserve_filters for namespaced URLs.
Thanks Collin Anderson for the report.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/admin/options.py6
-rw-r--r--django/contrib/admin/templatetags/admin_urls.py2
2 files changed, 3 insertions, 5 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 9c92f7ae9c..afc7cfc5bd 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -771,12 +771,10 @@ class ModelAdmin(BaseModelAdmin):
Returns the preserved filters querystring.
"""
- # FIXME: We can remove that getattr as soon as #20619 is fixed.
- match = getattr(request, 'resolver_match', None)
-
+ match = request.resolver_match
if self.preserve_filters and match:
opts = self.model._meta
- current_url = '%s:%s' % (match.namespace, match.url_name)
+ current_url = '%s:%s' % (match.app_name, match.url_name)
changelist_url = 'admin:%s_%s_changelist' % (opts.app_label, opts.model_name)
if current_url == changelist_url:
preserved_filters = request.GET.urlencode()
diff --git a/django/contrib/admin/templatetags/admin_urls.py b/django/contrib/admin/templatetags/admin_urls.py
index 19da87d61f..5d9c5b5427 100644
--- a/django/contrib/admin/templatetags/admin_urls.py
+++ b/django/contrib/admin/templatetags/admin_urls.py
@@ -38,7 +38,7 @@ def add_preserved_filters(context, url, popup=False):
except Resolver404:
pass
else:
- current_url = '%s:%s' % (match.namespace, match.url_name)
+ current_url = '%s:%s' % (match.app_name, match.url_name)
changelist_url = 'admin:%s_%s_changelist' % (opts.app_label, opts.model_name)
if changelist_url == current_url and '_changelist_filters' in preserved_filters:
preserved_filters = dict(parse_qsl(preserved_filters['_changelist_filters']))