@@ -19,6 +19,7 @@
from django.db import models
from django.db.models import Q
+from django.contrib import auth
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
@@ -84,6 +85,8 @@ def user_name(user):
return u' '.join(names)
return user.username
+auth.models.User.add_to_class('name', user_name)
+
class UserProfile(models.Model):
user = models.OneToOneField(User, unique = True, related_name='profile')
primary_project = models.ForeignKey(Project, null = True, blank = True)
The name is really a poperty of the User. Not always having to retrieve the profile for that makes things simpler. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- patchwork/models.py | 3 +++ 1 file changed, 3 insertions(+)