#12753: Fixture loading can fails on second syncdb when auto_now_add field is
ommitted
---------------------------+------------------------------------------------
Reporter: russellm | Owner: nobody
Status: new | Milestone: 1.2
Component: Serialization | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
---------------------------+------------------------------------------------
Via Andrew Turner, on django-users:
Here is a simple initial_data.json:-
{{{
[
{
"model": "posts.entry",
"pk": 1,
"fields": {
"content": "This is the content"
}
}
]
}}}
And here is my models.py:-
{{{
from django.db import models
class Entry(models.Model):
content = models.CharField(max_length=250)
pub_date = models.DateTimeField(auto_now_add=True, editable=False)
}}}
First time syncdb is run, the fixture is correctly loaded, subsequent
runs result in the aforementioned error. Tested on Django 1.1.1 and
1.2alpha.
----
Comment by russellm:
The initial syncdb shouldn't be succeeding - for some reason, the field is
being populated with a default value generated by the auto_now_add
handling. The second syncdb gives the correct error due to the missing
pub_date data in the fixture.
--
Ticket URL: <http://code.djangoproject.com/ticket/12753>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.