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
When we attempt to solve a particular content management problem with Plone, we will often design new content types.
13
13
For the purpose of this example, we'll build a simple set of types to manage tasks.
14
14
15
-
-A content type `Tasks` is used to hold all task objects and present a list of tasks to the user.
16
-
This type is folderish (Container).
17
-
-A content type `Task` with the information about the task.
18
-
Fields include name, description, and status of the task.
19
-
This type is non-folderish (Item).
15
+
- We will use a content type `Tasks` to hold all task objects and present a list of tasks to the user.
16
+
This type is folderish (`Container`).
17
+
- We will use a content type `Task` with the information about the task.
18
+
Fields include name, description, and status of the task.
19
+
This type is non-folderish (`Item`).
20
20
21
21
## Creating a Plone package
22
22
23
-
A content type is typically created inside a Plone package. We will use the {term}`plonecli` to create a Plone package and our content types.
23
+
We typically create a content type inside a Plone package.
24
+
We will use the {term}`plonecli` to create a Plone package and our content types.
24
25
25
-
```sh
26
-
$ plonecli create addon collective.tasks
26
+
```shell
27
+
plonecli create addon collective.tasks
27
28
cd collective.tasks
28
29
```
29
30
30
31
## Adding content types
31
32
32
33
Let's add a content type called `Tasks`:
33
34
34
-
```sh
35
-
$ plonecli add content_type
35
+
```shell
36
+
plonecli add content_type
36
37
```
37
38
38
-
fill in the name `Tasks` for the first content type:
39
+
Fill in the name `Tasks` for the first content type:
39
40
40
-
```sh
41
+
```console
41
42
-> Content type name (Allowed: _ a-z A-Z and whitespace) [Todo Task]: Tasks
42
43
```
43
44
44
-
we keep the default base class `Container` here:
45
+
We keep the default base class `Container` here:
45
46
46
-
```sh
47
+
```console
47
48
--> Dexterity base class (Container/Item) [Container]:
48
49
```
49
50
50
-
we keep the default `globally addable`:
51
+
We keep the default `globally addable`:
51
52
52
-
```sh
53
+
```console
53
54
--> Should the content type globally addable? [y]:
54
55
```
55
56
56
-
we want to filter content types, which can be added to this container:
57
+
We want to filter content types, which can be added to this container:
57
58
58
-
```sh
59
+
```console
59
60
--> Should we filter content types to be added to this container? [n]: y
60
61
```
61
62
62
-
we keep the default behaviors active:
63
+
We keep the default behaviors active:
63
64
64
-
```sh
65
+
```console
65
66
--> Activate default behaviors? [y]:
66
67
```
67
68
68
-
now let's add a content type called `Task`:
69
+
Now let's add a content type called `Task`:
69
70
70
-
```sh
71
-
$ plonecli add content_type
71
+
```shell
72
+
plonecli add content_type
72
73
```
73
74
74
-
fill in the name `Task` for the first content type:
75
+
Fill in the name `Task` for the first content type:
75
76
76
-
```sh
77
+
```console
77
78
-> Content type name (Allowed: _ a-z A-Z and whitespace) [Todo Task]: Task
78
79
```
79
80
80
-
we change the base class to `Item` here:
81
+
We change the base class to `Item` here:
81
82
82
-
```sh
83
+
```console
83
84
--> Dexterity base class (Container/Item) [Container]: Item
84
85
```
85
86
86
-
we don't want it to be globally addable `globally addable`:
87
+
We don't want it to be globally addable `globally addable`:
87
88
88
-
```sh
89
+
```console
89
90
--> Should the content type globally addable? [y]: n
90
91
```
91
92
92
-
if we disable globally addable, we will be ask a new question, for the parent content type, where we will answer `Tasks`:
93
+
If we disable `globally addable`, the next question will ask for the parent content type, where we will answer `Tasks`:
93
94
94
-
```sh
95
+
```console
95
96
--> Parent container portal_type name: Tasks
96
97
```
97
98
98
-
for the rest of the question we can keep the defaults.
99
+
For the rest of the questions, we can keep the defaults.
99
100
100
-
To test our new Plone package and it's content types, we can use {term}`plonecli` to build a development environment and start Plone.
101
+
To test our new Plone package and its content types, we can use {term}`plonecli` to build a development environment and start Plone.
101
102
102
-
```sh
103
-
$ plonecli build
104
-
$ plonecli serve
103
+
```shell
104
+
plonecli build
105
+
plonecli serve
105
106
```
106
107
107
-
Your Plone is now running on http://localhost:8080. You can add a new Plone site, enable your addon and add your content types.
108
+
Your Plone is now running on http://localhost:8080.
109
+
You can add a new Plone site, enable your add-on, and add your content types.
108
110
109
-
```{note}
110
-
{term}`plonecli` takes care of all the details of a content type and it's configuration, for more configuration details see {ref}`backend-content-types-fti-label`.
111
+
```{seealso}
112
+
{term}`plonecli` takes care of all the details of a content type and its configuration.
113
+
For more configuration details, see {doc}`fti`.
111
114
```
112
115
113
-
For now your content type don't have any custom schema with fields defined.
116
+
For now your content type doesn't have any custom schema with fields defined.
114
117
115
-
See {ref}`backend-schemas-label`, {ref}`backend-fields-label` and {ref}`backend-widgets-label` for information on how to add custom fields and widgets to your content type.
118
+
See {doc}`/backend/schemas`, {doc}`/backend/fields` and {doc}`/backend/widgets` for information on how to add custom fields and widgets to your content type.
116
119
117
-
Also have a look at Plone {ref}`backend-behaviors-label`, which provide default features you can enable on per content type basis.
120
+
Also have a look at Plone {doc}`/backend/behaviors`, which provide default features you can enable per content type.
0 commit comments