Tuesday, October 21, 2014

Re: Customize admin page title (from tutorial)



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
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. 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/e6341927-9090-4316-b783-9ef682884d1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment