#34114: loading fixtures (loaddata) doesn't seem to honour auto_now_add=True
when
these values are missing
-------------------------------------+-------------------------------------
Reporter: rbosch | Owner: nobody
Type: Bug | Status: new
Component: | Version: 4.1
Uncategorized | Keywords: fixtures loaddata
Severity: Normal | yaml
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In my model I have a model with a DateTime field (models.DateTimeField)
defined as follows:
{{{
class MyModal(models.Model):
key = models.CharField(max_length=20, blank=False, null=False)
created_at = models.DateTimeField(blank=False, null=False,
auto_now_add=True)
}}}
When loading the data via the fixtures and ''omitting'' the created_at
field, I would assume created_at will be set to ''now''
I'm getting a error:
{{{
Could not load app.MyModal(pk=None): (1048, "Column 'created_at' cannot be
null")
}}}
YAML:
{{{
- model: app.mymodal
fields:
key: some text value
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34114>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070184094594bc-8d445284-b932-4fb4-a5b7-d47130d50a54-000000%40eu-central-1.amazonses.com.