views:

95

answers:

1

Can a date be loaded into a DateField using Django's loaddata admin feature? I have a JSON file that I'm using to bulk load data into my app. When you dumpdata, date fields are outputted in the format yyyy-mm-dd. However, if you try loading data back in with the same format, the field is treated as a string and the load fails.

For example, I have a field authorization_date of type models.DateField(). When the value of a field is "2001-12-14", I get the following error:

> Warning: Data truncated for column 'authorization_date' at row 1

So how can I load dates using Django's loaddata?

A: 

Sounds like something else is broken, lupefiasco. Django has a pretty extensive set of tests to make sure you can dumpdata -> loaddata just fine.

Sounds like it may be a Ticket#5007 [http://code.djangoproject.com/ticket/5007], but it could just as well be one of many others. The error is after all rather vague. Are you running django-trunk? In that case I first suggest updating the trunk (just in case :)).

Except for that, you'll need to give us more info: what database are you running? Django version?

Actually, I suggest you just take all this information and post to the django-users group, there are probably a lot more devs there who can help you.

pithyless