Django forms: ModelMultipleChoiceField displaying error "null" is not a valid value for a primary key
In my application I have model like:

    class Entity(models.Model):
    #some other fields
    
    tags = models.ManyToManyField('Tag', blank=True, null=True)
   
    #... the rest

It is declared that way, because it should be an optional relation. Then in my custom form I have defined field:

    tagsAll = forms.ModelMultipleChoiceField(
                                             label=Choose:",
                                             queryset=Tag.objects.all(),
                                             required = False
                                             )

And, from what I found in docs and forums it should work... but it doesn't :/ After submitting the form, it return the error:

**"null" is not a valid value for a primary key**

Why?
Django forms: ModelMultipleChoiceField displaying error "null" is not a valid value for a primary key
===

In my application I have model like:

    class Entity(models.Model):
    #some other fields
    
    tags = models.ManyToManyField('Tag', blank=True, null=True)
   
    #... the rest

It is declared that way, because it should be an optional relation. Then in my custom form I have defined field:

    tagsAll = forms.ModelMultipleChoiceField(
                                             label=Choose:",
                                             queryset=Tag.objects.all(),
                                             required = False
                                             )

And, from what I found in docs and forums it should work... but it doesn't :/ After submitting the form, it return the error:

**"null" is not a valid value for a primary key**

Why?