Django: how to add a master admin link

I would like to add a link /to each page in the template. Can I do this without changing the internal django template? I could configure django, but this is something that I seriously would not want to do.

+5
source share
2 answers

Of course, just override one of the Django admin templates in your own directory templates/admin. For example, copy the contents django/contrib/admin/templates/base.htmlto yourproject/templates/admin/base.html. Then change the latter to your heart content.

See: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

+4
source

. :

  • django/contrib/admin/templates/base_site.html your_project/templates/admin/base_site.html

  • base_site.html ,

  • settings.py

    TEMPLATE_DIRS = ('templates',)

0

All Articles