Wednesday, April 22, 2015

Re: django contrib auth last_login cannot be "null"

Indeed this was the problem.

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

Have a good day

On 04/21/2015 07:13 PM, Tim Graham wrote:
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.

On Tuesday, April 21, 2015 at 12:27:57 PM UTC-4, aRkadeFR wrote:
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

No comments:

Post a Comment