Dango CMS Page Title Does Not Display

I am currently working on a project that uses django-registration and Django CMS. When displaying pages on which django registration is performed, page names are not displayed.

There is currently a <title>{% page_attribute page_title %}</title> in base.html that inherits all my templates.

On pages that do not use django-registration, titles are displayed very well, but django-registration appears as <title></title>

My pages are created in CMS, and everything else is correct. If I set the title explicitly inside the template, the title will display it, but I would prefer it to be installed in the CMS.

The relevant part 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!

+6
source share
1 answer

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

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

+10
source

Source: https://habr.com/ru/post/912776/


All Articles