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/fields.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,14 @@ myst:
11
11
12
12
# Fields
13
13
14
-
This chapter describes the standard schema fields in Plone content types.
14
+
This chapter describes the standard schema fields for Plone forms and content types.
15
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.
16
+
The following tables show the most common field types for use in {ref}`classic-ui-forms-label` and Dexterity {ref}`backend-content-types-label`.
17
+
See {ref}`schemas <backend-schemas-label>` for information about how fields compose a schema for a form or content type data model.
18
18
19
+
```{note}
20
+
In VS Code editor, you can install the [Plone Snippets](https://marketplace.visualstudio.com/items?itemName=Derico.plone-vs-snippets) extension. This will give you snippets for most fields, widgets and autoform directives in Python and XML based schemas.
21
+
```
19
22
20
23
## Field properties
21
24
@@ -36,7 +39,7 @@ Refer to the table below to see what properties a particular interface implies.
36
39
||`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
40
|`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
41
||`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. |
42
+
|`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 {ref}`vocabulary <backend-vocabularies-label>`. |
40
43
||`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
44
|`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
45
||`value_type`|| Another `Field` instance that describes the allowable values in a dictionary. Similar to the `value_type` of a collection. Must be set. |
@@ -55,7 +58,7 @@ The following tables describe the most commonly used field types, grouped by the
55
58
56
59
| Name | Type | Description | Properties |
57
60
| - | - | - | - |
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`. |
61
+
| 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 {ref}`backend-vocabularies-label`. |
59
62
| Bytes | str | Used for binary data. | IField, IMinMaxLen |
Copy file name to clipboardExpand all lines: docs/backend/schemas.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,12 @@ Zope schemas are used for tasks like:
46
46
The basic unit of data model declaration is the {ref}`field <backend-fields-label>`, which specifies what
47
47
kind of data each Python attribute can hold.
48
48
49
-
### zope.schema / plone.schema
50
49
51
-
The main package is [zope.schema](http://github.com/zopefoundation/zope.schema), but in we can also use [plone.schema](https://github.com/plone/plone.schema) which provides additional fields and widgets for z3c.form and optional integration with Plone.
50
+
(backend-ploneschema-label)=
51
+
52
+
### plone.schema vs zope.schema
53
+
54
+
The main package is [zope.schema](http://github.com/zopefoundation/zope.schema), but we can also use [plone.schema](https://github.com/plone/plone.schema) which provides additional fields and widgets for z3c.form and optional integration with Plone.
52
55
53
56
Additional features are:
54
57
@@ -62,6 +65,10 @@ Additional features are:
62
65
63
66
### Example of a schema
64
67
68
+
```{note}
69
+
In VS Code editor, you can install the [Plone Snippets](https://marketplace.visualstudio.com/items?itemName=Derico.plone-vs-snippets) extension. This will give you snippets for most fields, widgets and autoform directives in Python and XML based schemas.
70
+
```
71
+
65
72
Define a schema for a data model to store addresses:
Copy file name to clipboardExpand all lines: docs/backend/widgets.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,10 @@ When an HTTP `post` request comes in, Zope publisher automatically converts `<se
30
30
31
31
## Widget reference
32
32
33
+
```{note}
34
+
In VS Code editor, you can install the [Plone Snippets](https://marketplace.visualstudio.com/items?itemName=Derico.plone-vs-snippets) extension. This will give you snippets for most fields, widgets and autoform directives in Python and XML based schemas.
35
+
```
36
+
33
37
You can find the default widgets in the browser package in `z3c.form`.
34
38
The [`z3c.form` documentation](https://z3cform.readthedocs.io/en/latest/widgets/index.html) lists all the default widgets and shows the HTML output of each.
35
39
@@ -287,7 +291,7 @@ class IFlexibleContent(form.Schema):
287
291
# Hide widget "sections"
288
292
form.mode(sections="hidden")
289
293
290
-
# set mode
294
+
# set mode
291
295
form.mode(IEditForm, sections="input")
292
296
form.mode(IAddForm, sections="input")
293
297
@@ -601,7 +605,7 @@ Then you set the `my_combined_field` widget template in `updateWidgets()`:
0 commit comments