81 | | When you have a Field: current_zip = meta.IntegerField(maxlength=5,blank=True) |
82 | | |
83 | | django will create a not nullable field in the DB. However leaving the field blank (in admin/web) django will try and insert a NULL value in the DB. |
84 | | |
85 | | ==== Solution ==== |
86 | | |
87 | | Add null=True: |
88 | | |
89 | | current_zip = meta.IntegerField(maxlength=5,null=True,blank=True) |
| 81 | When you have a Field: |
| 82 | |
| 83 | {{{ |
| 84 | #!python |
| 85 | current_zip = meta.IntegerField(maxlength=5, blank=True) |
| 86 | }}} |
| 87 | |
| 88 | Django will create a not nullable field in the database. However leaving the field blank (in admin or web interface) Django will try and insert a {{{NULL}}} value in the database. |
| 89 | |
| 90 | ==== Solution ==== |
| 91 | |
| 92 | Add {{{null=True}}}: |
| 93 | |
| 94 | {{{ |
| 95 | #!python |
| 96 | current_zip = meta.IntegerField(maxlength=5, null=True, blank=True) |
| 97 | }}} |