Reputation: 151
I have created and AbstractUser with some fields that I want the User Class to have. But after successfully creating a new User Model, the user table now has the previous columns (the ones which would have been added on migration of the default User Model) and also has the columns which I have added in the Custom User Model.
Is there a way to remove the columns which are added by default?
Here's my models.py
class CustomUser(AbstractUser):
''' SOME UNIQUE FIELDS '''
class Meta:
swappable = 'AUTH_USER_MODEL'
db_table = 'users'
These are the fields that appear even without specifying in the model. How can I get rid of them?
Upvotes: 3
Views: 4889
Reputation: 1860
As you are extending the model AbstractUser
, it has all the fields of that class, https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#extending-django-s-default-user.
If you want a complete custom user, you should extend AbstractBaseUser.
https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#specifying-a-custom-user-model.
Upvotes: 1