Personal tools
You are here: Home Zope & Plone tips Extending a content type with additional fields in Zope 3, using annotations
Navigation
 
Document Actions
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

Extending a content type with additional fields in Zope 3, using annotations

by tibi last modified 2007-06-27 14:29

I got a question today from one of my zope 3 "pupils": how do I extend the schema for an object that belongs to a package over which I have no control? The purpose is not exactly to extend the schema, but to make it easy to create formlib based forms for that object.

The answer is of course easy using one adapter and annotations: create a new schema that contains the extra field and create an adapter that stores the extra field as an annotation to the schema. Then, in the formlib forms, when defining the form_fields, also add the fields of the newly created interface. Then the adapter will be "automagically" used to edit the object, in the form handling.

TODO: code to exemplify this.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: