I have extended the User model, but now the new user model is in an app called "account" which gives all models inside this app the app label "account". The Django model "Groups" still has the app label "Auth", so now models which all has something to do with auth is in separate apps in the admin site. Is it possibly to change the app label for "Groups"?
Asked
Active
Viewed 1,057 times
3 Answers
2
Try this:
from django.db.models.loading import get_models
get_models(django.contrib.auth.models)[1]._meta.app_label = 'group' #or whatever

karthikr
- 97,368
- 26
- 197
- 188
-
1Nice, but is it wise to miss with django's internal models definitions? – Paulo Bu Jun 04 '13 at 19:17
-
1well.. it not "messing" with it, but just editing a field. It is just like updating a setting. – karthikr Jun 04 '13 at 19:18
0
If you need still more flexibility in the admin you could try django-admin-tools. It makes it easy to reorder and group models in different layouts (tabs, collapsible boxes, etc.) and also add dashboard-like features.

UloPe
- 645
- 1
- 7
- 16
0
Just in case anyone needs this in Django 3.0+:
from django.apps import apps
apps.get_model('auth', 'Group')._meta.app_label = 'group' #or whatever, but have to be a registered app
Please not that this will mess with django internal model handling, e.g. generate migrations in contrib.auth sitepackage and so on

NiMeDia
- 995
- 1
- 15
- 27