﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7202	fixture loading fails for one-to-one relations	zhaoz	nobody	"Models created with one-to-one relation as [http://www.djangoproject.com/documentation/model-api/#multi-table-inheritance documented] fail to produce loadable fixtures.

Fixtures created with dumpdata and then reloaded with loaddata fail with this error:
{{{
ERROR:  duplicate key violates unique constraint ""App_model_pkey""
}}}

Tested with dumpdata using json on postgresql.


-----

=== Also tested on sqlite ===

''' Models: '''
{{{
from django.db import models

# Create your models here.
class Parent(models.Model):
    name = models.CharField(max_length=60, unique=True)

class Child(Parent):
    parent = models.OneToOneField(Parent, parent_link=True)
    number = models.IntegerField(max_length=20)
}}}

''' Dumpdata '''
{{{
$ ./manage.py dumpdata --format=json first > first/fixtures/test.json
$ cat first/fixtures/test.json
[{""pk"": 1, ""model"": ""first.parent"", ""fields"": {""name"": ""first1""}}, {""pk"": 1, ""model"": ""first.child"", ""fields"": {""name"": ""first1"", ""number"": 2}}]
$ ./manage.py loaddata test
Installing json fixture 'test' from '/home/zhaoz/programming/python/django_test/onetoone/../onetoone/first/fixtures'.
Problem installing fixture '/home/zhaoz/programming/python/django_test/onetoone/../onetoone/first/fixtures/test.json': column name is not unique
}}}

"		closed	Core (Serialization)	dev		fixed		zilingzhao@…	Unreviewed	1	0	0	1	0	0
