diff options
author | Loic Bistuer <loic.bistuer@sixmedia.com> | 2013-07-31 12:52:11 +0700 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2013-08-04 09:14:18 -0400 |
commit | ebb3e50243448545c7314a1932a9067ddca5960b (patch) | |
tree | 5e4af9ef2bf3a9952e6410ef18366340b9523772 /tests/modeladmin | |
parent | 61ecb5f48a4732f1471f858c64904ec1c4763925 (diff) | |
download | django-ebb3e50243448545c7314a1932a9067ddca5960b.tar.gz |
Introduced ModelAdmin.get_fields() and refactored get_fieldsets() to use it.
Refs #18681.
This also starts the deprecation of ModelAdmin.declared_fieldsets
Diffstat (limited to 'tests/modeladmin')
-rw-r--r-- | tests/modeladmin/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index 616b0889b9..424588cf49 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -51,6 +51,12 @@ class ModelAdminTests(TestCase): self.assertEqual(list(ma.get_form(request).base_fields), ['name', 'bio', 'sign_date']) + self.assertEqual(list(ma.get_fields(request)), + ['name', 'bio', 'sign_date']) + + self.assertEqual(list(ma.get_fields(request, self.band)), + ['name', 'bio', 'sign_date']) + def test_default_fieldsets(self): # fieldsets_add and fieldsets_change should return a special data structure that # is used in the templates. They should generate the "right thing" whether we @@ -97,6 +103,10 @@ class ModelAdminTests(TestCase): ma = BandAdmin(Band, self.site) + self.assertEqual(list(ma.get_fields(request)), ['name']) + + self.assertEqual(list(ma.get_fields(request, self.band)), ['name']) + self.assertEqual(ma.get_fieldsets(request), [(None, {'fields': ['name']})]) |