Q:

django many2many field make not required

I created a form based on a model. The model has a many2many field. I defined the field like this:
contacts = models.ManyToManyField(Contact, blank=True, null=True)

I`m wondering now why the generated form says that this field cannot be blank. I always get the error message "This field is required.", when i do not select a contact for the contacts field.
Whats`s wrong?

A:

In your form declaration mark this field as required=False
class MyForm(forms.ModelForm):
  contacts=forms.ModelMultipleChoiceField(queryset=Contact.objects.all(),required=False)
  class Meta:
    model=MyModel

