Skip to content

pagemodel.py template_choices and DEFAULT_TEMPLATE aren't being used #6520

@ZippoLag

Description

@ZippoLag

Summary

I was trying to override Page's template_choices and DEFAULT_TEMPLATE so I can limit the options according to a page's parent, but it appears that in at least 3 key places where those attributes should be used, get_cms_setting('TEMPLATES') is used instead, and so the selectable templates displayed are never limited like I intended.

The places I've found where this happens are the get_template and get_template_name methods. Also in cms_toolbars.py for the # templates menu section get_cms_setting('TEMPLATES') is used rather than self.page.template_choices.

More details about what I was trying to pull of can be found, here: https://stackoverflow.com/questions/52335541/how-to-limit-django-cms-template-choices-based-on-page-parent

Expected behaviour

template_choices and DEFAULT_TEMPLATE should define which templates are available for a Page in the CMS.

Actual behaviour

get_cms_setting('TEMPLATES') is always used instead.

Environment

  • Python version: 2.7.x
  • Django version: 1.11.x
  • django CMS version: 3.4.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions