[Django] #25237: Unable save model in admin with HStoreField field

11 views
Skip to first unread message

Django

unread,
Aug 6, 2015, 12:25:55 PM8/6/15
to django-...@googlegroups.com
#25237: Unable save model in admin with HStoreField field
-------------------------------+--------------------
Reporter: hongphi | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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.

[[Image(http://farm1.staticflickr.com/423/19724875904_61e070e917_b.jpg)]]
[[Image(http://farm1.staticflickr.com/304/20353621961_327c906000_b.jpg)]]
[[Image(http://farm1.staticflickr.com/353/20339060352_e99e6eb938_b.jpg)]]

--
Ticket URL: <https://code.djangoproject.com/ticket/25237>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 6, 2015, 12:29:43 PM8/6/15
to django-...@googlegroups.com
#25237: Unable save model in admin with HStoreField field
---------------------------+----------------------------

Reporter: hongphi | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------+----------------------------
Changes (by hongphi):

* Attachment "error_here.png" added.

Error when check changed HStoreField field

Django

unread,
Aug 6, 2015, 12:43:34 PM8/6/15
to django-...@googlegroups.com
#25237: Unable save model in admin with HStoreField field
-------------------------------+--------------------------------------
Reporter: hongphi | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by charettes):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0


Comment:

Duplicate of #25215 which will be fixed in the next 1.8.x release.

--
Ticket URL: <https://code.djangoproject.com/ticket/25237#comment:1>

Reply all
Reply to author
Forward
0 new messages