Opened 9 years ago
Closed 9 years ago
#25237 closed Bug (duplicate)
Unable save model in admin with HStoreField field
Reported by: | hongphi | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hey I have a ticket but it closed (https://code.djangoproject.com/ticket/25233#comment:2)
I have input right data: {"1.5": "1.1kg - 2kg", "0.5": "0.5kg - 1kg", "2.5": "2.1 - 3kg"} (has double quotes)
When I saved it in model admin. I have debug and I see that this error appeared in changed_data property forms when django check changed field.
At line 467: if field.has_changed(initial_value, data_value):
- initial_value has type dict (HStoreField): dict: {u'1.5': u'1.1kg - 2kg', u'0.5': u'0.5kg - 1kg', u'2.5': u'2.1 - 3kg'}
- data_value has type unicode: {"1.5": "1.1kg - 2kg", "0.5": "0.5kg - 1kg", "2.5": "2.1 - 3kg"}
when field call has_changed method, it called self.to_python(initial) - initial is initial_value has dict field so when json convert it will be a error.
Attachments (1)
Change History (2)
by , 9 years ago
Attachment: | error_here.png added |
---|
comment:1 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #25215 which will be fixed in the next 1.8.x release.
Error when check changed HStoreField field