I have a django model (A) that has ManyToManyField (types) for another model (B). It is understood that the field in is "optional, restricting this object to these values." I installed blank=nulland null=Trueon ManyToManyField. I created an object from this model and set types for some values. Things are good.
I want to set it to "null", i.e. disable it. But in the django shell, the following errors occur:
>>> o.types.all()
[<Type: foo>, <Type: bar>]
>>> o.types = None
File "<console>", line 1, in <module>
File ".../virtualenv/lib/python2.6/site-packages/django/db/models/fields/related.py", line 627, in __set__
manager.add(*value)
TypeError: add() argument after * must be a sequence, not NoneType
I can successfully set it to [](empty list), but I would like to set it to None, since I want to use None as a signal / flag. Is this possible in Django models?
I am using Django 1.1
source
share