Skip to content

Commit 147f9c6

Browse files
committed
Tidy model-driven-types.md
1 parent 2cc3305 commit 147f9c6

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

plone.app.dexterity/model-driven-types.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
22
myst:
33
html_meta:
4-
"description": ""
5-
"property=og:description": ""
6-
"property=og:title": ""
7-
"keywords": ""
4+
"description": "Model-driven types"
5+
"property=og:description": "Model-driven types"
6+
"property=og:title": "Model-driven types"
7+
"keywords": "Plone, model, content types"
88
---
99

1010
# Model-driven types
1111

1212
In the previous section, we defined two types by using Zope schema.
1313
In this section, we're going to define a type's fields using an XML model file.
1414

15-
The great advantage of using a model file is that we can prototype the content type in Dexterity's through-the-web field editor, then export the XML model file for incorporation into our package.
15+
The advantage of using a model file is that we can prototype the content type in Dexterity's through-the-web field editor, then export the XML model file for incorporation into our package.
1616

1717
XML may be used to do pretty much anything you could do via Zope schema.
1818
Many users not already schooled in Zope schema will find this by far the easiest and fastest way to create Dexterity content types.
1919

20+
2021
## Setting the field model
2122

2223
Create an `example/conference/models` directory.
23-
In it, add a `presenter.xml` file with the contents:
24+
In it, add a `presenter.xml` file with the following content.
2425

2526
```xml
2627
<model xmlns:form="http://namespaces.plone.org/supermodel/form"
@@ -49,10 +50,10 @@ In it, add a `presenter.xml` file with the contents:
4950
</model>
5051
```
5152

52-
The XML name spaces we use are described in the `Dexterity XML` reference section.
53+
The XML name spaces we use are described in the {doc}`reference/dexterity-xml` reference chapter.
5354

54-
Now, open the `presenter.py` that we created in the last section (a copy of our original program.py).
55-
Delete the field declarations from the IPresenter class and edit to read:
55+
Open {file}`presenter.py` that we created in the previous chapter, which is a copy of our original {file}`program.py`.
56+
Delete the field declarations from the `IPresenter` class, and edit as shown below:
5657

5758
```python
5859
from example.conference import MessageFactory as _
@@ -61,21 +62,21 @@ from zope import schema
6162

6263

6364
class IPresenter(model.Schema):
64-
6565
"""Schema for Conference Presenter content type."""
6666

67-
model.load('models/presenter.xml')
67+
model.load("models/presenter.xml")
6868
```
6969

7070
Note the `model.load` directive.
7171
This will automatically load our model file to provide the content type field schema.
7272

73-
## Setting Factory Type Information
7473

75-
This part of the process is identical to what we explained for schema-driven type.
74+
## Setting factory type information
75+
76+
This part of the process is identical to what we explained in {doc}`schema-driven-types`.
7677

77-
Look in the `types.xml` file in your packages
78-
`example/conference/profiles/default` directory. It should now contain:
78+
Look in the {file}`types.xml` file in your package's `example/conference/profiles/default` directory.
79+
It should now contain the following code.
7980

8081
```xml
8182
<object name="portal_types">
@@ -85,7 +86,7 @@ Look in the `types.xml` file in your packages
8586
</object>
8687
```
8788

88-
For the *Presenter* type, we have `example.conference.presenter.xml`:
89+
For the `Presenter` type, we have `example.conference.presenter.xml`.
8990

9091
```xml
9192
<?xml version="1.0"?>
@@ -112,4 +113,4 @@ For the *Presenter* type, we have `example.conference.presenter.xml`:
112113
</object>
113114
```
114115

115-
Note that this is addable anywhere.
116+
Note that this is may be added anywhere.

0 commit comments

Comments
 (0)