Commit 5792f7ebad6165b5dc979277afec6a7fa5eadd44

Authored by Sergio Oliveira
1 parent 1588488d

Adding custom user

src/accounts/models.py
  1 +
1 2 from django.db import models
  3 +from django.contrib.auth.models import AbstractUser
  4 +
  5 +
  6 +class User(AbstractUser):
  7 + institution = models.CharField(max_length=128, null=True)
  8 + role = models.CharField(max_length=128, null=True)
  9 + twitter = models.CharField(max_length=128, null=True)
  10 + facebook = models.CharField(max_length=128, null=True)
  11 + google_talk = models.EmailField(null=True)
  12 + webpage = models.CharField(max_length=256, null=True)
  13 + verification_hash = models.CharField(max_length=32, null=True)
2 14  
3   -# Create your models here.
  15 +# We need to have `email` field set as unique but Django does not
  16 +# support field overriding (at least not until 1.6).
  17 +# The following workaroud allows to change email field to unique
  18 +# without having to rewrite all AbstractUser here
  19 +User._meta.get_field('email')._unique = True
... ...
src/colab/custom_settings.py
... ... @@ -142,6 +142,8 @@ STATICFILES_DIRS = (
142 142  
143 143 STATIC_ROOT = os.path.join(BASE_DIR, '..', 'www', 'static')
144 144  
  145 +AUTH_USER_MODEL = 'accounts.User'
  146 +
145 147  
146 148 ### Proxy configuration
147 149 SOCKS_SERVER = None
... ...