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

Some unicode problem #14

Open
Andertaker opened this issue Feb 18, 2016 · 1 comment
Open

Some unicode problem #14

Andertaker opened this issue Feb 18, 2016 · 1 comment

Comments

@Andertaker
Copy link

https://github.com/ramusus/django-vkontakte-api/blob/master/vkontakte_api/models.py#L450

Этот код

from vkontakte_places.models import City
city = {u'id': 2566, u'title': u'\u0422\u043e\u0440\u0435\u0446\u043a (\u0431\u044b\u0432\u0448. \u0414\u0437\u0435\u0440\u0436\u0438\u043d\u0441\u043a)'}
City.objects.get_or_create(remote_id=city['id'], name=city['title'])

вызывает ошибку
'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
если этот город уже существует (прогнать код дважды)

@ramusus
Copy link
Owner

ramusus commented Feb 18, 2016

вообще нужно делать так

City.objects.get_or_create(remote_id=city['id'], defaults={'name': city['title']})

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

No branches or pull requests

2 participants