python3 compatibility for account models

This commit is contained in:
elnappo 2014-12-06 12:43:35 +01:00
parent ca34ca3e0d
commit cbc181024f
No known key found for this signature in database
GPG Key ID: 3AAF323515F3F056

View File

@ -1,6 +1,7 @@
""" """
models for account-related stuff models for account-related stuff
""" """
from __future__ import unicode_literals
from django.db import models from django.db import models
from django.conf import settings 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.contrib.auth.signals import user_logged_in
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import LANGUAGE_SESSION_KEY 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): class UserProfile(models.Model):
""" """
stuff we need additionally to what Django stores in User 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, default='', blank=True, null=True,
verbose_name=_('language')) verbose_name=_('language'))
def __unicode__(self): def __str__(self):
return u"profile for %s" % self.user.__unicode__() return "profile for %s" % self.user
class Meta: class Meta:
verbose_name = _('user profile') verbose_name = _('user profile')