Re: [Django] #35488: BaseModelFormSet.validate_unique() raises TypeError unhashable type: 'dict' for JSONFields in a UniqueConstraint (was: Unexpected traceback: A JSONField being in a UniqueConstraint is handled/documented poorly)

4 views
Skip to first unread message

Django

unread,
May 29, 2024, 9:19:47 AM5/29/24
to django-...@googlegroups.com
#35488: BaseModelFormSet.validate_unique() raises TypeError unhashable type: 'dict'
for JSONFields in a UniqueConstraint
-------------------------------------+-------------------------------------
Reporter: Hanne Moa | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 5.0
Severity: Normal | Resolution:
Keywords: unique, | Triage Stage: Accepted
UniqueConstraint, JSONField, json |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* component: Uncategorized => Forms
* stage: Unreviewed => Accepted
* summary:
Unexpected traceback: A JSONField being in a UniqueConstraint is
handled/documented poorly
=>
BaseModelFormSet.validate_unique() raises TypeError unhashable type:
'dict' for JSONFields in a UniqueConstraint
* type: Uncategorized => Bug

Comment:

This is different to #23964 but could be fixed as part of #23964.

> Is it a design decision that JSONFields cannot be unique/in
UniqueConstraints?

No, looks like you have uncovered a bug specific to model formsets 👍
thank you for the report
--
Ticket URL: <https://code.djangoproject.com/ticket/35488#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages