Skip to content

Instantly share code, notes, and snippets.

@ceoro9
Created February 2, 2018 21:52
Show Gist options
  • Save ceoro9/7db42ed4ad4496e77037f4b0134bb635 to your computer and use it in GitHub Desktop.
Save ceoro9/7db42ed4ad4496e77037f4b0134bb635 to your computer and use it in GitHub Desktop.
Custom User model with additional fields
# 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