summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_views
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-07-16 16:16:13 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-07-16 16:16:13 +0000
commit8d48eaa064c88533be5082e3f45638fbd48491d8 (patch)
tree869920eb92a7e4b4248b3adf5e3f9104c4d57532 /tests/regressiontests/admin_views
parent9fd19c01611e5ed1ed64bbeb462ab96499d72a6c (diff)
Fixed #10061 -- Added namespacing for named URLs - most importantly, for the admin site, where the absence of this facility was causing problems. Thanks to the many people who contributed to and helped review this patch.
This change is backwards incompatible for anyone that is using the named URLs introduced in [9739]. Any usage of the old admin_XXX names need to be modified to use the new namespaced format; in many cases this will be as simple as a search & replace for "admin_" -> "admin:". See the docs for more details on the new URL names, and the namespace resolution strategy. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views')
-rw-r--r--tests/regressiontests/admin_views/customadmin.py8
-rw-r--r--tests/regressiontests/admin_views/tests.py5
2 files changed, 9 insertions, 4 deletions
diff --git a/tests/regressiontests/admin_views/customadmin.py b/tests/regressiontests/admin_views/customadmin.py
index 70e87ebcfe..80570ea51d 100644
--- a/tests/regressiontests/admin_views/customadmin.py
+++ b/tests/regressiontests/admin_views/customadmin.py
@@ -10,19 +10,19 @@ import models
class Admin2(admin.AdminSite):
login_template = 'custom_admin/login.html'
index_template = 'custom_admin/index.html'
-
+
# A custom index view.
def index(self, request, extra_context=None):
return super(Admin2, self).index(request, {'foo': '*bar*'})
-
+
def get_urls(self):
return patterns('',
(r'^my_view/$', self.admin_view(self.my_view)),
) + super(Admin2, self).get_urls()
-
+
def my_view(self, request):
return HttpResponse("Django is a magical pony!")
-
+
site = Admin2(name="admin2")
site.register(models.Article, models.ArticleAdmin)
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 38fe5ccc9d..aafa303cec 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -205,6 +205,11 @@ class AdminViewBasicTest(TestCase):
response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'color__id__exact': 'StringNotInteger!'})
self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit)
+ def testLogoutAndPasswordChangeURLs(self):
+ response = self.client.get('/test_admin/%s/admin_views/article/' % self.urlbit)
+ self.failIf('<a href="/test_admin/%s/logout/">' % self.urlbit not in response.content)
+ self.failIf('<a href="/test_admin/%s/password_change/">' % self.urlbit not in response.content)
+
def testNamedGroupFieldChoicesChangeList(self):
"""
Ensures the admin changelist shows correct values in the relevant column