Title: Make register_templates plugin-friendly · Issue #703 · feincms/feincms · GitHub
Open Graph Title: Make register_templates plugin-friendly · Issue #703 · feincms/feincms
X Title: Make register_templates plugin-friendly · Issue #703 · feincms/feincms
Description: 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 ...
Open Graph Description: 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 somethi...
X Description: 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 somethi...
Opengraph URL: https://github.com/feincms/feincms/issues/703
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make register_templates plugin-friendly","articleBody":"Context: When creating a FeinCMS site using some kind of plugin mechanism, I ran into this problem.\r\n\r\nEach plugin wants to contribute some Template to the main project. To do that, it will do something like\r\n\r\n```python\r\nfrom feincms.module.page.models import Page\r\n\r\nregions_main = (('main', 'Content'), )\r\nPage.register_templates(\r\n {'key': 'mmmmh', 'title': 'Tasty template', 'path': 'munch/nomnom.html', 'regions': regions_main}\r\n)\r\n```\r\n\r\nThis will not work.\r\n\r\nEach 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. \r\n\r\nI can paper over this by patching in all content types here\r\n\r\n```python\r\nfor region in Page._feincms_all_regions:\r\n if not region._content_types:\r\n region._content_types = Page._feincms_content_types.copy() # copy is important otherwise CTs will be duplicated\r\n```\r\n\r\nbut that is not always what is wanted, since I can't restrict CTs to a region that way. \r\n\r\nIf 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).\r\n\r\nFood for thought...\r\n","author":{"url":"https://github.com/mjl","@type":"Person","name":"mjl"},"datePublished":"2022-04-20T10:19:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/703/feincms/issues/703"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0089eced-681b-2cff-715a-239b3fe114a3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A780:243FA0:8C6612C:B4E7E3C:6975F211 |
| html-safe-nonce | 77383b5d15792d222e04c0597f2246ea2ae8c0a9391b826148600e82735260dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzgwOjI0M0ZBMDo4QzY2MTJDOkI0RTdFM0M6Njk3NUYyMTEiLCJ2aXNpdG9yX2lkIjoiNjQ5ODA0Nzc2ODQwNzY5OTk4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bbccbb2ac6d3466a366b75febe908b904c20d3ede056dd1889cc2699754a779d |
| hovercard-subject-tag | issue:1209480024 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feincms/feincms/703/issue_layout |
| twitter:image | https://opengraph.githubassets.com/41cff0f564873d5a32b063d5a1859651df2406ed566dddb1989d85115f2448a4/feincms/feincms/issues/703 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41cff0f564873d5a32b063d5a1859651df2406ed566dddb1989d85115f2448a4/feincms/feincms/issues/703 |
| og:image:alt | 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 somethi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mjl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2bce766e7450b03e00b2fc5badd417927ce33a860e78cda3e4ecb9bbd1374cc6 |
| turbo-cache-control | no-preview |
| go-import | github.com/feincms/feincms git https://github.com/feincms/feincms.git |
| octolytics-dimension-user_id | 935594 |
| octolytics-dimension-user_login | feincms |
| octolytics-dimension-repository_id | 116021 |
| octolytics-dimension-repository_nwo | feincms/feincms |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 116021 |
| octolytics-dimension-repository_network_root_nwo | feincms/feincms |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fcca2b8ef702b5f7f91427a6e920fa44446fe312 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width