0

I only seem to find answers around changing the actual link of VISIT PAGE. How however can I change the verbose name to e.g. HOMEPAGE?
Below code only changes the actual link:

class AdminSite:
    admin.site.site_url = "/hompeage"

What I'd like to achieve: enter image description here

I'm looking to achieve this in the admin.py file of my application.

Aaron Scheib
  • 358
  • 4
  • 18

1 Answers1

1

I haven't personally tried any ways, but looking the code

You can do it in two ways,

  1. Override the base.html template on admin.

    See: Django Github base.html

    <a href="{{ site_url }}">{% translate 'View site' %}</a>
    

    to

    <a href="{{ site_url }}">HomePage</a>
    
  2. If you look the code, it uses translation for

     <a href="{{ site_url }}">{% translate 'View site' %}</a>
    

    You can simply, override the locale string too.

    See: Django Github en locale

ShrAwan Poudel
  • 164
  • 1
  • 8
  • if I understand this correctly I would need to change the HTML on the library level. This is however not what I'd like to do as this will not stay in place when deploying the application as the module is installed during that process. – Aaron Scheib Mar 29 '20 at 16:54
  • No you do not need to change HTML on library level, you can override it using Template overriding technique in django [Django Overriding Templates](https://docs.djangoproject.com/en/2.2/howto/overriding-templates/) – ShrAwan Poudel Mar 30 '20 at 05:27
  • So in the templates folder of the project I added the directory "admin" and added the whole [base.html](https://github.com/django/django/blob/stable/2.0.x/django/contrib/admin/templates/admin/base.html#L40) file to it and changed the text in the highlighted line to get it done. – Aaron Scheib Mar 30 '20 at 08:51