Allow hashing of ErrorDetail by craiga · Pull Request #5932 · encode/django-rest-framework (original) (raw)
I've assumed that a hash should behave in the same way that ==
does, which feels correct because it's following the principle of least astonishment.
TBH, my client's code which led me to this ticket is breaking my brain. They appear to somehow be getting a field name as an ErrorDetail, which breaks when they effectively do this:
my_error_dict = {
ErrorDetail('field_name'): ErrorDetail('Some validation message.'),
}
Is this something which should happen?
If so, my_error_dict['field_name']
seems reasonable.