Proposal: Public API to create a pages

45 views
Skip to first unread message

yml

unread,
Feb 2, 2011, 3:42:43 AM2/2/11
to django-cms...@googlegroups.com
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

Jonas Obrist

unread,
Feb 2, 2011, 4:53:53 AM2/2/11
to django-cms...@googlegroups.com
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

Kevin Renskers

unread,
Feb 2, 2011, 6:41:19 AM2/2/11
to django-cms...@googlegroups.com
+1 from me too. Would also solve quickly creating a lot of pages for the first setup.

Martin

unread,
Feb 2, 2011, 6:42:54 AM2/2/11
to django-cms...@googlegroups.com
+1... obviously :)

Brendan Smith

unread,
Feb 2, 2011, 10:39:58 AM2/2/11
to django-cms...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages