I'm sorry, this is a typo, local fields overrides parent fields of course. Look at the patch.
Den onsdag 2 mars 2016 kl. 08:19:23 UTC+1 skrev Aymeric Augustin: > > Hello, > > The “locally declared field gets overriden by parent definition” behavior > shown in your example looks counter-intuitive to me. > > Inheritance means that children inherit and possibly specialize their > parent’s behavior, not that the parent overrides the child. > > Best regards, > > -- > Aymeric. > > On 02 Mar 2016, at 01:57, Joakim Saario <[email protected] <javascript:>> > wrote: > > Hello! > > I'd like to propose another inheritance strategy for django's models. > > Think of it sort of like reversed abstract models > > For example: > > class NormalModel(models.Model): > foo = models.CharField(max_length=10) > bar = models.CharField(max_length=10) > > class CopiedBaseModel(NormalModel): > bar = models.CharField(max_length=2) > buzz = models.CharField(max_length=10) > > class Meta: > copy_from_base = True > > Would be equivalent to: > > class NormalModel(models.Model): > foo = models.CharField(max_length=10) > bar = models.CharField(max_length=10) > > class CopiedBaseModel(NormalModel): > foo = models.CharField(max_length=10) > bar = models.CharField(max_length=10) > buzz = models.CharField(max_length=10) > > My initial use case for this was with django-cms which didn't play well > with > multi-table inheritance when i needed to extend a built in plugin of > theirs. So > I ended copying the whole model instead, which didn't make me too happy. > So I started writing some code for the behaviour I was after. Which was, > ironicly a standard python inheritance. Django only offers part of this > behaviour > through the proxy and abstract models. But neither of them worked for me. > > This is quite easy to implement with some of the current abstract model > logic (see the patch). > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/d4872520-eeb1-49a7-a8f3-aefc23a98346%40googlegroups.com > > <https://groups.google.com/d/msgid/django-developers/d4872520-eeb1-49a7-a8f3-aefc23a98346%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > <django-copy-from-base.diff> > > > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/d95ca003-a45a-4030-b36f-b7b2ffddd9fb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
