I'm having trouble getting the Dexterity content type to show a custom upload form. I already did this in the previous product, but, surprisingly, I can not accomplish this using Plone 4.1 and plone.app.dexterity 1.0.3
The content type My CrmContact, living in package.name.types.contact.py, has its own schema defined as follows:
from five import grok from zope import schema from zope.interface import implements from plone.directives import form, dexterity class ICrmContact(form.Schema): """A contact item for the CRM""" title = schema.TextLine( title=_(u"Company name"), ) ... class CrmContact(dexterity.Container): implements(ICrmContact) class Add(dexterity.AddForm): grok.context(ICrmContact) grok.name('package.name.contacts.types.contact') grok.template('add')
My template is located in the / name / types / contact _templates folder. This is a typical pattern. I know this is not being displayed because it has a dummy node that will call a non-existent method using tal: content to throw an exception; therefore, I am sure that the template itself is not a problem.
My FTI content type is registered correctly during installation, and the content type is available and added.
Finally, in the /default/types.package.name.types.contact.xml profiles:
<?xml version="1.0"?> <object name="package.name.types.contact" meta_type="Dexterity FTI" i18n:domain="package.name" xmlns:i18n="http://xml.zope.org/namespaces/i18n"> ... <alias from="(Default)" to="(dynamic view)" /> <alias from="edit" to="@@edit" /> <alias from="sharing" to="@@sharing" /> <alias from="view" to="(selected layout)" /> <action title="View" action_id="view" category="object" condition_expr="" url_expr="string:${object_url}" visible="True"> <permission value="View" /> </action> <action title="Edit" action_id="edit" category="object" condition_expr="" url_expr="string:${object_url}/edit" visible="True"> <permission value="Modify portal content" /> </action> </object>
Unrelated, but maybe I need to add something here ...
I think I followed the correct procedure, as you can see, but I still cannot get it to work.
I know that the Add class gets instanced, because if I provide the updateWidgets () method and insert a breakpoint, it is called; and when I examine the object, self.template is None; although:
(Pdb) getattr(self, 'grokcore.view.directive.template') 'add'
How can I create a custom template in the form of adding my custom type?