[Fixed]-Database choices with modelchoiceform connection

1๐Ÿ‘

โœ…

If you just want the choices defined in your Person model to appear in your RegistrationForm, you can do it without ModelChoiceField.

Use ChoiceField with Person model choices.

In your forms.py:

class RegistrationForm(forms.Form):
     user_type = forms.ChoiceField(choices=Person.USER_TYPE_CHOICES)
๐Ÿ‘คv1k45

Leave a comment