How do I set a one to one relationship between a folder and a dexterity content type?

StackOverflow https://stackoverflow.com/questions/22316045

  •  12-06-2023
  •  | 
  •  

質問

I have a dexterity content type and I would like there to only ever be one of these in a folder. I cannot find any documentation to cover this. How is it accomplished?

役に立ちましたか?

解決

You can add an event-listener, which applies on creation of your type and removes your type of the addable-types of its parent, like described in:

https://developer.plone.org/content/types.html#constraining-the-addable-types-per-type-instance

Consequently you probably also want to redo the setting when deleting this contenttype, by adding another event-listener for the deletion.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top