[Answered ]-How to add empty_label in forms.ModelForm?

1👍

This is a parameter of the form field, not the widget. If you do not want to override the rest of the form field, you specify this in the constructor of the form:

class NameForm(forms.ModelForm):
    
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['choice'].empty_label = 'lorem'

    class Meta:
        model = Model
        fields = ['choice',]
        widgets = {
            'choice': forms.Select(attrs={'class': 'class'}),
        }

Leave a comment