Customize admin page title (from tutorial)

65 views
Skip to first unread message

pranee...@gmail.com

unread,
Oct 18, 2014, 8:16:32 AM10/18/14
to django...@googlegroups.com
Hi,
     I am new to django. I am following Django tutorial(part2). I want to know how to customize title of my admin page from "Django administration" to " some Text". Help me......! Thanks in advance..

Andreas Kuhne

unread,
Oct 18, 2014, 11:27:42 AM10/18/14
to django...@googlegroups.com
I don't know if it is possible, but you can do it with the django-grappelli plugin

Med vänliga hälsningar,

Andréas Kühne
Software Development Manager
Suitopia Scandinavia AB

2014-10-18 14:16 GMT+02:00 <pranee...@gmail.com>:
Hi,
     I am new to django. I am following Django tutorial(part2). I want to know how to customize title of my admin page from "Django administration" to " some Text". Help me......! Thanks in advance..

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/80b562f2-6001-4d57-bced-e41ea22e93f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pat Claffey

unread,
Oct 18, 2014, 5:47:34 PM10/18/14
to django...@googlegroups.com
Hi,
yes this is possible.  I have recently done this tutorial and succeeded  in customizing the title.
In my opinion the instructions in this part of the tutorial are hard to understand.  Here is what I did:

1.0 Navigate to the project directory mysite/mysite/ 
2.0 Create a new sub-directory called templates.  You should now have a directory mysite/mysite/templates/
3.0 Create a new sub-directory called admin in the above templates sub-directory.  You should now have a directory mysite/mysite/templates/admin/
4.0 Edit the settings file (mysite/settings.py) and add a TEMPLATE_DIRS setting:
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
5.0 Find the path of the django source files on your system.  
To find this path open the python interpreter; import django and print the value of django.__path__ using the python command print(django.__path__)
6.0 On your file system navigate to the directory path obtained above from django.__path__ variable.  You should see a directory called contrib.  navigate to contrib/admin/templates/admin/
You should see a source file called base_site.html
7.0 Copy the above source file base_site.html into the directory mysite/mysite/templates/admin/.  You should now have a file mysite/mysite/templates/admin/base_site.html
8.0 Edit the above file and replace {{ site_header|default:_('Django administration') }} (including the curly braces) with the new site name.
If the desired new site name is "My Company Name" then you should see 
<h1 id="site-name"><a href="{% url 'admin:index' %}">My Company Name</a></h1>
9.0 Open the admin screen.  You may need to refresh this page.  You should now see that the label at the top of the page has changed.


There are a lot of steps - it is not a simple procedure.
Please let me know if above steps are clear, or if they can be improved.

Regards,
Pat

Russell Keith-Magee

unread,
Oct 18, 2014, 6:12:50 PM10/18/14
to Django Users

Or, if you're using Django 1.7, you can change the site header (amongst other labels) as a configuration item:


Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

Carl Meyer

unread,
Oct 20, 2014, 2:21:44 PM10/20/14
to django...@googlegroups.com
Hi Pat,
I think these instructions are correct, except for the paths. Unless
you've modified the definition of the BASE_DIR setting in the default
Django project template, BASE_DIR will point to the outer workspace
"mysite" directory, not the inner Python package (mysite/mysite). So
you'd want to create `mysite/templates`, not `mysite/mysite/templates`,
to match a TEMPLATE_DIRS setting of `[os.path.join(BASE_DIR, 'templates')]`.

I'm not sure how to explain your success using the above steps. Perhaps
you have `'mysite'` in your INSTALLED_APPS, and thus your templates in
`mysite/mysite/templates` are being picked up by the app-dirs template
loader?

Carl

Pat Claffey

unread,
Oct 21, 2014, 6:08:45 PM10/21/14
to django...@googlegroups.com


On Saturday, October 18, 2014 1:16:32 PM UTC+1, pranee...@gmail.com wrote:
Hi,
     I am new to django. I am following Django tutorial(part2). I want to know how to customize title of my admin page from "Django administration" to " some Text". Help me......! Thanks in advance..

Following Carl's corrections here are the instructions.  There should be two mysite/ directories.  The project directory is the outer  mysite/ directory.
Please let me know it this works for you.
Thanks to Carl for his feedback - hopefully the following is correct.

1.0 Navigate to the project directory mysite/  
2.0 Create a new sub-directory called templates.  You should now have a directory mysite/templates/
3.0 Create a new sub-directory called admin in the above templates sub-directory.  You should now have a directory mysite/templates/admin/
4.0 Edit the settings file (mysite/mysite/settings.py) and add a TEMPLATE_DIRS setting:
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
5.0 Find the path of the django source files on your system.  
To find this path open the python interpreter; import django and print the value of django.__path__ using the python command print(django.__path__)
6.0 On your file system navigate to the directory path obtained above from django.__path__ variable.  You should see a directory called contrib.  navigate to contrib/admin/templates/admin/
You should see a source file called base_site.html
7.0 Copy the above source file base_site.html into the directory mysite/templates/admin/.  You should now have a file mysite/templates/admin/base_site.html
Reply all
Reply to author
Forward
0 new messages