On Mon, Jun 9, 2008 at 10:09 PM, Greg Taylor <[EMAIL PROTECTED]> wrote:
>
> Wonderful, I'll be able to test this pretty extensively tonight.
>
> Since I don't think it's documented either way, is there a particular
> procedure I should abide by when dumping/reloading fixtures for the
> parent and child models? In my case, the parent is in one app, and the
> child is another. Do I dumpdata for both of those apps and load them
> in a certain order, or just dump for the child class that inherits
> access to all of the fields and re-load that fixture?

I've just added some docs about this [1]. You will need to dump both
parent class and child class. If they're in separate applications,
that means dumping both applications (or parts of both applications,
as appropriate).

When fixtures are reloaded, all the fixtures you load in a single
loaddata command are loaded inside a single transaction. Referential
integrity (when it's supported by your database) isn't checked until
the end of the transaction, so the order of creation internal to the
transaction doesn't matter. As a result, all the following:

loaddata all_data.json
loaddata parents.json children.json
loaddata children.json parents.json

will all be equivalent.

There is, of course, once caveat to this - if you're using MySQL with
InnoDB tables, all bets are off. InnoDB has referential integrity, but
it doesn't defer to end of transaction, so creation order becomes
important. This is a known bug, but one that is impossible to solve in
a generic fashion at our end - we need MySQL to fix their referential
integrity implementation. MyISAM tables aren't affected - they don't
have any referential integrity, so no checks are ever performed.

[1] http://www.djangoproject.com/documentation/serialization/#inherited-models

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to