Hi,
yes, the best way to not allow the user to assign names is to use an IAutoNamingFolder. It's very easy to hook one up as the default folder type. For the substanced scaffold, simply add this at the top of resources.py:
@content(
'Folder',
icon='glyphicon glyphicon-folder-close',
add_view='add_folder',
)
@implementer(IFolder)
class MyFolder(SequentialAutoNamingFolder):
""" Override Folder content type """
This will override the folder content type and use the SequentialAutoNamingFolder. To have the name begin with the content type, you would need to subclass this one.
To make this work with the document example in the scaffold, remove the name field from the DocumentSchema and change the add_success method in views.py to:
def add_success(self, appstruct):
registry = self.request.registry
document = registry.content.create('Document', **appstruct)
self.context.add_next(document)
return HTTPFound(
self.request.sdiapi.mgmt_path(self.context, '@@contents')
)
That's all you need.
Carlos de la Guardia