Skip to content

Commit 5191989

Browse files
bo0tzzvdboor
authored andcommitted
Use TypedChoiceField for polymorphic_ctype field
Fixes jazzband#412
1 parent 611aa7b commit 5191989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polymorphic/formsets/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ def add_fields(self, form, index):
229229
form._meta.model, for_concrete_model=False
230230
)
231231
choices = [(ct.pk, ct)] # Single choice, existing forms can't change the value.
232-
form.fields["polymorphic_ctype"] = forms.ChoiceField(
233-
choices=choices, initial=ct.pk, required=False, widget=forms.HiddenInput
232+
form.fields["polymorphic_ctype"] = forms.TypedChoiceField(
233+
choices=choices, initial=ct.pk, required=False, widget=forms.HiddenInput, coerce=int,
234234
)
235235
super(BasePolymorphicModelFormSet, self).add_fields(form, index)
236236

0 commit comments

Comments
 (0)