Monday, July 2, 2012

migration via south for inheritance change -> please help

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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment