Personal tools
Document Actions

1. Field Reference

Up one level
When you are using Fields in a Schema, it is important to be aware of all the properties that are defined by default for Fields. The following table shows the properties of the Field class, which all specific Fields have a copy of or override. Refer to the specific Field reference further down to see which properties are redefined.

Feedback to: Maik Röder, roeder@berg.net

In the following table, the standard Field properties are shown in the first column. The next column shows their default value. When you know the defaults you can avoid redefining the properties with the same values as the default ones when you define your custom Fields. In the last column, you will find a description of what the property is about.

Name Default Description
widget StringWidget The default widget is a StringWidget. Widgets are not given as a String, but as a reference to their class. Later, when the Field that contains the widget is instantiated, its widget attribute is set to an instance of the referenced StringWidget class.
schemata 'default' You can use your own Schematas to deal with groups of Fields separately. The default Schemata is "default". For metadata Fields, the "metadata" Schemata is used.
mode rw The mode of a Field can include read and write access. Accessors will not be created without the read mode, and Mutators will not be created without the write mode.
read_permission View from CMFCorePermissions The View Permission, as defined in CMFCorePermissions, is used to check whether the current user is allowed to see the Field in read mode. Only interesting if the read mode is activated. The read permission is checked when rendering the widget in read mode.
write_permission ModifyPortalContent from CMFCorePermissions The ModifyPortalContent Permission, as defined in CMFCorePermissions, is used to check whether the current user is allowed to fill in the Field in write mode. Only interesting if the write mode is activated. The write permission is checked when rendering the widget in write mode.
vocabulary () List of possible values for the field. An instance of DisplayList is expected here, although the empty list, which is the default is accepted like this.
enforceVocabulary False Defines whether the vocabulary should be enforced. Before storing a value, it is double-checked that it is really part of the vocabulary. This is important so that no bogus values can be introduced.
searchable False Should this Field be indexed by the SearchableText method? If yes, the field will be searchable through the web even if the user which performs the search does not have the right to see the Field, so you have to take care that this is set correctly.
index None Syntax: # "KeywordIndex" or "<index_type>:schema". The index_type defines the type of index to use in the portal catalog to index this Field. If 'schema' is set, the Field will also become part of the Catalog MetaData, which means that it will appear in the Catalog search results.
required False Required Fields have to be filled in before submitting the form. If a Field is not required, it will be accepted even if it is empty.
validators () The validators can be given as a list or tuple of strings. If you only have one validator, you can give it as a string.
default None The default value for the field
default_method None String defining the class-method to call to obtain a default value
storage AttributeStorage() The default storage, AttributeStorage, stores values as an attribute of the instance.
mutator None The mutator names a method that changes the value of the Field. If you don't provide a special method name here, a default mutator that simply stores the passed in value is created.
accessor None The accessor names a method that returns the value of the Field. If you don't provide a custom method name here, a default accessor is going to be created that just returns the value of the Field.
edit_accessor None The edit_accessor returns the raw value of the field
multiValued False If a Field can have multiple values, this property should be set. This is the case for Fields that allow the selection of multiple values, like multiple selection lists.
isMetadata False Marks MetaData fields. This is currently only needed as a convenience for the filterFields method of Schema.
type None Provided by the Fields that derive from the base class Field. Should never be changed in a Schema.
generateMode veVc If 'c' is set, the accessors and mutators will be set on the class, if necessary. The modes 'v', 'e' and 'V' are currently out of use in Archetypes. There is usually no need to change this in your Schemas..
force '' Currently not in use. May be used in the future.
index_method _at_accessor May be either _at_accessor, _at_edit_accessor or the name of a method which is used as accessor for the index.
languageIndependent False Flag for Fields that are independent of the language, such as dates. This information tells LinguaPlone that no translation is necessary for this field.

CMF Object Field

Used for storing value inside a CMF Object, which can have workflow. Can only be used for BaseFolder-based content objects

Different properties
Name Type Default Description
widget widget FileWidget Possible values:
  • LabelWidget
storage storage ObjectManagedStorage
type
object
Special properties
Name Type Default Description
portal_type
File
workflowable
True
default_mime_type
application/octet-stream

Date Time Field

Used for storing date/time

Different properties
Name Type Default Description
widget widget CalendarWidget Possible values:
  • LabelWidget
  • CalendarWidget (default)
default datetime

type
datetime

Reference Field

Used for storing references to other Archetypes Objects

Different properties
Name Type Default Description
widget widget ReferenceWidget Possible values:
  • ReferenceWidget (default)
  • LabelWidget
  • InAndOutWidget
index_method
_at_edit_accessor
type
reference
Special properties
Name Type Default Description
vocabulary_custom_label


allowed_types_method


relationship

Defines the type of relationship we want to establish with this Field. Examples are: 'KnowsAbout' or 'Owns'
vocabulary_display_path_bound
5
allowed_types
() This list defines all Types that are searched to find objects that the user can make a reference to. It also specifies the Types that should be allowed to be added directly from the reference widget. This is only activated if the addable property is set.
callStorageOnSet
False
referenceReferences
False
referenceClass
Reference

Photo Field

Used for storing images. Based on CMFPhoto.

Different properties
Name Type Default Description
widget widget ImageWidget Possible values:
  • LabelWidget
default string

type
image
Special properties
Name Type Default Description
displays
{'medium': (480, 480), 'xlarge': (1024, 1024), 'large': (768, 768), 'xsmall': (200, 200), 'small': (320, 320), 'thumbnail': (128, 128)}
default_content_type
image/gif
allowable_content_types
('image/gif', 'image/jpeg')

Image Field

Used for storing images. Images can then be retrieved in different thumbnail sizes

Different properties
Name Type Default Description
widget widget ImageWidget Possible values:
  • ImageWidget (default)
  • LabelWidget
default string

type
image
Special properties

Float Field

Used for storing float values

Different properties
Name Type Default Description
swallowResizeExceptions
False
primary
False
sizes
{'thumb': (80, 80)}
original_size


max_size


default_content_type
image/png
content_class


allowable_content_types
('image/gif', 'image/jpeg', 'image/png')
Name Type Default Description
default string 0.0
type
float

String Field

Used for storing simple strings

Different properties
Name Type Default Description
default string

type
string
Special properties
Name Type Default Description
default_content_type
text/plain

Boolean Field

Used for storing boolean values

Different properties
Name Type Default Description
widget widget BooleanWidget Implemented as a CheckBox. Possible values:
  • LabelWidget
  • BooleanWidget (default)
default boolean

type
boolean

Attachment Field

Used for storing files with advanced features.

Different properties
Name Type Default Description
widget widget FileWidget Possible values:
  • LabelWidget
default string

type
file
Special properties
Name Type Default Description
primary
False
default_content_type
application/octet
content_class


File Field

Used for storing files

Different properties
Name Type Default Description
widget widget FileWidget Possible values:
  • FileWidget (default)
  • LabelWidget
default string

type
file
Special properties
Name Type Default Description
primary
False
default_content_type
application/octet
content_class


Text Field

Used for storing text which can be used in transformations

Different properties
Name Type Default Description
default string

type
text
Special properties
Name Type Default Description
primary
False
default_content_type
text/plain
content_class


allowable_content_types
('text/plain',) Used in the TextArea and Visual widget to let the user choose between different text formats in which the content is entered.
default_output_type
text/plain This is only used on the get method, and decides to which MIME-Type the content is transformed if no special MIME-Type is demanded.

Integer Field

Used for storing integer values

Different properties
Name Type Default Description
widget widget IntegerWidget Possible values:
  • LabelWidget
  • IntegerWidget (default)
default integer 0
type
integer
Special properties
Name Type Default Description
size
10 The maximum length of the input field for Integers is 10.

Fixed Point Field

Used for storing fixed point values

Different properties
Name Type Default Description
widget widget DecimalWidget Possible values:
  • LabelWidget
  • DecimalWidget (default)
validators validators isDecimal
default string 0.00
type
fixedpoint
Special properties
Name Type Default Description
precision
2

LinesField Field

Used for storing text which can be used in transformations

Different properties
Name Type Default Description
widget widget LinesWidget Possible values:
  • KeywordWidget
  • LinesWidget (default)
  • LabelWidget
  • MultiSelectionWidget
  • PicklistWidget
  • InAndOutWidget
default string ()
multiValued boolean False
type
lines

Computed Field

Read-only field, which value is computed from a python expression

Different properties
Name Type Default Description
widget widget ComputedWidget Possible values:
  • LabelWidget
  • ComputedWidget (default)
storage storage ReadOnlyStorage
type
computed
mode string r
Special properties
Name Type Default Description
expression

Evaluated on the object to compute a value.
by Maik Roeder last modified September 10, 2007 - 09:04
Contributors: Maik Röder

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by