There doesn't appear to be a way to load fixtures from JSON (using Postgres 
- works fine in sqlite3) for the following models:


class Collection(models.Model):
    main_thing = models.OneToOneField(
        'things.Thing',
        null=True,
        on_delete=models.SET_NULL
    )

class Thing(models.Model):
    collection = models.ForeignKey(
        'collections.Collection'
    )


Here is the exception:

Problem installing fixture 'my_fixture.json': Could not load 
collections.Collection(pk=1): insert or update on table 
"collections_collection" violates foreign key constraint 
"main_thing_id_refs_id_3a4d3fef"
DETAIL:  Key (main_thing_id)=(1) is not present in table "things_thing".

I'm not sure if the issue is due to the unique constraint implied by a 
OneToOneField, or if it's just related to this issue: 
https://code.djangoproject.com/ticket/3615 (seems like that ticket and 
related ones have been closed for years, so possibly not related).

Any thoughts?

Note: I'm using @1.6a1

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to