Django, how to remove the blank choice from the choicefield in modelform?

See ModelChoiceField. You have to set empty_label to None. So your code will be something like:

class BookSubmitForm(ModelForm):
    library = ModelChoiceField(queryset=Library.objects, empty_label=None)

    class Meta:
        model = Book    

EDIT:changed the field name to lower case

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)