Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlugRelatedFied many=True can cause UnicodeEncodeError #2290

Closed
stevelacey opened this issue Dec 17, 2014 · 1 comment
Closed

SlugRelatedFied many=True can cause UnicodeEncodeError #2290

stevelacey opened this issue Dec 17, 2014 · 1 comment
Labels
Milestone

Comments

@stevelacey
Copy link

stevelacey commented Dec 17, 2014

I am using SlugRelatedField with many=True, in DRF 3.0.1, on a slug (which isn't really a slug... it's a name) which can contain unicode characters. ManyRelatedField doesn't seem to be able to handle that as it pushes the choices through str() can/should this be changed?

UnicodeEncodeError: 'ascii' codec can't encode character u'\u0161' in position 0: ordinal not in range(128)

rest_framework/relations.py", line 370, in choices

365         return dict([
366             (
367                 str(item_representation),
368                 str(item) + ' - ' + str(item_representation)
369             )
370             for item, item_representation in items_and_representations
371         ])
@tomchristie tomchristie added this to the 3.0.2 Release milestone Dec 17, 2014
@tomchristie
Copy link
Member

tomchristie commented Dec 17, 2014

Now resolved in master. Thank for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants