File tree Expand file tree Collapse file tree 8 files changed +20
-3
lines changed
Expand file tree Collapse file tree 8 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -221,3 +221,4 @@ __marimo__/
221221
222222test1.db
223223test2.db
224+ example /example.db
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Changelog
44v4.3.0 (202X-XX-XX)
55-------------------
66
7+ * Implemented `Include get_child_inlines() hook in stacked inline admin forms. <https://github.com/jazzband/django-polymorphic/pull/681 >`_
78* Fixed `"multi-database support in inheritance accessors. <https://github.com/jazzband/django-polymorphic/pull/550 >`_
89* Fixed `Caching in inheritance accessor functions <https://github.com/jazzband/django-polymorphic/pull/510 >`_
910* Fixed `Foreign key resolves to parent class when using abstract models <https://github.com/jazzband/django-polymorphic/issues/437 >`_
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ manage *COMMAND:
1515 import sys
1616 from django.core import management
1717 sys.path.append (os .getcwd())
18- os .environ[" DJANGO_SETTINGS_MODULE" ] = " polymorphic.tests.settings "
18+ os .environ[" DJANGO_SETTINGS_MODULE" ] = " polymorphic.tests.debug "
1919 os .environ[" SQLITE_DATABASES" ] = " test1.db,test2.db"
2020 management.execute_from_command_line(sys.argv + " {{ COMMAND }} " .split(" " ))
2121
Original file line number Diff line number Diff line change @@ -81,8 +81,9 @@ def get_child_inlines(self):
8181 """
8282 Return the derived inline classes which this admin should handle.
8383
84- This should return a list of tuples, exactly like
85- :attr:`child_inlines` is.
84+ This should return an iterable of
85+ :class:`~polymorphic.admin.inlines.PolymorphicInlineModelAdmin.Child classes,
86+ to override :attr:`child_inlines.
8687 """
8788 return self .child_inlines or []
8889
Original file line number Diff line number Diff line change @@ -57,3 +57,4 @@ class InlineModelBChild(StackedPolymorphicInline.Child):
5757@register (InlineParent )
5858class InlineParentAdmin (PolymorphicInlineSupportMixin , ModelAdmin ):
5959 inlines = (Inline ,)
60+ extra = 1
Original file line number Diff line number Diff line change 1+ from .settings import *
2+
3+ DEBUG = True
Original file line number Diff line number Diff line change 101101 "polymorphic" ,
102102 "polymorphic.tests" ,
103103)
104+
104105MIDDLEWARE = (
105106 "django.middleware.common.CommonMiddleware" ,
106107 "django.contrib.sessions.middleware.SessionMiddleware" ,
Original file line number Diff line number Diff line change @@ -236,6 +236,15 @@ def tearDown(self):
236236 InlineParent .objects .all ().delete ()
237237 super ().tearDown ()
238238
239+ def test_get_child_inlines (self ):
240+ from .admin import Inline
241+
242+ inline = Inline (parent_model = InlineParent , admin_site = admin .site )
243+ child_inlines = inline .get_child_inlines ()
244+ self .assertEqual (len (child_inlines ), 2 )
245+ self .assertEqual (child_inlines [0 ], Inline .InlineModelAChild )
246+ self .assertEqual (child_inlines [1 ], Inline .InlineModelBChild )
247+
239248 def test_admin_inline_add_autocomplete (self ):
240249 # https://github.com/jazzband/django-polymorphic/issues/546
241250 self .page .goto (self .add_url (InlineParent ))
You can’t perform that action at this time.
0 commit comments