| 105 | If you create a ForeignKey with `blank=True`, but you don't specify `null=True`, and try to save the object without a value for the foreign key, you get this exception: |
| 106 | |
| 107 | {{{ |
| 108 | ValueError: Cannot assign None: "Cat.home" does not allow null values. |
| 109 | }}} |
| 110 | |
| 111 | You could argue that it's obvious, but it's confusing many people: |
| 112 | |
| 113 | * http://www.google.co.uk/search?gcx=c&sourceid=chrome&client=ubuntu&channel=cs&ie=UTF-8&q=%22Cannot+assign+None%3A%22+%22does+not+allow+null+values.%22 |
| 114 | * http://stackoverflow.com/questions/4117345/django-null-foreignkey |
| 115 | * http://stackoverflow.com/questions/1810745/django-cannot-assign-none-does-not-allow-null-values |
| 116 | * http://groups.google.com/group/django-users/browse_thread/thread/af89c86e824cb0d8 |
| 117 | * http://www.mail-archive.com/django-users@googlegroups.com/msg91776.html |
| 118 | |
| 119 | I think it would be a really good idea to make it really clear from the error message what you need to do (blank=True requires null=True on foreign key fields). |
| 120 | |
| 121 | Unfortunately we can't automatically fix it, because if the field is left blank, the developer might be intending to supply the value automatically before save (https://code.djangoproject.com/ticket/13824). |
| 122 | |