making the user object python 2 and 3 friendly

This commit is contained in:
Daniel Greenfeld 2015-08-05 18:32:12 -07:00
parent 9c74fe4bde
commit 518c5d561a

View File

@ -4,16 +4,18 @@ from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import models from django.db import models
# from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class User(AbstractUser): class User(AbstractUser):
# First Name and Last Name do not cover name patterns # First Name and Last Name do not cover name patterns
# around the globe. # around the globe.
name = models.CharField("Name of User", blank=True, max_length=255) name = models.CharField(_("Name of User)", blank=True, max_length=255)
def __unicode__(self): def __str__(self):
return self.username return self.username
def get_absolute_url(self): def get_absolute_url(self):