﻿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
11429	initial_data in syncdb not working with proxy models	Anssi Kääriäinen	nobody	"I have the following in testapp/models.py:

{{{
class Test(models.Model):
    field1 = models.CharField(max_length=20)

class TestProxy(Test):
    class Meta:
        proxy = True
}}}

The problem is the proxy model will cause loss of the field1 value when running dumpdata & syncdb. This is best demonstrated by running python manage.py shell and following commands:

{{{

from testapp.models import Test
t1 = Test(field1='foo')
t1.save()
t1 = TestExtending.objects.all()[0]
t1.field1
Out: u'foo'
}}}

All good so far. Now when I run 

python manage.py dumpdata testapp > initial_data.json 

and then 

python manage.py syncdb

and then in python manage.py shell:
{{{
from testapp.models import Test
t1 = Test.objects.get()
t1.field1
Out: u''
}}}

The problem is the Test instance is serialized twice to the initial_data.json, once for the Test model with correct field1 value, and once for the TestProxy without any values. Here is the json ouput:

{{{
[{""pk"": 1, ""model"": ""testapp.test"", ""fields"": {""field1"": ""foo""}}, {""pk"": 1, ""model"": ""testapp.testproxy"", ""fields"": {}}]
}}}

I am using Django version 1.1 beta 1 SVN-11196

"		closed	Uncategorized	dev		duplicate			Unreviewed	0	0	0	0	0	0
