By default, the admin models are grouped by the app, and the app name is in the caption (accounts, auth, etc.). How to override the name in the caption without writing the admin templates?
Asked
Active
Viewed 5,752 times
4 Answers
6
You can easily doing it through the metadata options app_label and db_table
class model_module1(models.model):
[...]
class Meta:
app_label = "Cool module name"
db_table = "module1_model"
class model_module2(models.model):
[...]
class Meta:
app_label = "Cool module name"
db_table = "module2_model"
If you configure tables names correctly you will see how your modules get grouped under the new label in the admin.
Ref: http://docs.djangoproject.com/en/dev/ref/models/options/#app-label

MrM
- 702
- 8
- 12
-
2I just get an error: "Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': 'My App'}' not found." – Nathan Osman Aug 01 '13 at 01:42
-
**This is an incorrect answer!** This only works for a model defined outside of an installed app. – Daniel van Flymen Dec 03 '15 at 19:59
1
This solution works for Django 2:
In apps.py file:
from django.apps import AppConfig
class Config(AppConfig):
name = 'myapp'
verbose_name = 'My App Name'
In settings.py file:
INSTALLED_APPS = [
'myapp.apps.Config',
]

sp1111
- 758
- 8
- 12
0
This may help somewhat. You can change how the apps are grouped, although I don't think you can change the app name:
django-grappelli