I finally realized that simply inheriting a model will not work like I
expected. For example:
from django.core import validators
from django.contrib.auth.models import User as OldUser
from django.db import models
class User(OldUser):
def __init__(self, *args, **kwargs):
super(User,
> It does work. However the "email" field of User should be set to
> "blank=False" and "unique=True" if we really want to use email as the
> unique userid. How can we override the default field definition of
> User.email?
You can add unique constraint on email column on database level,
Django w
On Mon, 2007-03-26 at 16:25 +, John Lee wrote:
> It does work. However the "email" field of User should be set to
> "blank=False" and "unique=True" if we really want to use email as the
> unique userid. How can we override the default field definition of
> User.email?
You cannot override an
It does work. However the "email" field of User should be set to
"blank=False" and "unique=True" if we really want to use email as the
unique userid. How can we override the default field definition of
User.email?
I tried something like this:
from django.contrib.auth.models import User as OldU
Create your own authentication backend that uses emails instead of
usernames. Something like:
from django.contrib.auth.models import User
class BasicBackend:
def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
I'm re-engineering an existing directory application to use
Django. The application uses email addresses as the primary unique
userid. My understanding is that to map this to the Django User model
this needs to become the username. Unfortunately email addresses are
often longer than 30 charact
6 matches
Mail list logo