invalit format for join_date when I ran a migration

10 views
Skip to first unread message

Alejandro Hernández Noguera

unread,
Mar 1, 2023, 11:00:53 AM3/1/23
to Django users
Hi, I'm trying to run the command 'python manage.py migrate auth' but im getting this error 'django.db.utils.OperationalError: (1067, "Invalid default value for 'date_joined'")'.

I'm using Django 3.2.9 and MySQL 8.0.32-0ubuntu0.22.04.2. I changed the sql config altering the sql_mode variable but I'm getting the same error.

The declaration of the field date_joined is the default of django instalation

date_joined = models.DateTimeField(_('date joined'), default=timezone.now)

Michael Starr

unread,
Mar 1, 2023, 3:38:32 PM3/1/23
to Django users
Does it work if you delete the default=timezone.now completely?
Michael

Michael Starr

unread,
Mar 1, 2023, 3:38:44 PM3/1/23
to Django users
And then try re-adding it if it works then.
Michael
Reply all
Reply to author
Forward
0 new messages