diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index 22ff453..e00cc69 100644
a
|
b
|
from .models import (Article, Chapter, Child, Parent, Picture, Widget,
|
35 | 35 | UnchangeableObject, UserMessenger, Simple, Choice, ShortMessage, Telegram, |
36 | 36 | FilteredManager, EmptyModelHidden, EmptyModelVisible, EmptyModelMixin, |
37 | 37 | State, City, Restaurant, Worker, ParentWithDependentChildren, |
38 | | DependentChild, StumpJoke, FieldOverridePost) |
| 38 | DependentChild, StumpJoke, FieldOverridePost, FunkyTag) |
39 | 39 | |
40 | 40 | |
41 | 41 | def callable_year(dt_value): |
… |
… |
class RestaurantAdmin(admin.ModelAdmin):
|
827 | 827 | return {'name': 'overridden_value'} |
828 | 828 | |
829 | 829 | |
| 830 | class FunkyTagAdmin(admin.ModelAdmin): |
| 831 | list_display = ('name', 'content_object') |
| 832 | |
| 833 | |
830 | 834 | site = admin.AdminSite(name="admin") |
831 | 835 | site.register(Article, ArticleAdmin) |
832 | 836 | site.register(CustomArticle, CustomArticleAdmin) |
… |
… |
site.register(State, StateAdmin)
|
882 | 886 | site.register(City, CityAdmin) |
883 | 887 | site.register(Restaurant, RestaurantAdmin) |
884 | 888 | site.register(Worker, WorkerAdmin) |
| 889 | site.register(FunkyTag, FunkyTagAdmin) |
885 | 890 | |
886 | 891 | # We intentionally register Promo and ChapterXtra1 but not Chapter nor ChapterXtra2. |
887 | 892 | # That way we cover all four cases: |
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 6006a0e..9b131fe 100644
a
|
b
|
class AdminViewDeletedObjectsTest(TestCase):
|
1704 | 1704 | """ |
1705 | 1705 | plot = Plot.objects.get(pk=3) |
1706 | 1706 | FunkyTag.objects.create(content_object=plot, name='hott') |
1707 | | should_contain = """<li>Funky tag: hott""" |
| 1707 | should_contain = """<li>Funky tag: <a href="/test_admin/admin/admin_views/funkytag/1/">hott""" |
1708 | 1708 | response = self.client.get('/test_admin/admin/admin_views/plot/%s/delete/' % quote(3)) |
1709 | 1709 | self.assertContains(response, should_contain) |
1710 | 1710 | |
1711 | 1711 | |
1712 | 1712 | @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',), |
1713 | 1713 | ROOT_URLCONF="admin_views.urls") |
| 1714 | class TestGenericRelations(TestCase): |
| 1715 | fixtures = ['admin-views-users.xml', 'deleted-objects.xml'] |
| 1716 | |
| 1717 | def setUp(self): |
| 1718 | self.client.login(username='super', password='secret') |
| 1719 | |
| 1720 | def test_generic_content_object_in_list_display(self): |
| 1721 | plot = Plot.objects.get(pk=3) |
| 1722 | FunkyTag.objects.create(content_object=plot, name='hott') |
| 1723 | response = self.client.get('/test_admin/admin/admin_views/funkytag/') |
| 1724 | self.assertContains(response, "<td>%s</td>" % plot) |
| 1725 | |
| 1726 | |
| 1727 | @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',), |
| 1728 | ROOT_URLCONF="admin_views.urls") |
1714 | 1729 | class AdminViewStringPrimaryKeyTest(TestCase): |
1715 | 1730 | fixtures = ['admin-views-users.xml', 'string-primary-key.xml'] |
1716 | 1731 | |