Proposal: Public API to create a pages

Showing 1-5 of 5 messages
Proposal: Public API to create a pages yml 2/2/11 12:42 AM
Why does django-cms need such feature ?

django-cms needs a public api to create pages (with plugin) because right now it is very hard to create a page using python api. This involves using the test client to simulate user interaction in the admin, thread local, and all kind of hack. 

When do we need to use this feature :
• test
• Migration from existing cms
• backup / restore

Potential Benefits 
---------------------------

Faster test suite because we will not use any more the test client to emulate user interactions on the admin interface.
Foundation for writing "on the shelf importers" (Wordpress, Drupal, site scraping ...) or to let developers to write their own tools.

API
-------

create_page method could be added to the manager "Page.objets.createpage(...)".  This method takes all the attributes available in Page admin interface (except the permission) and dispatch them to the underlying Models (Title, Page, ....) and it return the created page.

add_plugin(language, placholder, plugin, position) method could be added directly on the Page model "page.add_plugin(...)". The placeholder can be either a "string" or a placeholder instance and the plugin is an instance of a  CMSPlugin.

I am looking forward to hearing from you on this proposal.
Regards,
--yml

Re: Proposal: Public API to create a pages Jonas Obrist 2/2/11 1:53 AM
I completely agree that we need this, so a clear +1 from me.

We need an API to create pages, add languages (titles) to pages and add plugins to pages.

Jonas
Re: Proposal: Public API to create a pages Kevin Renskers 2/2/11 3:41 AM
+1 from me too. Would also solve quickly creating a lot of pages for the first setup.
Re: Proposal: Public API to create a pages Martin 2/2/11 3:42 AM
+1... obviously :)
Re: Proposal: Public API to create a pages Brendan Smith 2/2/11 7:39 AM
+1


--
Brendan Smith, IT Coordinator
National Priorities Project
http://www.nationalpriorities.org
http://www.costofwar.com
http://www.facebook.com/nationalpriorities
413 584 9556