0

I'm trying to create a custom auth_users table with Django 1.5 following the intructions here: https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#auth-custom-user

But the code below doesn't seem to be working even though I have set the new columns it should contain.
It still creates the same default table even after dropping the full database and python manage.py syncdb

I have read several documents and that is what I have right now:

models.py

from django.db import models
from django.contrib.auth.models import AbstractBaseUser

    class User(AbstractBaseUser):    
        identifier = models.EmailField(max_length=254)
        first_name = models.CharField(max_length=254)
        last_name  = models.CharField(max_length=254)

        USERNAME_FIELD = 'identifier'
        REQUIRED_FIELDS = ['first_name','last_name']

This models.py is installed in settings.py

settings.py

AUTH_PROFILE_MODEL = 'myaccount.User'

This doesn't make any effect to the table, but it creates a new one called myaccount_user.

What's wrong with that? What should I change in order to modify auth_user table instead of creating a new one?

1 Answers1

0

The error is that should be AUTH_PROFILE_MODEL = 'myaccount.User' instead of AUTH_PROFILE_MODULE = 'myaccount.User'

Also you forgot a bunch of methods in your Model and a USERNAME_FIELD

see a full example of how to build your own CUSTOM USER

Victor Castillo Torres
  • 10,581
  • 7
  • 40
  • 50