Thanks, I'll try and see if i can work out a fix.

On Thu, Mar 26, 2009 at 8:41 AM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:
>
> Ordinarily the order in INSTALLED_APPS _shouldn't_ matter. However,
> this looks like you're hitting a form of #7052.
>
> The problem plays out like this: Certain applications (in particular,
> contenttypes and auth) dynamically create database content
> (permissions, content type identifiers, etc) when they are
> synchronized. When you dump a fixture, those dynamically created
> content types etc are stored in the fixture.
>
> When the test case flushes the database, the application attempts to
> recreate the dynamic data, and then loads the fixture. If the dynamic
> data isn't recreated in the same order as it was to create the data in
> the fixture, you get an error from the database complaining about
> uniqueness in foreign key constraints. This is because during the
> process of loading a fixture, the primary keys for the existing
> dynamic content differs from that in the fixture, so you can end up
> two identical rows of content but with different primary keys -
> leading to a constraint problem.
>
> By changing the order in INSTALLED_APPS, you are modifying the order
> in which the dynamic data is recreated; in your case, it appears that
> by changing the order, you can match the order that already exists in
> your fixture, and the constraint problem doesn't eventuate.
>
> The long term solution here is to fix #7052. In the interim, the
> solution is to either:
>
> 1) Avoid putting dynamic content in your fixtures - this means
> removing auth and contenttype objects from your fixture. This won't
> cause any problems unless you are relying upon links to dynamic
> content objects in your tests. The most common reason for needing such
> links is using generic relations, but there are others.
>
> 2) Generate a new fixture whenever you add an application to your
> project, or add a model to an application in your project. Obviously,
> this is fairly fragile as a solution, but it should work.
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to