Comments (24)
I'd be interesting in helping out on this feature. What's the status? Has any discussion taken place?
from django-cms.
nope... but there is some template inheritance but never tried out myself
from django-cms.
yeah, i saw that in the admin interface. I'll take a look at the code and report back.
from django-cms.
I was wondering if it might make more sense to implement the feature as a "master page" which sub pages could choose to extend on a per-placeholder basis?
What I'm evisioning is that a page can be set up in the nav tree. Another page, not necessarily a child page, can be created. In the admin interface for a page, each place holder could have, for example, a checkbox saying "use master page" which could enable a foreign key relation to another page. The sub page would then pull the plugins assigned to the indicated placeholder, if any, from the master page.
Make sense? Pros or cons?
from django-cms.
a inherit-plugin would make more sense... where you could choose the page you want to inherit and then it pulls in all plugins from this page that are on the same placeholder as the inherit-plugin.
from django-cms.
that's actually a much better approach. i'll start putting together such a plugin. thx!
from django-cms.
i have a preliminary inherit plugins that working for my home grown plugins. I'm still testing it but it's ready for some review and commentary.
from django-cms.
push to github and i will have a look
from django-cms.
i published it
http://github.com/heiho1/django-cms-inherit-plugin
I'm still a github newb so let me know if I should publish it to a specific repo. I'll be testing and updating this tomorrow as I know of at least one bug that I ran into.
from django-cms.
looks good. I would have forked the django-cms repository and put it in there directly so i can merge directly the changes in as soon as we have 2.0 final released.
the plugin render function can be used from the PlaceholderNode... so both should call the same function.
Maybe it should be possible to prefill the parent_page field with the parent?
Could you imagine a possibility to say... inherit all plugins except the Picture Plugins? Or something in the way of: only inherit all TextPlugins... but I think this feature can be implemented by someone who needs it.
But otherwise looks good
from django-cms.
"""the plugin render function can be used from the PlaceholderNode... so both should call the same function."""
I'm not entirely sure what this means. I know there are PlaceholderNode objects being passed around. Is this related to cms_tags.py at all? I know that I ran into a bug testing inheritance of a menu implementation. I'll take a closer look today.
"""Maybe it should be possible to prefill the parent_page field with the parent?"""
I decided against this because they may want to, for example, have a separate set of CMS pages which are not in the nav tree and maintain those as "master template pages". I think this is a more likely scenario for usage.
from django-cms.
PlaceholderNode in cms_tags.py renders the plugins. Maybe it would be wise to extract that portion of code and pack it in a function. Then the inherit plugin can call the same function and we don't have to worry that if someone changes it on one place the other does not get forgotten.
from django-cms.
I see. I'll refactor the code along these lines.
from django-cms.
OK, I created a local "inheritance" branch of cms trunk:
"""
(sf-env)[14:26][~/dev/django-cms-2.0(inheritance)]$ git branch
- inheritance
master
"""
I have coded the plugin, added a cms.utils.plugin.py with a "render_plugins_for_context()" function and refactored cms_tags.py to use that function. I ran into a problem in the inheritance plugin where calling the render_plugins_for_context() was causing output to be escaped somewhere down the line so I commented out the refactored inherit plugin to use the old way for now. Definitely a "TODO" item. I have a local branch but I'm not sure how to push that or if I should use a CMS fork on github.
from django-cms.
Disregard the problem I was having with the output escaping, I was using the "safe" on list items but needed to use "safeseq" coupled with "join" instead. Plugin should be good for another review.
from django-cms.
you can push with 'git push inheritance'
from django-cms.
I think I got it:
"""
(sf-env)[17:39][~/dev/django-cms-2.0(inheritance)]$ git push [email protected]:heiho1/django-cms-2.0.git inheritance
Counting objects: 30, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (24/24), 3.37 KiB, done.
Total 24 (delta 11), reused 0 (delta 0)
To [email protected]:heiho1/django-cms-2.0.git
- [new branch] inheritance -> inheritance
"""
from django-cms.
btw pushing to digi604 failed:
"""
(sf-env)[17:39][~/dev/django-cms-2.0(inheritance)]$ git push [email protected]:digi604/django-cms-2.0.git inheritance
ERROR: Permission to digi604/django-cms-2.0 denied to heiho1.
fatal: The remote end hung up unexpectedly
"""
from django-cms.
follow the instructions here:
http://www.django-cms.org/en/documentation/2.0/contribution/
you don't have to push to my repo... you have to push to your cloned repo
from django-cms.
ah i see it now in the network... seams to be ok
from django-cms.
could clean up the code a little bit and remove all unused comments?
from django-cms.
i cleaned up the code and pushed. Plz take a look
from django-cms.
is integrated into new frontedit branch
from django-cms.
Awesome, I'll upgrade soon. Thanks for your time.
from django-cms.
Related Issues (20)
- [DOC] Frontend tests documentation is outdated HOT 2
- [BUG] Click "New Draft" cause error UNIQUE constraint failed: cms_pagecontent.language, cms_pagecontent.page_id HOT 12
- [DOC] command line for setup virtual environment is wrong in the 4.1 documentation HOT 4
- [DOC] How to use placeholders outside the CMS needs update for django CMS 4 HOT 7
- [BUG] Cannot delete or update a parent row: a foreign key constraint fails - when deleting custom plugin HOT 7
- [BUG] Dark mode makes the pop-up messages from the admin interface unreadable. HOT 1
- [BUG] Plugin duplicate entry for key cms_plugin_path caused be DB collations HOT 40
- [BUG] Deleting a page sometimes impossible in languages other than English HOT 1
- [BUG] In PageContent admin first field isn't focused
- error install djangocms-blog HOT 2
- [feat] Without public home page, a 404 error is raised HOT 18
- [BUG] toolbar.obj is not set correctly in edit view when apphook landing page is a CMS page HOT 2
- Bounty program HOT 2
- [BUG] The sign up page https://www.django-cms.org/en/sign-up-work-contribution/ doesn't get pass the catchup HOT 1
- [BUG] Migrating with another database other than "default" HOT 3
- [BUG] Placeholder inherit raising "NoneType should implement get_template" if used on an apphooked page HOT 2
- [BUG] With versioning enabled, "Show in Menu" does not work in page tree HOT 2
- [BUG] 404 page not found error without a trailing slash for "/en" and "/en/admin" URLs. HOT 1
- [DOC] code update
- [BUG] create_page_content API adding two cms_pagecontent records instead of one HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-cms.