Hi Joakim,
You seem to be taking the very view that inheritance means nothing but reuse
of definitions. This view, however, is not accepted in any principled approach
to OOP that I'm aware of.
On Thursday 03 March 2016 19:58:30 Joakim Saario wrote:
> Yes, Child would be "unrelated" in the sense
Yes, Child would be "unrelated" in the sense that it doesn't have any
connections to its parent
other than the fields. Is the problem that this uses the inheritance
semantics?
Python doesn't offer a mechanism for accessing parent objects or vice
versa, this is something you
will have to impleme
Hi Joakim,
On 03 Mar 2016, at 11:03, Joakim Saario wrote:
> The problem is that django hijacks the class-inheritance feature of python
> and uses it soley
> for relational inheritance.
I understand that you would like each model class to have its own table with
all its fields,
whether they’r
I'm aware that the name of the Meta-option isn't the best (it was just a
working name for me)
or that it should be implemented like a Meta-option at all.
While this may be counter-intuitive from the ORM-perspective, it isn't
counter-intuitive at all
from the regular python-programmer's perspect
Now I understand — you want to inherit from a concrete model but to use a
separate table.
I’m not sure how widely applicable this would be. I find it counter-intuitive
that Parent.objects.all() isn’t a superset of Child.objects.all() anymore. This
is a surprising way to implement inheritance.
Yes it is true the p*atch* do include some code for overriding
*parent fields, but that is not the main feature.In any way this thread is
a double post (I thought the first one go*t lost). Look at:
https://groups.google.com/forum/?hl=sv#!topic/django-developers/koRZDDCQREc
instead.
Den onsdag
In that case, I believe this is the ticket you’re looking for:
https://code.djangoproject.com/ticket/24305
There seems to be some activity on the related PR:
https://github.com/django/django/pull/5122
You may want to review these discussions and see how you can help. Thanks!
--
Aymeric.
> On
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
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.
>
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):
10 matches
Mail list logo