You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers
I was looking through some old tickets, and spotted a case which I had
worked on some time ago. The case is about model instance equality in
different inheritance situations. There are three different cases to
consider (assuming primary keys match):
- should a proxy model be equal to its proxy parent?
- should a inherited model be equal to its parent instance?
- what to do in model multi-inheritance cases.
My take is that proxy models should be equal to their parent
instances, otherwise inherited models should not equal their parent
instances. The reasons for this are backwards compatibility,
performance and achieving correctness for all cases.
I won't go into details of what kind of problems multitable multi-
inheritance causes for achieving correctness. Suffice to say that it
is possible to construct cases where is it very hard to tell if two
models should be equal or not. Refer to ticket #16458 for more
details.
The backwards compatibility issue is in my opinion enough to say "no"
to the multitable-inheritance case. Django has one use in admin which
downright breaks when child models are equal to their parent models.
User code could have similar problems, too.
Writing a patch for proxy model equality is straightforward. Writing a
patch which takes all the corner cases of multitable multi-inheritance
in account is not trivial at all.
So, I propose to go forward with proxy model equality. Doing something
to this long standing issue would be welcome in any case.
For more dirty details, see ticket #16458. Tickets #11892 and #14492
are related.
- Anssi
Daniel Sokolowski
unread,
Jul 16, 2012, 5:44:06 PM7/16/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message