[Answer]-Loading choices to choicefield in form in Django

1👍

If you define choice field in the form class then you have to provide choices argument:

class ClientesForm(forms.ModelForm):
    ...
    estado = forms.ChoiceField(help_text="Estado", choices=Clientes.ESTADO)

But why you redefine model fields in the form? It is unnecessary:

class ClientesForm(forms.ModelForm):
    class Meta:
        model=Clientes
        fields = ('nombre', 'apellido', 'ci', 'estado')

Leave a comment