diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
a
|
b
|
|
615 | 615 | class AlbumAdmin(admin.ModelAdmin): |
616 | 616 | list_filter = ['title'] |
617 | 617 | |
| 618 | class Employee(Person): |
| 619 | code = models.CharField(max_length=20) |
| 620 | |
| 621 | class WorkHour(models.Model): |
| 622 | datum = models.DateField() |
| 623 | employee = models.ForeignKey(Employee) |
| 624 | |
| 625 | class WorkHourAdmin(admin.ModelAdmin): |
| 626 | list_display = ('datum', 'employee') |
| 627 | list_filter = ('employee',) |
| 628 | |
618 | 629 | admin.site.register(Article, ArticleAdmin) |
619 | 630 | admin.site.register(CustomArticle, CustomArticleAdmin) |
620 | 631 | admin.site.register(Section, save_as=True, inlines=[ArticleInline]) |
… |
… |
|
646 | 657 | admin.site.register(PlotDetails) |
647 | 658 | admin.site.register(CyclicOne) |
648 | 659 | admin.site.register(CyclicTwo) |
| 660 | admin.site.register(WorkHour, WorkHourAdmin) |
649 | 661 | |
650 | 662 | # We intentionally register Promo and ChapterXtra1 but not Chapter nor ChapterXtra2. |
651 | 663 | # That way we cover all four cases: |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
a
|
b
|
|
33 | 33 | FooAccount, Gallery, ModelWithStringPrimaryKey, \ |
34 | 34 | Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, \ |
35 | 35 | Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit, \ |
36 | | Category, Post, Plot, FunkyTag, Chapter, Book, Promo |
| 36 | Category, Post, Plot, FunkyTag, Chapter, Book, Promo, WorkHour, Employee |
37 | 37 | |
38 | 38 | |
39 | 39 | class AdminViewBasicTest(TestCase): |
… |
… |
|
382 | 382 | except SuspiciousOperation: |
383 | 383 | self.fail("Filters should be allowed if they involve a local field without the need to whitelist them in list_filter or date_hierarchy.") |
384 | 384 | |
| 385 | e1 = Employee.objects.create(name='Anonymous', gender=1, age=22, alive=True, code='123') |
| 386 | e2 = Employee.objects.create(name='Visitor', gender=2, age=19, alive=True, code='124') |
| 387 | WorkHour.objects.create(datum=datetime.datetime.now(), employee=e1) |
| 388 | WorkHour.objects.create(datum=datetime.datetime.now(), employee=e2) |
| 389 | response = self.client.get("/test_admin/admin/admin_views/workhour/") |
| 390 | self.assertEqual(response.status_code, 200) |
| 391 | self.assertContains(response, 'employee__person_ptr__exact') |
| 392 | response = self.client.get("/test_admin/admin/admin_views/workhour/?employee__person_ptr__exact=%d" % e1.pk) |
| 393 | self.assertEqual(response.status_code, 200) |
| 394 | |
385 | 395 | class SaveAsTests(TestCase): |
386 | 396 | fixtures = ['admin-views-users.xml','admin-views-person.xml'] |
387 | 397 | |