You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/backend/content-types/index.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,13 +22,11 @@ We have different content types to reflect the different kinds of information ab
22
22
23
23
Pages, news items, events, files (binary), and images are examples of content types.
24
24
25
-
Lots of things in Plone can be configured to work differently based on the content type.
26
-
For example, each content type has:
27
-
28
-
- a {ref}`schema <backend-fields-label>` specifying the fields which can be edited for the content type
29
-
- a list of {ref}`behaviors <backend-behaviors-label>` which supply additional functionality that can be attached to the content types for which the behavior is enabled
30
-
- a {ref}`workflow <backend-workflows-label>` controling transitions between publishing states and associated permissions
31
-
- a version policy controling whether to store a revision history
25
+
Lots of things in Plone can be configured to work differently based on the content type. For example, each content type has:
26
+
- a {ref}`schema <backend-schemas-label>` specifying the fields which can be edited for the content type
27
+
- a list of {ref}`behaviors <backend-behaviors-label>` which supply additional functionality that can be attached to the content types for which the behavior is enabled
28
+
- a {ref}`workflow <backend-workflows-label>` controlling transitions between publishing states and associated permissions
29
+
- a version policy controlling whether to store a revision history
32
30
33
31
It is common in developing a web site that you'll need customized versions of common content types, or perhaps even entirely new types.
Copy file name to clipboardExpand all lines: docs/backend/fields.md
+112-8Lines changed: 112 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,118 @@ myst:
11
11
12
12
# Fields
13
13
14
-
```{seealso}
15
-
See the chapter {ref}`training:dexterity-reference-label` from the Mastering Plone 6 Training.
16
-
```
17
-
18
-
```{todo}
19
-
Contribute to this documentation!
20
-
See issue [Backend > Fields needs content](https://github.com/plone/documentation/issues/1305).
21
-
```
14
+
This chapter describes the standard schema fields in Plone content types.
15
+
16
+
The following tables show the most common field types for use in Dexterity schemata.
17
+
See the documentation on {ref}`creating schemata <backend-schemas-label>` for information about how to use these.
18
+
19
+
20
+
## Field properties
21
+
22
+
Fields are initialized with properties passed in their constructors.
23
+
To avoid having to repeat the available properties for each field, we'll list them once here, grouped into the interfaces that describe them.
24
+
You'll see those interfaces again in the tables below that describe the various field types.
25
+
Refer to the table below to see what properties a particular interface implies.
26
+
27
+
| Interface | Property | Type | Description |
28
+
| - | - | - | - |
29
+
| IField | title | int | The title of the field. Used in the widget. |
30
+
||`description`| unicode | A description for the field. Used in the widget. |
31
+
||`required`| bool | Whether or not the field is required. Used for form validation. The default is `True`. |
32
+
||`readonly`| bool | Whether or not the field is read only. Default is `False`. |
33
+
||`default`|| The default value for the field. Used in forms and sometimes as a fallback value. Must be a valid value for the field if set. The default is `None`. |
34
+
||`missing_value`|| A value that represents "this field is not set". Used by form validation. Defaults to `None`. For lists and tuples, it is sometimes useful to set this to an empty list or tuple. |
35
+
|`IMinMaxLen`|`min_length`| int | The minimum required length or minimum number of elements. Used for `string`, sequence, mapping, or `set` fields. Default is `0`. |
36
+
||`max_length `| int | The maximum allowed length or maximum number of elements. Used for `string`, sequence, mapping, or `set` fields. Default is `None` (no check). |
37
+
|`IMinMax`|`min`|| The minimum allowed value. Must be a valid value for the field, for example, an int field should be an integer. Default is `None` (no check). |
38
+
||`max`|| The maximum allowed value. Must be a valid value for the field, for example an int field should be an integer. Default is `None` (no check). |
39
+
|`ICollection`|`value_type`|| Another `Field` instance that describes the allowable values in a list, tuple, or other collection. Must be set for any collection field. One common usage is to set this to a `Choice` to model a multi-selection field with a vocabulary. |
40
+
||`unique`| bool | Whether or not values in the collection must be unique. Usually not set directly. Use a `Set` or `Frozenset` to guarantee uniqueness in an efficient way. |
41
+
|`IDict`|`key_type`|| Another `Field` instance that describes the allowable keys in a dictionary. Similar to the `value_type` of a collection. Must be set. |
42
+
||`value_type`|| Another `Field` instance that describes the allowable values in a dictionary. Similar to the `value_type` of a collection. Must be set. |
43
+
|`IObject`|`schema`|`Interface`| An interface that must be provided by any object stored in this field. |
44
+
|`IRichText`|`default_mime_type`| str | Default MIME type for the input text of a rich text field. Defaults to `text/html`. |
45
+
||`output_mime_type`| str | Default output MIME type for the transformed value of a rich text field. Defaults to `text/x-html-safe`. There must be a transformation chain in the `portal_transforms` tool that can transform from the input value to the `output` value for the output property of the `RichValue` object to contain a value. |
46
+
||`allowed_mime_types`| tuple | A list of allowed input MIME types. The default is `None`, in which case the site-wide settings from the {guilabel}`Markup` control panel will be used. |
47
+
48
+
49
+
## Field types
50
+
51
+
The following tables describe the most commonly used field types, grouped by the module from which they can be imported.
52
+
53
+
54
+
### Fields in `zope.schema`
55
+
56
+
| Name | Type | Description | Properties |
57
+
| - | - | - | - |
58
+
| Choice | N/A | Used to model selection from a vocabulary, which must be supplied. Often used as the `value_type` of a selection field. The value type is the value of the terms in the vocabulary. | See {doc}`../advanced/vocabularies`. |
59
+
| Bytes | str | Used for binary data. | IField, IMinMaxLen |
| SourceText | unicode | A textfield intended to store source text, such as HTML or Python code. | IField, IMinMaxLen |
78
+
| Object | N/A | Stores a Python object that conforms to the interface given as the `schema`. There is no standard widget for this. | IField, IObject |
79
+
| URI | str | A URI (URL) string. | IField, MinMaxLen |
80
+
| Id | str | A unique identifier, either a URI or a dotted name. | IField, IMinMaxLen |
81
+
| DottedName | str | A dotted name string. | IField, IMinMaxLen |
| Decimal | Decimal | Stores a Python `Decimal`. Requires version 3.4 or later of [`zope.schema`](https://pypi.org/project/zope.schema/). Not available by default in Zope 2.10. | IField, IMinMax |
84
+
85
+
86
+
### Fields in `plone.namedfile.field`
87
+
88
+
See [`plone.namedfile`](https://pypi.org/project/plone.namedfile/) and [plone.formwidget.namedfile](https://pypi.org/project/plone.formwidget.namedfile/) for more details.
89
+
90
+
| Name | Type | Description | Properties |
91
+
| - | - | - | - |
92
+
| NamedFile | NamedFile | A binary uploaded file. Normally used with the widget from `plone.formwidget.namedfile`. | IField |
93
+
| NamedImage | NamedImage | A binary uploaded image. Normally used with the widget from `plone.formwidget.namedfile`. | IField |
94
+
| NamedBlobFile | NamedBlobFile | A binary uploaded file stored as a ZODB blob. Requires the `blobs` extra to `plone.namedfile`. Otherwise identical to `NamedFile`. | IField |
95
+
| NamedBlobImage | NamedBlobImage | A binary uploaded image stored as a ZODB blob. Requires the `blobs` extra to `plone.namedfile`. Otherwise identical to `NamedImage`. | IField |
96
+
97
+
98
+
### Fields in `z3c.relationfield.schema`
99
+
100
+
See [`z3c.relationfield`](https://pypi.org/project/z3c.relationfield/) for more details.
| RichText | RichTextValue | Stores a `RichTextValue`, which encapsulates a raw text value, the source MIME type, and a cached copy of the raw text transformed to the default output MIME type. | IField, IRichText |
116
+
117
+
118
+
### Fields in `plone.schema`
119
+
120
+
See [`plone.schema`](https://pypi.org/project/plone.schema/) for more details.
0 commit comments