From cbc181024f878aedc1fe9ad60d458ef2ea972504 Mon Sep 17 00:00:00 2001 From: elnappo Date: Sat, 6 Dec 2014 12:43:35 +0100 Subject: [PATCH] python3 compatibility for account models --- nsupdate/accounts/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nsupdate/accounts/models.py b/nsupdate/accounts/models.py index 08b3b58..820ea8c 100644 --- a/nsupdate/accounts/models.py +++ b/nsupdate/accounts/models.py @@ -1,6 +1,7 @@ """ models for account-related stuff """ +from __future__ import unicode_literals from django.db import models from django.conf import settings @@ -9,8 +10,10 @@ from django.dispatch import receiver from django.contrib.auth.signals import user_logged_in from django.utils.translation import ugettext_lazy as _ from django.utils.translation import LANGUAGE_SESSION_KEY +from django.utils.encoding import python_2_unicode_compatible +@python_2_unicode_compatible class UserProfile(models.Model): """ stuff we need additionally to what Django stores in User model @@ -21,8 +24,8 @@ class UserProfile(models.Model): default='', blank=True, null=True, verbose_name=_('language')) - def __unicode__(self): - return u"profile for %s" % self.user.__unicode__() + def __str__(self): + return "profile for %s" % self.user class Meta: verbose_name = _('user profile')