9👍
✅
It depends on what you need this for. Generally, verbose_name
is only used within the context of the admin. If that’s what you need to worry about, then you can create a proxy model and then make your user admin use that:
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class CustomUser(User):
class Meta:
proxy = True
app_label = 'auth'
verbose_name = _('My Custom User')
Then, in admin.py:
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from .models import CustomUser
admin.site.unregister(User)
admin.site.register(CustomUser, UserAdmin)
3👍
Since this is the first answer on google when searching for django verbose name I thought I’d correct Chris Pratt’s answer from 2012 to be correct for django 2.0
If you only want to update the model name in the Admin panel you can simply add a Meta class to your user model. Note the slight change from Chris’ answer.
class Meta:
verbose_name = 'My Custom User'
Source:stackexchange.com