I would also throw this ticket into the mix - https://code.djangoproject.com/ticket/11154, it's related and has bit me in the past.

-----Original Message----- From: Anssi Kääriäinen
Sent: Monday, July 16, 2012 3:07 PM
To: Django developers
Subject: Model equality in inheritance cases

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

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.


Daniel Sokolowski
Web Engineer
Danols Web Engineering
http://webdesign.danols.com/
--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to