You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When correcting the deprecation of SubFieldBase (just removed it and added from_db_value, works sort of) all is OK except a new unexpected behavior from QuerySet and values_list.
Prior to this doing values_list(...) on the query set returned something like: [u'L', u'J', u'L' ] but now it returns [([u'L'],), ([u'J'],), ([u'L'],)]
this is obviously as the to_python returns a list (which is correct), but still, not sure why this ever worked in first place and how this can be changed now (on what level to override this to keep old behavioural).
Secondly the .values_list on a multiselectfield is also open for possible interpretations, should it list values used or combination of values use ;-) but this is my problem...
This is a known Django bug #9619, and only happens for Django 1.6 and 1.7.
The workaround is to manually call .split(',') on the returned result.
Because there really isn't a clean way to handle this, and it's fixed in Django 1.8+, I'm not going to spend any development time fixing this. I have updated the documentation to shine light on this bug and will be publishing that soon though.
If somebody has time to create a QuerySet mixin that fixes this, I would adjusts the tests and accept that PR.
When correcting the deprecation of SubFieldBase (just removed it and added
from_db_value
, works sort of) all is OK except a new unexpected behavior from QuerySet andvalues_list
.Prior to this doing
values_list(...)
on the query set returned something like:[u'L', u'J', u'L' ]
but now it returns[([u'L'],), ([u'J'],), ([u'L'],)]
this is obviously as the
to_python
returns a list (which is correct), but still, not sure why this ever worked in first place and how this can be changed now (on what level to override this to keep old behavioural).Secondly the
.values_list
on a multiselectfield is also open for possible interpretations, should it list values used or combination of values use ;-) but this is my problem...Edit (by blag): Formatted with GFM
The text was updated successfully, but these errors were encountered: