Opened 15 years ago

Closed 15 years ago

#9688 closed (invalid)

Date*Field IntegrityError 1048 column cannot be null

Reported by: pierpaolodf Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: DateField DateTimeField null IntegrityError 1048
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have the following model:

...

date=models.DateField?(blank=True, null=True)

...

As I try to add a new record in admin it throws an IntegrityError 1048 saying that the DateField? cannot be null, even though it is set to be both blank and null.

I tried also programmatically in shell and it throws the same error.

I'm working on Django SVN release 9525, Python 2.5, MySql? 5.0 and Apache 2.2 with modpython.

Change History (1)

comment:1 by Karen Tracey, 15 years ago

Resolution: invalid
Status: newclosed

I'm guessing you added one or both those options after the syncdb that created the table. In which case you need to manually update the table definition to say nulls are allowed, since changes like this that you made to your model definitions post-syncdb aren't reflected in the DB automatically. Reopen if you've got a recreatable scenario where a blank=True,null=True DateField is created by syncdb without allowing nulls at the DB level, but I doubt that is what is happened.

Note: See TracTickets for help on using tickets.
Back to Top