Skip to content

Commit

Permalink
Use TypedChoiceField for polymorphic_ctype field
Browse files Browse the repository at this point in the history
Fixes #412
  • Loading branch information
bo0tzz authored and vdboor committed Nov 18, 2021
1 parent 611aa7b commit 5191989
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions polymorphic/formsets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ def add_fields(self, form, index):
form._meta.model, for_concrete_model=False
)
choices = [(ct.pk, ct)] # Single choice, existing forms can't change the value.
form.fields["polymorphic_ctype"] = forms.ChoiceField(
choices=choices, initial=ct.pk, required=False, widget=forms.HiddenInput
form.fields["polymorphic_ctype"] = forms.TypedChoiceField(
choices=choices, initial=ct.pk, required=False, widget=forms.HiddenInput, coerce=int,
)
super(BasePolymorphicModelFormSet, self).add_fields(form, index)

Expand Down

0 comments on commit 5191989

Please sign in to comment.