Nested Content Types

Hi,

I am looking into whether it is possible to have a content type nested within another content type. An example use case here would be

Having a 'Region' content type that just has a title, users can go in and create instances of 'Region'

I have a second content type that represents a person, and would like to reference the 'Region' content type that they are associated with. This way if I have multiple things that have a 'Region' they can all pull from the same data source.

Is this something that is possible?

Thanks!

Hi Jeremy.
We have our selves folderish structure with database->hospital->patient->visit

You will need have your "region" as folderish type and then also in region in the xml of region add "person" as addable.

from plone.dexterity.content import Container

class region(Container):
"""
"""

in your region.xml:
  <property name="filter_content_types">True</property>
  <property name="allowed_content_types">
     <element value="person" />
  </property>

I could suggest you look into plonecli, a command line tool for doing contenttypes.

This will help you do a product for your content types and the content types themselves.

Thanks!

That makes sense, I've got that structure created in my plone instance now, I think my next question with this 'data-model' is if I have a bunch of 'Person' content types already created, when I create a new region can I populate all of the existing 'Person' contents into a select so I can associated them with the new region?

This kind of illustrates what I'm looking for
e.g.

  • Existing Child List
  • ChildOne
  • ChildTwo

  • Container
    • ChildOne <- Referencing the ChildOne in an Existing Child List
    • ChildTwo <- Referencing the ChildTwo in an Existing Child List

Is that a supported use case or is it purely a

  • Container

    • ChildOne
    • ChildTwo
    • ChildThree
  • Container

    • ChildFour <- 'Copy' of ChildOne but is a separate instance

Relationlist or Relationchoice could be a solution so you have a flexible hierarchy where you can "link" content instead of using less flexible containers. (https://docs.plone.org/external/plone.app.dexterity/docs/reference/widgets.html)

You can also have a similar effect by doing a custom dynamic vocabulary.

/Niels

Plone Foundation Code of Conduct