The str methods of Settings and Subscription returned
bytes when running in python 3 and caused errors because the str function expects
(unicode) strings in python 3.
This pull request fixes the bug.
I made sure It also works for non-ascii translation strings (russian) in python 2 as mentioned in b1e0b23cd7b4e4e.
The commit also fixes problems in python 2 when the username of a user has non-ascii
characters.
This is the code I used to test the bug and bugfix, using the test-project.
# -*- coding: utf-8 -*-
import django.utils.translation
django.utils.translation.activate('ru')
from django.contrib.auth.models import User
u = User.objects.first()
u.username = 'Øystein'
u.save()
from django_nyt.models import Settings, Subscription, Notification
print(Settings.objects.all())
print(Subscription.objects.all())
print(Notification.objects.all())
The str methods of Settings and Subscription returned bytes when running in python 3 and caused errors because the str function expects (unicode) strings in python 3.
This pull request fixes the bug. I made sure It also works for non-ascii translation strings (russian) in python 2 as mentioned in b1e0b23cd7b4e4e.
The commit also fixes problems in python 2 when the username of a user has non-ascii characters.
This is the code I used to test the bug and bugfix, using the test-project.