column cannot be null

1,240 views
Skip to first unread message

podio

unread,
Jun 1, 2011, 2:00:31 PM6/1/11
to Django users
I'm getting an error leaving a field blank but I have blank = True in
the model

IntegrityError at /admin/afiliados/afiliado/add/
(1048, "Column 'titular_id' cannot be null")
Request Method: POST
Request URL: http://localhost/mysite/admin/afiliados/afiliado/add/
Django Version: 1.3
Exception Type: IntegrityError
Exception Value:
(1048, "Column 'titular_id' cannot be null")


------------------------
class afiliado(models.Model):
....other fields...
titular = models.OneToOneField("self",blank = True)


Thanks!

Ryan

unread,
Jun 1, 2011, 2:25:04 PM6/1/11
to django...@googlegroups.com
blank = True means that a django form will not require a value, but the database still does so it's expected that you provide a value elsewhere. In order to allow a null entry into the database, you will need to add null = True to that definition aswell

Hope this helps,

Ryan

Reply all
Reply to author
Forward
0 new messages