Custom root content type & Default content types

44 views
Skip to first unread message

Adam Sims

unread,
Aug 19, 2016, 2:32:04 AM8/19/16
to Kotti
Anyone know what the best way of adding a custom content type to the default Document's addable_to list is?

FFFFFFFab

unread,
Aug 20, 2016, 6:01:10 AM8/20/16
to Kotti
If you want to be able to add a content of a custom content type to a content of Document content type, you've just to add the name of Document content type ('Document') to the CustomContentType.type_info.addable_to attribute (http://kotti.readthedocs.io/en/latest/first_steps/tut-2.html).

FFFFFFFab

unread,
Aug 20, 2016, 6:12:13 AM8/20/16
to Kotti

Le samedi 20 août 2016 12:01:10 UTC+2, FFFFFFFab a écrit :
If you want to be able to add a content of a custom content type to a content of Document content type, you've just to add the name of Document content type ('Document') to the CustomContentType.type_info.addable_to attribute (http://kotti.readthedocs.io/en/latest/first_steps/tut-2.html).

Sorry, I think I've misunderstood your question. So, if you want to add a custom content type to the default Document's addable_to list, you can add this following lines in your __init__.kotti_configure() function:

from kotti.resources import Document
Document.type_info.addable_to.append('CustomContentType')

Adam Sims

unread,
Aug 20, 2016, 11:46:55 PM8/20/16
to Kotti
Thats great. Brain got stuck on overrides and overlooked adding it straight to the Document object. /facepalm
Thanks a bunch!
Reply all
Reply to author
Forward
0 new messages