tomwalker/django_quiz — pull request #27 by zamphatta (2014-11-21 23:59:07+00:00)
Title: Python 3 Compatibility

Added code to the models.py files, to make everything run as smooth in Python 3 as it does in Python 2. In short, this basically means these changes occurred:

1. add 2 imports -
* `from __future__ import unicode_literals`
* `from django.utils.encoding import python_2_unicode_compatible`
2. changed `__unicode__()` to `__str__()` and added `@python_2_unicode_compatible` decorator to classes that use `__str__()`
4. remove u's at start of strings, 'cause it's no longer needed with the import's
5. replaced `unicode()` with `str()`, except in `__str__()`, 'cause it was just cleaner to remove it entirely since it doesn't seem to be needed there.

For more details on these changes, see https://docs.djangoproject.com/en/1.7/topics/python3/