On Wed, Oct 12, 2011 at 3:05 AM, bobhaugen <bob.hau...@gmail.com> wrote:
> Replying to myself:  temporary fix for dumpdata: --exclude
> contenttypes --exclude auth.permission

This isn't a temporary fix -- it's the *actual* fix.

> The result now works as a test fixture.
>
> Not sure what to conclude:
> * the fix for issue #7052 does not work?
> * --natural does not fix the IntegrityErrors with contenttypes in test
> fixtures?
> * contenttypes are trouble in test fixtures?

--natural isn't a magic wand that makes the problem described in #7052
go away all by itself -- it's a tool you can use to avoid the
underlying problem.

Contenttypes are automatically created by syncdb. If your fixtures
*also* contain content types, you can potentially get IntegrityErrors
(because in the process of loading the fixture, you can end up with
duplicated content types). If your fixtures contain numeric references
to content types, then there is also confusion as to whether the
numeric references are to the automatically generated primary keys, or
the content type primary keys described in the fixture.

--natural provides a resolution to this problem by saying "I'm going
to use a name, not a number, to refer to content types". You can then
omit content types from your fixture, and rely on the fact that syncdb
has created the content types with a name that can be resolved at the
time the fixture is loaded.

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