Let's use a custom ModelAdmin that changes the ordering, and make sure it actually changes.
(self)
| 60 | self.assertEqual(["Aerosmith", "Radiohead", "Van Halen"], names) |
| 61 | |
| 62 | def test_specified_ordering(self): |
| 63 | """ |
| 64 | Let's use a custom ModelAdmin that changes the ordering, and make sure |
| 65 | it actually changes. |
| 66 | """ |
| 67 | |
| 68 | class BandAdmin(ModelAdmin): |
| 69 | ordering = ("rank",) # default ordering is ('name',) |
| 70 | |
| 71 | ma = BandAdmin(Band, site) |
| 72 | names = [b.name for b in ma.get_queryset(request)] |
| 73 | self.assertEqual(["Radiohead", "Van Halen", "Aerosmith"], names) |
| 74 | |
| 75 | def test_specified_ordering_by_f_expression(self): |
| 76 | class BandAdmin(ModelAdmin): |
nothing calls this directly
no test coverage detected