From 5792f7ebad6165b5dc979277afec6a7fa5eadd44 Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Tue, 24 Sep 2013 11:26:43 -0300 Subject: [PATCH] Adding custom user --- src/accounts/models.py | 18 +++++++++++++++++- src/colab/custom_settings.py | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/accounts/models.py b/src/accounts/models.py index 71a8362..7a4edba 100644 --- a/src/accounts/models.py +++ b/src/accounts/models.py @@ -1,3 +1,19 @@ + from django.db import models +from django.contrib.auth.models import AbstractUser + + +class User(AbstractUser): + institution = models.CharField(max_length=128, null=True) + role = models.CharField(max_length=128, null=True) + twitter = models.CharField(max_length=128, null=True) + facebook = models.CharField(max_length=128, null=True) + google_talk = models.EmailField(null=True) + webpage = models.CharField(max_length=256, null=True) + verification_hash = models.CharField(max_length=32, null=True) -# Create your models here. +# We need to have `email` field set as unique but Django does not +# support field overriding (at least not until 1.6). +# The following workaroud allows to change email field to unique +# without having to rewrite all AbstractUser here +User._meta.get_field('email')._unique = True diff --git a/src/colab/custom_settings.py b/src/colab/custom_settings.py index 57ed4a5..6f42a26 100644 --- a/src/colab/custom_settings.py +++ b/src/colab/custom_settings.py @@ -142,6 +142,8 @@ STATICFILES_DIRS = ( STATIC_ROOT = os.path.join(BASE_DIR, '..', 'www', 'static') +AUTH_USER_MODEL = 'accounts.User' + ### Proxy configuration SOCKS_SERVER = None -- libgit2 0.21.2