Commit 45e31098 authored by Damien Lespiau's avatar Damien Lespiau
Browse files

models: Monkey patch User to have a name() method



The name is really a poperty of the User. Not always having to retrieve
the profile for that makes things simpler.
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
parent 13f69715
......@@ -20,6 +20,7 @@
from django.db import models
from django.db.models import Q
import django.dispatch
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
......@@ -86,6 +87,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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment