The way Model.__eq__ works currently should be improved. There is one definite bug in __eq__, that is deferred instances aren't never equal to non-deferred instances with same PK. There are also two possible improvements: make proxy models equal to their concrete parents (this also fixes deferred __eq__) and make multitable inherited models equal to their parents.
There are a couple of tickets about these issues: https://code.djangoproject.com/ticket/11892, https://code.djangoproject.com/ticket/16458 and https://code.djangoproject.com/ticket/14492 A patch for proxy equality is available at https://github.com/akaariai/django/tree/model_eq_proxy and for model inheritance equality at https://github.com/akaariai/django/tree/model_eq_inherit. I think proxy equality is the right way to go. The reason is backwards compatibility. A proxy model always represents the same data as its parent, so change in proxy equality seems somewhat safe. This is not true for multitable inheritance equality. For one breakage caused by inheritance equality see the admin_views tests in model_eq_inherit branch. It seems pretty much impossible to have a deprecation period for this change. So, I am planning to go forward with the model_eq_proxy branch. Any comments or objections? Is even proxy equality too big of a change from backwards compatibility perspective? - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" 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 http://groups.google.com/group/django-developers. For more options, visit https://groups.google.com/groups/opt_out.
