By the way, if you do that, and I'm not crazy, you won't need to do any
migration with south, since the Foo and Bar tables would both have all of
base's columns (because Base is abstract).

If Base can't be abstract (if you want Base instances that are neither Foo
nor Bar), then you'll have to do this:

First, create the Base class, without changing Foo or Bar. Create a south
migration for this

Second, create a south Data Migration, copy all the data over on that
migration from Foo and Bar to Base instances

Third, modify Foo and Bar, and create migrations for this

On Wed, Jul 4, 2012 at 5:29 PM, Tomas Neme <lacrymol...@gmail.com> wrote:

> You'll have to migrate your data manually in your migration, yes.
>
> Besides that, if you don't want actual Base instances, then this is an
> abstract class, and you should do this:
>
> class Base(models.Model):
>     eggs....
>     plants....
>     class Meta:
>         abstract=True
>
> class Foo(Base):
>     carpet=....
>
> class Bar(Base):
>     car=....
>
>
> On Wed, Jul 4, 2012 at 5:18 PM, Lachlan Musicman <data...@gmail.com>
> wrote:
> > 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.
> >
>
>
>
> --
> "The whole of Japan is pure invention. There is no such country, there are
> no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>



-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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