I'm not a South expert, but I'd assume you'd do this via south data
migrations
(http://south.readthedocs.org/en/latest/tutorial/part3.html#data-migrations)
.

You'd create:
- One (auto) migration script to create the Base table and new columns in
Foo and Bar
- A data migration script to migrate the current data set from Foo and Bar
into Base and fill in the OneToOneField keys accordingly
- A final (auto) migration script to remove the transferred fields from Foo
and Bar

-----Original Message-----
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
On Behalf Of Lachlan Musicman
Sent: Wednesday, July 04, 2012 1:18 PM
To: django-users@googlegroups.com
Subject: Re: migration via south for inheritance change -> please help

I'd like to know this too - but I think the real answer is "get better at
python" - you are essentially (from what I can tell) in a django shell when
south pops the "not blank, not null but no data" error - try pulling in some
details from fixtures?

cheers
L.

On Thu, Jul 5, 2012 at 2:30 AM, Daniel Walz <mcj...@gmail.com> wrote:
> ...no one?
>
> regards, mcJack
>
> 2012/7/2 mcJack <mcj...@gmail.com>:
>> Hi all,
>>
>> I've got a problem migrating some changes in the model, so I tried to 
>> solve it with south.
>> The situation:
>> I implemented two classes, which share some functionality. Now that I 
>> improved a little with python, django and co. I wanted to use 
>> inheritance for that issue.
>> The model looks like this:
>>
>> class Foo(models.Model):
>>     eggs = models.TextField( null=True, blank=True )
>>     plants = models.TextField( null=True, blank=True )
>>     carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>>     eggs = models.TextField( null=True, blank=True )
>>     plants = models.TextField( null=True, blank=True )
>>     car = models.IntegerField()
>>
>>
>> And obviously I want to transform to:
>> class Base(models.Model):
>>     eggs = models.TextField( null=True, blank=True )
>>     plants = models.TextField( null=True, blank=True )
>>
>> class Foo(models.Model):
>>     base = models.OneToOneField( 'Base', parent_link=True )
>>     carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>>     base = models.OneToOneField( 'Base', parent_link=True )
>>     car = models.IntegerField()
>>
>> But how can I tell south to fill the super class with the data from 
>> the old schema?
>>
>> Can I add this information manually in the created migration script? 
>> or is there an option/switch I didn't notice?
>>
>> Any hints are very welcome, thanks a lot
>>
>> mcJack
>>
>> --
>> You received this message because you are subscribed to the Google 
>> Groups "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/_6CYJ1yqh-sJ.
>> 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.
>
>
>
> --
> Daniel Walz - mcj...@gmail.com
> Bremen, Germany
>
> --
> 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.
>

--
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.


-- 
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