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)
- [BUG] Only users with advanced page permissions can change page permissions HOT 1
- [BUG] Permission Denied exception when adding a page in a different language HOT 7
- Implement `uv` as a drop-in replacement for pip
- [BUG] cannot delete page HOT 10
- [BUG] Model PageUrl should add constraint unique_together HOT 1
- [BUG] Missing translations on 3.11.5 HOT 1
- [BUG] Structure board renders placeholders of wrong language
- [BUG] Unpublished page is shown instead of 404 HOT 13
- [BUG] `CMS_TOOLBAR_HIDE = True` breaks ToolbarMiddleware in v3.11.x HOT 1
- [BUG] Special characters in page title HOT 7
- [BUG] Adding new page ignores setting CMS_DEFAULT_IN_NAVIGATION HOT 1
- [BUG] CMS 4.1 slug is readonly when changing Page title HOT 8
- [DOC] No explanation on using PlaceholderRelationField with classed based views HOT 16
- [BUG] Editing a page sometimes fails HOT 1
- [BUG] Console error in browser when opening PageContentAdmin HOT 1
- [BUG] Add plugin modal not working after migration HOT 1
- [BUG] placeholder inherit does not work HOT 2
- [BUG] placeholders-outside-cms TemplateDoesNotExist HOT 3
- [README] Quite a few links in the README lead to a 404
- [BUG] Moved plugins sometimes end at the wrong location HOT 4
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.