@@ -14,7 +14,6 @@ class UnsupportedChildType(LookupError):
14
14
pass
15
15
16
16
17
-
18
17
class PolymorphicFormSetChild (object ):
19
18
"""
20
19
Metadata to define the inline of a polymorphic child.
@@ -46,7 +45,7 @@ def content_type(self):
46
45
Expose the ContentType that the child relates to.
47
46
This can be used for the ''polymorphic_ctype'' field.
48
47
"""
49
- return ContentType .objects .get_for_model (self .model )
48
+ return ContentType .objects .get_for_model (self .model , for_concrete_model = False )
50
49
51
50
def get_form (self , ** kwargs ):
52
51
"""
@@ -161,7 +160,7 @@ def _construct_form(self, i, **kwargs):
161
160
if self .is_bound :
162
161
if 'instance' in defaults :
163
162
# Object is already bound to a model, won't change the content type
164
- model = defaults ['instance' ].get_real_concrete_instance_class () # respect proxy models
163
+ model = defaults ['instance' ].get_real_instance_class () # allow proxy models
165
164
else :
166
165
# Extra or empty form, use the provided type.
167
166
# Note this completely tru
@@ -177,7 +176,7 @@ def _construct_form(self, i, **kwargs):
177
176
raise UnsupportedChildType ("Child model type {0} is not part of the formset" .format (model ))
178
177
else :
179
178
if 'instance' in defaults :
180
- model = defaults ['instance' ].get_real_concrete_instance_class () # respect proxy models
179
+ model = defaults ['instance' ].get_real_instance_class () # allow proxy models
181
180
elif 'polymorphic_ctype' in defaults .get ('initial' , {}):
182
181
model = defaults ['initial' ]['polymorphic_ctype' ].model_class ()
183
182
elif i < len (self .queryset_data ):
0 commit comments