#30337: Django Admin - Migrations: default value for models.DateTime() with
auto_add_now=True
--------------------------------+--------------------------------------
Reporter: Jilles Soeters | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by felixxm):
* status: new => closed
* resolution: => worksforme
* version: 2.2 => master
* component: Uncategorized => Migrations
Comment:
Migration works as expected in a described use case. When you leave
`timezone.now` as a default value then it will be added to a new
migration:
{{{
operations = [
migrations.AddField(
....
field=models.DateTimeField(auto_now_add=True,
default=django.utils.timezone.now),
)
]
}}}
and a new field in all existing rows will be filled by `timezone.now()`.
Please use one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels], if you need further support.
--
Ticket URL: <https://code.djangoproject.com/ticket/30337#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.88fed23ba56f2f8f6fc92098e9cfae42%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.