From 2088a230d28b302b6adeacedb7b6bb704573a135 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vlastimil=20Z=C3=ADma?= <vlastimil.zima@nic.cz>
Date: Thu, 10 Apr 2014 16:33:36 +0200
Subject: [PATCH] Show app_name error in admin
---
tests/admin_views/admin.py | 5 +++++
tests/admin_views/tests.py | 10 +++++++---
tests/admin_views/urls.py | 1 +
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index b31c5b5..5ce923d 100644
a
|
b
|
site.register(Group, GroupAdmin)
|
786 | 786 | site2 = admin.AdminSite(name="namespaced_admin") |
787 | 787 | site2.register(User, UserAdmin) |
788 | 788 | site2.register(Group, GroupAdmin) |
| 789 | |
| 790 | # Used to test URL application names |
| 791 | site3 = admin.AdminSite(app_name="custom_app", name="custom_name") |
| 792 | site3.register(User, UserAdmin) |
| 793 | site3.register(Group, GroupAdmin) |
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index f26b0ab..615f728 100644
a
|
b
|
from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount,
|
51 | 51 | AdminOrderedModelMethod, AdminOrderedAdminMethod, AdminOrderedCallable, |
52 | 52 | Report, MainPrepopulated, RelatedPrepopulated, UnorderedObject, |
53 | 53 | Simple, UndeletableObject, Choice, ShortMessage, Telegram, Pizza, Topping) |
54 | | from .admin import site, site2 |
| 54 | from .admin import site, site2, site3 |
55 | 55 | |
56 | 56 | |
57 | 57 | ERROR_MESSAGE = "Please enter the correct username and password \ |
… |
… |
class AdminKeepChangeListFiltersTests(TestCase):
|
4256 | 4256 | if user_id is None: |
4257 | 4257 | user_id = self.get_sample_user_id() |
4258 | 4258 | return "%s?%s" % ( |
4259 | | reverse('admin:auth_user_change', args=(user_id,), |
| 4259 | reverse('%s:auth_user_change' % self.admin_site.app_name, args=(user_id,), |
4260 | 4260 | current_app=self.admin_site.name), |
4261 | 4261 | self.get_preserved_filters_querystring(), |
4262 | 4262 | ) |
… |
… |
class AdminKeepChangeListFiltersTests(TestCase):
|
4274 | 4274 | if user_id is None: |
4275 | 4275 | user_id = self.get_sample_user_id() |
4276 | 4276 | return "%s?%s" % ( |
4277 | | reverse('admin:auth_user_delete', args=(user_id,), |
| 4277 | reverse('%s:auth_user_delete' % self.admin_site.app_name, args=(user_id,), |
4278 | 4278 | current_app=self.admin_site.name), |
4279 | 4279 | self.get_preserved_filters_querystring(), |
4280 | 4280 | ) |
… |
… |
class NamespacedAdminKeepChangeListFiltersTests(AdminKeepChangeListFiltersTests)
|
4374 | 4374 | admin_site = site2 |
4375 | 4375 | |
4376 | 4376 | |
| 4377 | class CustomAppAdminKeepChangeListFiltersTests(AdminKeepChangeListFiltersTests): |
| 4378 | admin_site = site3 |
| 4379 | |
| 4380 | |
4377 | 4381 | class AdminGenericRelationTests(TestCase): |
4378 | 4382 | def test_generic_relation_fk_list_filter(self): |
4379 | 4383 | """ |
diff --git a/tests/admin_views/urls.py b/tests/admin_views/urls.py
index 763c83a..25317ef 100644
a
|
b
|
urlpatterns = patterns('',
|
13 | 13 | (r'^test_admin/admin3/', include(admin.site.urls), dict(form_url='pony')), |
14 | 14 | (r'^test_admin/admin4/', include(customadmin.simple_site.urls)), |
15 | 15 | (r'^test_admin/admin5/', include(admin.site2.urls)), |
| 16 | (r'^test_admin/admin_custom_app/', include(admin.site3.urls)), |
16 | 17 | ) |