changeset 172:fa5346d25dfc

Allow title overriding from the template (typically when url.py is 3rd-party)
author Sylvain Beucler <beuc@beuc.net>
date Thu, 22 Jul 2010 21:27:11 +0200 (2010-07-22)
parents 95cf3d737dbf
children 1c3b185b7ca4
files templates/base.html templates/registration/activate.html templates/registration/activation_complete.html templates/registration/login.html templates/registration/registration_complete.html templates/registration/registration_form.html templates/title.html
diffstat 7 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/templates/base.html
+++ b/templates/base.html
@@ -4,8 +4,8 @@
   <head>
     {% load i18n %}
     <title>
-      {% block title %}{% if title %}{{ title }}{% else %}{% trans 'Welcome' %}{% endif %}
-        [Savannah]{% endblock %}
+      {% include "title.html" %}
+      [Savannah]
     </title>
     <link rel="stylesheet" type="text/css" href="{{STATIC_MEDIA_URL}}savane/css/Savannah.css" />
     <link rel="icon" type="image/png" href="{{STATIC_MEDIA_URL}}savane/images/icon.png" />
@@ -39,14 +39,11 @@
         <ul class="messagelist">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul>
         {% endif %}
 
-	  <h1>{{ title }}</h1>
+	  <h1>{% include "title.html" %}</h1>
 
           {% block content %}
           {% endblock %}
         </div>
-      </div>
-    </div>
-
       </div><!-- end main -->
       <br class="clear" />
     </div><!-- end realbody -->
--- a/templates/registration/activate.html
+++ b/templates/registration/activate.html
@@ -1,6 +1,8 @@
 {% extends "base.html" %}
 {% load i18n %}
 
+{% block title %}Registration{% endblock %}
+
 {% block content %}
 
 {% trans "Your account activation failed." %}
--- a/templates/registration/activation_complete.html
+++ b/templates/registration/activation_complete.html
@@ -1,6 +1,8 @@
 {% extends "base.html" %}
 {% load i18n %}
 
+{% block title %}Registration{% endblock %}
+
 {% block content %}
 
 {% trans "Your account is now active." %}
--- a/templates/registration/login.html
+++ b/templates/registration/login.html
@@ -1,8 +1,8 @@
 {% extends "base.html" %}
 
+{% block title %}Login{% endblock %}
+
 {% block content %}
-Login:
-
 <form action="{% url django.contrib.auth.views.login %}" method="post">{% csrf_token %}
 {{form.as_p}}
 <input type="submit" name="login" value="Login" />
--- a/templates/registration/registration_complete.html
+++ b/templates/registration/registration_complete.html
@@ -1,6 +1,8 @@
 {% extends "base.html" %}
 {% load i18n %}
 
+{% block title %}Registration{% endblock %}
+
 {% block content %}
 
 {% trans "An email containing account-activation information has been sent." %}
--- a/templates/registration/registration_form.html
+++ b/templates/registration/registration_form.html
@@ -1,5 +1,7 @@
 {% extends "base.html" %}
 
+{% block title %}Registration{% endblock %}
+
 {% block content %}
 
 <form action="" method="POST">{% csrf_token %}
new file mode 100644
--- /dev/null
+++ b/templates/title.html
@@ -0,0 +1,3 @@
+{% load i18n %}
+
+{% block title %}{% if title %}{{ title }}{% else %}{% trans 'Welcome' %}{% endif %}{% endblock %}