Created
February 2, 2018 21:52
-
-
Save ceoro9/7db42ed4ad4496e77037f4b0134bb635 to your computer and use it in GitHub Desktop.
Custom User model with additional fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models.py (app registration) | |
from django.contrib.auth.models import AbstractUser | |
from django.db import models | |
class CoffeehouseUser(AbstractUser): | |
age = models.IntegerField(blank=True,null=True) | |
telephone = models.CharField(max_length=15,blank=True,null=True) | |
#... | |
# admin.py (app registration) | |
from django.contrib import admin | |
from .models import CoffeehouseUser | |
class CoffeehouseUserAdmin(admin.ModelAdmin): | |
pass | |
admin.site.register(CoffeehouseUser, CoffeehouseUserAdmin) | |
# settings.py | |
AUTH_USER_MODEL = '<model_path>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment