Basics: Attributes / Fields
The schema of your content types, generated from the attributes of your model and their tagged values, contains Archetypes fields. Each field has a type and a widget. The "Archetypes documentation":/documentation/manual/archetypes-developer-manual/ and the quick reference at the end of this document describes which fields are available and what parameters they take as configuration.
usage of tagged values
If you set a tagged value on an attribute of your class, in general that tagged value will be passed through as a parameter to the generated Archetypes field. Hence, if you set a tagged value 'enforceVocabulary' to the value '1' on an attribute, you will get 'enforceVocabulary=1' for that field in the generated schema. Similarly, you can set a field's widget properties by prefixing the tagged value with 'widget:'. 'widget:label' sets the label of a widget, for instance.
non-string tagged values
As before, when reading tagged values, ArchGenXML will generally treat them as strings, with a few exceptions where only non-string values are permitted, such as the 'required' tagged value. If you do not wish your value to be quoted as a string, prefix it with 'python:'. For example, if you set the tagged value 'default' to 'python:["high", "low"]' on a 'lines' attribute, you will get 'default=["high", "low"]' in a LinesField in your schema.
index in catalog
To create an index in portal_catalog for this field add the tagged value
'index' with value 'FieldIndex'. An FieldIndex with the name of the fields
accessor (e.g. get<Fieldname>) gets created.
Multiple indexes can be defined in a tuple, indexes for special catalogs can
be prefixed with the catalog name following a '/' (e.g. 'python:("FieldIndex",
To include the index in catalog metadata (and have the attribute ready to use
in the brain objects), append ':brains' (same as older ':schema'), (e.g. 'FieldIndex:brains')
field recycling - copy from parents schema and modify
You may need a 'Description' field it is usally defined in your parent classes (BaseContent, BaseFolder) Schema, but it appears under properties-tab, not in your base_edit form. To make it show up there, you just need to change one property of the field: 'schemata = "default"'.
Solution: copy the field definition. in UML add an attribute to you class, give it the "type" 'copy' and a tagged value 'schemata' with value 'default'. Setting values on copied-fields and their widgets is at some details different from a new field definition, so attention here.