-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Make page & title model extendable #2001
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
Conversation
Conflicts: cms/admin/pageadmin.py
cms/models/titleextensionmodel.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be copy_title_extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right ... too much copy & paste used ;)
On a general level I like it. Anyhow documentation and thorough tests are required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of whitespace issues in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes sorry, this file didn't belong to this topic. But anyway the file uses tabs for indentation and I use 4 spaces. Isn't the coding rule 4 spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use tabs for html, js and css/sass
I need docs with a basic example on how to do it. |
I'm currently at work but I could write a doc this evening. I never wrote a doc before, can you give me a hint on where and how to do this? |
have a look in the docs folder... probably docs/extending_cms/app_integration.rst would be a good place. |
I wrote a small doc on extending the page model. Placed it in a new file cause it isn't sure whether the extension makes it to the core or not ;) I had the time to test the extensions today and I noticed some things that have to be improved. For example I tried to write a MultiExtension with a ForeignKey instead of an OneToOne relation to have the possibility to add any number of that extension to the page. Or a problem with custom OneToOne relations on the extension. I'm currently need the extensions for a project I'm working on so I will test them throughout the week. |
Is there a way we could automate adding a toolbar entry for the extension admin? |
And yes i want this in core. :) |
If this should go to core we could discuss about adding it to the page model directly. Extensions could then be copied in the process of publishing like the title model without the overhead of the signal. Should there be one toolbar entry for every extension or an entry that shows all extensions? Perhaps a submenu that lists all extension admins? I'm currently thinking about using two db tables for every extension. One for the draft and one for the live version, cause in my case I need a one to one relation with uniqueness on the extension. But thats impossible on one table. Do the plugins support one to one relations? I can't imagine that. |
Linked to #1904 |
Hi guys, was busy this week sorry. I will review the linked discussion and hopefully get it final this weekend :) |
looks nice :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please read http://docs.django-cms.org/en/2.4.0/contributing/contributing.html#contributing-documentation and use the title style described there. thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the abstract model is located at cms.extensions.models.PageExtension
not cms.models.pageextensionmodel.PageExtension
Short information: the work isn't finished yet, I still want to add an admin for the extensions. The docs will get rewritten and will match the doc conventions ;) Tests are still missing. Hope to get this done this week. |
thanks @o-zander :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these changes necessary? They don't seem specific to this pull-request.
sorry for my late reply. No I don't mind ;) I'm glad I could help you in any way. I already used it in a production enviroment and could say its quite stable. I use a toolbar entry that adds a page extension and can open a admin modal. Important that no extension for the public page is created by hand or any other function. Else the save mechanism will break. a word to the unnecessary changes: yes they doesnt belong to this pull request but I doesn't know how to restrict a pull request to spefic commits |
@o-zander yeah, it's looking pretty good. I didn't have to change much up to now. To keep commits tidy for the pull requests, it's best to make feature branches for each pull-request, instead of using the develop branch. |
Thanks, I will follow the advice the next time. Thought there must be a simpler way than cluttering your repo with dozens of branches ;) A feature that github could improve ... |
merged in #2110 |
This is a very basic way to extend the page and the title model. I use it in conjunction with custom toolbar menu items. With some menu modifiers I hook the models to the menu to display an icon and a short description for every menu node. I decided to make this pull request to raise a discussion about this topic. A better support for page and title model extensions would be desirable. My approach could be easily integrated deeper in the page publish mechanism but I wanted to seperate it the most possible way to be independant from the current development process.