mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-23 14:29:45 +03:00
making the user object python 2 and 3 friendly
This commit is contained in:
parent
9c74fe4bde
commit
518c5d561a
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user