57
Yes, you can do it simply
in your apps.py file from your app folder change the verbose_name attribute from your config class. For example:
from django.apps import AppConfig
class FrontendConfig(AppConfig):
name = 'frontend'
verbose_name = "Your Home Page"
I test it and works in Django 1.10
UPDATE:
In Django 3+ you should add this in your __init__.py
file (from your app)
default_app_config = 'frontend.apps.FrontendConfig'
16
In stars/app.py
from django.apps import AppConfig
class RequestsConfig(AppConfig):
name = 'stars'
verbose_name = "Star of India"
in stars/init.py
default_app_config = 'stars.apps.RequestsConfig'
To access the app name in custom menu methods you can try to get that from
model._meta.app_config.verbose_name
Check the Django Doc for reference https://docs.djangoproject.com/en/1.11/ref/applications/#for-application-users
- [Django]-How to filter a django queryset using an array on a field like SQL's "IN"?
- [Django]-Overriding AppConfig.ready()
- [Django]-How does django handle multiple memcached servers?
7
I am late but just to add an additional step to the solution explained by @FACode.
From the offical docs:
In frontend/apps.py
from django.apps import AppConfig
class FrontendConfig(AppConfig):
name = 'frontend'
verbose_name = "Your Home Page"
In app/settings.py
INSTALLED_APPS = [
'frontend.apps.FrontendConfig',
# ...
]
- [Django]-Django DateField default options
- [Django]-Django Pass Multiple Models to one Template
- [Django]-Possible to host a django site on github pages?
7
apps.py
from django.apps import AppConfig
class FrontendConfig(AppConfig):
name = 'frontend'
verbose_name = "Your Home Page"
__ init__.py
default_app_config = 'frontend.apps.FrontendConfig'
- [Django]-Celery discover tasks in files with other filenames
- [Django]-Foreign key from one app into another in Django
- [Django]-Creating a model and related models with Inline formsets
4
1.Try to add app_label to your model that will be registered in Admin.
class MyModel(models.Model):
pass
class Meta:
app_label = 'My APP name'
UPDATE:
2. Steps to rename app(folders):
- Rename the folder which is in your project root
- Change any references to your app in their dependencies, i.e. the appβs views, the urls.py and settings.py files.
- Edit the database table django_content_type with the following command: UPDATE django_content_type SET app_label=β WHERE app_label=β
- Also if you have models, you will have to rename the model tables. For postgres use ALTER TABLE _modelName RENAME TO _modelName.
For renaming models, youβll need to change django_content_type.name
Note: If your models.py βs Meta Class has app_name listed, make sure to rename that too.
- [Django]-Homepage login form Django
- [Django]-Django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. (django 2.0.1)(Python 3.6)
- [Django]-Silence tqdm's output while running tests or running the code via cron
3
For example, if app name is store
, then add verbose_name with my store
to store/apps.py
as shown below:
# "store/apps.py"
from django.apps import AppConfig
class StoreConfig(AppConfig):
name = 'store'
verbose_name = "my store" # Here
Then, add the code below to "store/init.py":
# "store/__init__.py"
default_app_config = 'store.apps.StoreConfig'
Now, the app name store
is changed to my store
as shown below:
- [Django]-Django rest framework change primary key to use a unqiue field
- [Django]-Include intermediary (through model) in responses in Django Rest Framework
- [Django]-Multithreading for Python Django
2
It sounds like you are trying to change how the appname is listed within the Django Admin? This wasnβt possible before Django 1.7, but now you can do it like this:
https://docs.djangoproject.com/en/1.7/ref/applications/#for-application-users
- [Django]-How to select_related when using .get() in django?
- [Django]-How do I convert a Django QuerySet into list of dicts?
- [Django]-ValueError: Dependency on app with no migrations: customuser
2
In apps.py
from django.apps import AppConfig
class AccountConfig(AppConfig):
name = 'app name'
verbose_name = "new app name"
- [Django]-Access Django model's fields using a string instead of dot syntax?
- [Django]-Default filter in Django model
- [Django]-Django β Can't get static CSS files to load
1
In Django 2 we can use verbose_name in apps.py but we have to specify the CLass Config in init.py
- [Django]-How to disable Django's invalid HTTP_HOST error?
- [Django]-Folder Structure for Python Django-REST-framework and Angularjs
- [Django]-Run custom admin command from view
0
in django 3.0+ you just need to change the folder name and inside the apps.py change the "name" inside the "(appname)Config" class to the new name.
- [Django]-How do i debug/breakpoint my django app using pycharm?
- [Django]-What is choice_set in this Django app tutorial?
- [Django]-Reverse for '*' with arguments '()' and keyword arguments '{}' not found