9

I'm currently working on a project that uses django-registration and Django CMS. When display the pages that implement django-registration my page titles do not render.

Currently have <title>{% page_attribute page_title %}</title> in base.html which all my templates inherit from.

In the pages that do not use django-registration the titles display just fine, but django-registration display as <title></title>

My pages are all created within the CMS and everything else is rendering correctly. If I set the title explicitly within the template, the title will render, but I'd rather have it set within the CMS.

The relevant portion of registration_form.html is below:

{% extends "base.html" %}
{% load cms_tags %}
{% load i18n %}
{% block "html_headers" %}
   <!-- conditional stuff here -->
  <link href="/media/css/forms.css" rel="stylesheet" type="text/css" />
{% endblock %}

Thanks!

elke_wtf
  • 887
  • 1
  • 14
  • 30

1 Answers1

16

the {% page_attribute %} template tag only works on CMS pages. When in views controlled by django-registration, they will not work and rather return an empty string (since Django's template language should never raise exceptions on runtime). In the templates used by django-registration, you need to override the title tag.

Therefore I suggest you use <title>{% block title %}{% page_attribute page_title %}{% endblock %}</title> in your base template. Then in the registration template do something like {% block title %}Registration{% endblock %}.

ojii
  • 4,729
  • 2
  • 23
  • 34
  • Okay, I thought I might have to put it right into the template, was hoping I'd be able to set it from the page. Is there any way possible to set it from the page? – elke_wtf Apr 10 '12 at 15:10
  • One more question then with regards to using other templates within this context. Does that mean other items like placeholders and the like will also not work? – elke_wtf Apr 10 '12 at 15:58