#30333: __hash__ in model is None when __eq__ is defined
-------------------------------------+-------------------------------------
Reporter: akjanik | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 2.2
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In my model, that inherits directly from `models.Model`, I defined my own
`__eq__`:
{{{
class Meta:
ordering = ('pk', )
def __eq__(self, other):
return self.as_data() == other.as_data()
}}}
What was strange, when updating to `2.2`, classes like above (and
instances) do not have `__hash__` defined anymore.
{{{
>>> from myapp.account.models import Address
>>> Address.__hash__ is None
True
>>> import django
>>> django.VERSION
(2, 2, 0, 'final', 0)
}}}
while it was certainly present in `2.1`
{{{
>>> from myapp.account.models import Address
>>> Address.__hash__
<function Model.__hash__ at 0x7f013aee4d08>
>>> import django
>>> django.VERSION
(2, 1, 8, 'final', 0)
}}}
I am not sure if it is intended, as I did not find (or maybe missed)
mentions about it in 2.2 release notes.
--
Ticket URL: <https://code.djangoproject.com/ticket/30333>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.3d925d3d3565dc7183541701933f3e31%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.