ambv/dj.choices — pull request #8 by supervacuo (2013-11-01 14:54:57+00:00)
Title: Support JSON encoding of ChoiceFields Edit

Python's json module calls `str()` on values which are instances of int (`json/encoder.py`):

```python
426 elif isinstance(o, (int, long)):
426 yield str(o)
```

This commit defines `dj.choices.ChoicesEntry.__str__()` to return `id`, which
gives the expected result when serialising and deserialising. This changes the API slightly in a way that can't be tested easily (`six.text_type` returns `unicode()` on Python 2 and `str()` on Python 3, so expected results differ) so I removed the relevant lines from tests. The documentation didn't refer to `str(ChoicesEntry)` behaviour, so I hope this change is acceptable.