Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify the app name in Django admin's urls?

Tags:

url

django

admin

In a Django app the urls of the admin contains the app name, ex:

http://my.domain.com/admin/myapp/mymodel

How can I replace myapp by another string (without modifying the actual app name of course)?

EDIT

My db already exists, so I can't use app_label in my models' META. I just want to modify the app name displayed in the admin urls and the admin pages.

like image 451
jul Avatar asked Nov 26 '25 04:11

jul


1 Answers

One way is to set app_label on each model of your app by defining an abstract model, like it's done here. If you have an existing database, as a workaround, you can override db_table on each model as suggested here.

Another option is to use awesome django-admin-tools module, that is very powerful at customizing your admin site. You can define your own DashboardModule and customize links as you want.

Also see:

  • Can you give a Django app a verbose name for use throughout the admin?

Hope that helps.

like image 50
alecxe Avatar answered Nov 27 '25 17:11

alecxe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!