1👍
✅
It’s not recommended to modify django’s user model because it complicates things. Instead, you can add a user profile as documented here.
1👍
If you want the profile to show up in the admin side, you can attach the profile as an inline and force it by unregistering the user and then re-registering it. Here’s how I do it:
from django.contrib.auth.models import User
from reversion.admin import VersionAdmin
from profiles.models import Profile
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
class ProfileInline(admin.StackedInline):
model = Profile
fk_name = 'user'
extra = 0
max_num = 1
fieldsets = [
('Company', {'fields': ['company', 'office']}),
('User Information', {'fields': ['role', 'gender', 'phone', 'mobile', 'fax', 'street', 'street2', 'city', 'state', 'zip']}),
('Site Information', {'fields': ['sites']}),
]
class NewUserAdmin(VersionAdmin):
inlines = [ProfileInline, ]
admin.site.unregister(User)
admin.site.register(User, NewUserAdmin)
👤Luke
- [Answered ]-Handlers error in django-piston
- [Answered ]-Creating a new instance of a Custom User Model in Django
- [Answered ]-Adding items to Bootstrap navbar across multiple templates
- [Answered ]-Django – Database image from models
Source:stackexchange.com