The title of our content type has to be restricted to be constructed out of the content of other fields from the model schema during instance creation.
Once the instance is created, the relevant fields should no more be editable, as should not be the title field.
I know about the directives.omitted directive. The hard part is where to generate the title after the user hits "Save" during Instance creation add form logic.
I thought about an own factory which does this during instance creation. But i cannot locate code for the default dexterity factory. Registering it should be possible once i find it.
Are there other places possible to put the logic of field computation ? Replacing the Plone templates to show a computed value in stead of the title looks like very much work to find every place where the title field is referenced.
Then the part with editable fields in the AddForm, which should only be readonly on the EditForm. As i can only specify a field readonly for the whole shema, can i use two different schemas, one for add, one for edit purposes ? A custom Add or Edit Form should do the trick, but maybe there is a more trivial approach.
Thank you for your thoughts about this problems.
I found the DexterityFactory class in plone.dexterity.factory.py, and its only usage i can find is in plone.dexterity.fti.py. There is the register helper-function
"""Helper method to:
- register an FTI as a local utility
- register a local factory utility
- register an add view
fti = aq_base(fti) # remove acquisition wrapper
site = getUtility(ISiteRoot)
site_manager = getSiteManager(site)
portal_type = fti.getId()
fti_utility = queryUtility(IDexterityFTI, name=portal_type)
if fti_utility is None:
fti, IDexterityFTI, portal_type, info="plone.dexterity.dynamic"
factory_utility = queryUtility(IFactory, name=fti.factory)
if factory_utility is None:
So maybe i should site_manager.registerUtility with my own, adapted Factory ? But how to suppress the registering of the default, dexterity factory for my content type beforehand ?