Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify template for flowblock #1152

Open
iainhallam opened this issue Jul 9, 2023 · 1 comment
Open

Specify template for flowblock #1152

iainhallam opened this issue Jul 9, 2023 · 1 comment

Comments

@iainhallam
Copy link

I have a few flowblocks that share field names but have different types. They could share a template, but at the moment I have to have a copy for each flowblock type. Can _template be supported on flowblock models?

@dairiki
Copy link
Contributor

dairiki commented Jul 26, 2023

For pages, _template is a system field. That is, it is a page field that specifies the template to be used for rendering the page (defaulting to a template named based on the name of the model for the page).
Specifically, any overriding value for _template must be set in a contents.lr file on a per-page basis, rather than in an .ini file on a per-model basis.

The _template field could be supported for flowblocks, but (assuming that's done in a manner analogous to how it's done for pages) I don't think that's what you want in your case.


One way to make the "duplication" of the templates for the various flowblocks more explicit, is to have each of the templates inherit from a common base.

E.g. putting the following in templates/blocks/block-type-one.html:

{% extends "block-base.html" %}

makes it clear that the block-type-one flowblock uses block-base.html for its template. (The same could be done for block-type-two, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants