django contrib auth last_login cannot be "null"

1,437 views
Skip to first unread message

aRkadeFR

unread,
Apr 21, 2015, 12:27:57 PM4/21/15
to django...@googlegroups.com
Hello,

I'm upgrading my systems to Django 1.8 and I'm facing this error:
(1048, "Column 'last_login' cannot be null")

so I describe my table in DB:
+---------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default |
Extra |
+---------------------+------------------+------+-----+---------+----------------+
| last_login | datetime | NO | | NULL
| |


and yep, it is not nullable, but the 0005_alter_user_last_login_null
migrations
is run, so why this field is not nullable?
How can I debug this?

PS: I run ./manage.py migrate (without --fake option)
and I use the AbstractUser as my base class.

Thanks and have a good one

Tim Graham

unread,
Apr 21, 2015, 1:13:11 PM4/21/15
to django...@googlegroups.com, con...@arkade.info
This seems to be a common point of confusion. I'll add a sentence to release notes under the "``AbstractUser.last_login`` allows null values" section -- if this makes sense:

If you are using a custom user model, you'll need to run :djadmin:`makemigrations` and generate a migration for your app.

aRkadeFR

unread,
Apr 22, 2015, 5:48:07 AM4/22/15
to Tim Graham, django...@googlegroups.com
Indeed this was the problem.

Thanks for your answer and I got it through IRC too.

Have a good day
Reply all
Reply to author
Forward
0 new messages