I have a field allow NULL value, but how can I set it back to NULL? not blank
Asked
Active
Viewed 4.3k times
1 Answers
148
Assign None
.

Ignacio Vazquez-Abrams
- 776,304
- 153
- 1,341
- 1,358
-
3So simple, but not easily found in the Django docs. They need an FAQ that's searchable by google. – uchuugaka Mar 20 '16 at 15:42
-
3Does not work for `ManyToManyField`. `TypeError: 'NoneType' object is not iterable`. – CoderGuy123 Nov 15 '16 at 07:23
-
1@Deleet A ManyToManyField is represented in the database as another table, where a relation can exist or not (it will be another row in the m2m table). There is no field to assign NULL to. See the clear or remove keywords to remove all m2m relations. https://docs.djangoproject.com/en/1.11/ref/models/relations/#django.db.models.fields.related.RelatedManager.clear – Jose_mr Jun 06 '17 at 11:01