Created
May 15, 2018 05:58
-
-
Save tnir/652de5d44b56950e7a8db350563db60b to your computer and use it in GitHub Desktop.
Django 2.0へのアップデート (Removed support for bytestrings編) ref: https://qiita.com/tnir/items/27a9ecd20c7c7f2e9aee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from polls.models import Choice | |
>>> bytes_text = some_func() # => b'Just hacking' | |
>>> Choice(choice_text=str(bytes_text)).save() | |
>>> Choice.objects.filter(choice_text=bytes_text) # => NG | |
<QuerySet []> | |
>>> Choice.objects.filter(choice_text=bytes_text.decode()) # => OK | |
<QuerySet [<Choice: Just hacking>]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python manage.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -bb manage.py test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment