Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Make register_templates plugin-friendly #703

Copy link
Copy link
@mjl

Description

@mjl
Issue body actions

Context: When creating a FeinCMS site using some kind of plugin mechanism, I ran into this problem.

Each plugin wants to contribute some Template to the main project. To do that, it will do something like

from feincms.module.page.models import Page

regions_main = (('main', 'Content'), )
Page.register_templates(
    {'key': 'mmmmh', 'title': 'Tasty template', 'path': 'munch/nomnom.html', 'regions': regions_main}
)

This will not work.

Each region holds a list of content types that can be used in that region. Unfortunately, this list is built when a concrete content type is created, so calling register_templates again later will add regions that have no content types at all.

I can paper over this by patching in all content types here

for region in Page._feincms_all_regions:
    if not region._content_types:
        region._content_types = Page._feincms_content_types.copy()  # copy is important otherwise CTs will be duplicated

but that is not always what is wanted, since I can't restrict CTs to a region that way.

If we ever want to restrict a CT to a certain region, things will become more complicated (the region set for each CT is not stored anywhere, so that information is lost once the CT has been instanciated).

Food for thought...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.