How to hide the default placeholder on a form


I’m working on a ModelForm. When a field is set to blank=False in, the form element appears like this:

This screenshot corresponds to this in

field1 = models.ForeignKey(
    verbose_name='some verbose name',

Which is how I want it to appear. However, when the model indicates blank=True (which is needed), I have this kind of placeholder default (the “---------”) that I can’t get rid of:


    field2 = models.CharField(
        _('Some label'),

Is it possible to get the appearance of the first image on a filed where blank is set to True?

See the paragraph immediately before this link - Model field reference | Django documentation | Django

Great, thank you very much Ken!

It works great when dealing with choices written in the file. Would you know if there’s a chance it works when dealing with a ForeignKey reffering to a CharField?

I tried to set the field to null=True, then add a new line in the database table and set it either to null or to an empty content, but without luck so far…

See the empty_label attribute for the ModelChoiceField.

1 Like

Perfect. Thanks again!