Opened 12 years ago
Closed 12 years ago
#19471 closed Uncategorized (worksforme)
base_site.html should actually be base.html at the end of tutorial 2
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | tutorial |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the documentation for tutorial 2 1.4, https://docs.djangoproject.com/en/1.4/intro/tutorial02/, I believe references to base_site.html
need to be adjusted to base.html
.
Now copy the template admin/base_site.html from within the default Django admin template directory in the source code of Django itself (django/contrib/admin/templates) into an admin subdirectory of whichever directory you're using in TEMPLATE_DIRS. For example, if your TEMPLATE_DIRS includes '/home/my_username/mytemplates', as above, then copy django/contrib/admin/templates/admin/base_site.html to /home/my_username/mytemplates/admin/base_site.html. Don't forget that admin subdirectory. Then, just edit the file and replace the generic Django text with your own site's name as you see fit. This template file contains lots of text like {% block branding %} and {{ title }}. The {% and {{ tags are part of Django's template language. When Django renders admin/base_site.html, this template language will be evaluated to produce the final HTML page. Don't worry if you can't make any sense of the template right now -- we'll delve into Django's templating language in Tutorial 3. Note that any of Django's default admin templates can be overridden. To override a template, just do the same thing you did with base_site.html -- copy it from the default directory into your custom directory, and make changes. Astute readers will ask: But if TEMPLATE_DIRS was empty by default, how was Django finding the default admin templates? The answer is that, by default, Django automatically looks for a templates/ subdirectory within each app package, for use as a fallback. See the template loader documentation for full information.
In my install of Django 1.4.3, the file was base.html, not base_site.html.
base_site.html includes the following:
{% extends "admin/base.html" %} {% load i18n %} {% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %} {% block branding %} <h1 id="site-name">{% trans 'Django administration' %}</h1> {% endblock %} {% block nav-global %}{% endblock %}
Which does not match the description provided in the documentation.
Note:
See TracTickets
for help on using tickets.
The reference to
base_site.html
is correct, that is the name of the file and it is included in Django 1.4.3: