#28951: loaddata from fixture doesn't work with null=False auto_now_add fields
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
infintesimal |
Type: | Status: new
Uncategorized |
Component: | Version: 2.0
Uncategorized | Keywords: loaddata
Severity: Normal | auto_now_add fixtures
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
for a model
from django.db import models
{{{
class Foo(models.Model):
name = models.TextField(max_length=256,null=False)
created = models.DateTimeField(auto_now_add=True,null=False)
}}}
and a fixture file foo_data.json
{{{
[
{
"model": "app.Foo",
"pk": 1,
"fields": {
"name": "Foo is fun"
}
}
]
}}}
{{{
./manage.py load_data fixtures/foo_data.json
}}}
fails, as expected because the fixture is loaded as raw.
This is annoying however to mock up a fixture file (especially a long one
used for exercising hundreds of test cases) with manufactured timestamps.
What are the benefits/drawbacks of modifying the loaddata routine to
respect the creation of auto_now_add values, and possibly auto_now values?
--
Ticket URL: <https://code.djangoproject.com/ticket/28951>
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/055.bb11af2517d1d2cd84276fe2b84b9c87%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.