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
Now our package has a new configuration for Generic Setup.
117
-
Generic Setup loads a lot of different types of configuration for the site from folder {file}`profiles/`.
146
+
Generic Setup loads a lot of different types of configuration for the site from the folder {file}`profiles/`.
118
147
This configuration is applied to your site upon installing the package.
119
148
This also means that you will need to re-install the package once we are finished with the talk.
120
149
@@ -128,11 +157,10 @@ It is also the place where you would add widget options per field to control the
128
157
129
158
In the FTI we referenced the Python path `ploneconf.site.content.talk.ITalk`.
130
159
131
-
The module {py:mod}`content` does not exist.
132
-
Create a folder {file}`content` and add an empty {file}`__init__.py` in it.
133
-
From the training root that is {file}`backend/sources/ploneconf.site/src/ploneconf/site/content/__init__.py`.
160
+
The package {py:mod}`ploneconf.site.content` already exists.
161
+
Find it in at this path: {file}`backend/src/ploneconf/site/content`.
134
162
135
-
In this new folder add a file {file}`talk.py` with the following content:
163
+
In this folder add a new file {file}`talk.py` with the following content:
136
164
137
165
```{code-block} python
138
166
:linenos:
@@ -147,17 +175,15 @@ from plone.supermodel import model
147
175
from z3c.form.browser.checkbox import CheckBoxFieldWidget
148
176
from z3c.form.browser.radio import RadioFieldWidget
149
177
from zope.interface import implementer
150
-
from zope.schema.vocabulary import SimpleTerm
151
-
from zope.schema.vocabulary import SimpleVocabulary
152
178
153
179
154
180
class ITalk(model.Schema):
155
-
"""Dexterity-Schema for Talks"""
181
+
"""Dexterity schema for Talks"""
156
182
157
183
directives.widget(type_of_talk=RadioFieldWidget)
158
184
type_of_talk = schema.Choice(
159
185
title="Type of talk",
160
-
values=["talk", "training", "keynote"],
186
+
values=["Talk", "Training", "Keynote"],
161
187
required=True,
162
188
)
163
189
@@ -172,7 +198,7 @@ class ITalk(model.Schema):
172
198
audience = schema.Set(
173
199
title="Audience",
174
200
value_type=schema.Choice(
175
-
values=['beginner', 'advanced', 'professional'],
201
+
values=["Beginner", "Advanced", "Professional"],
176
202
),
177
203
required=False,
178
204
)
@@ -190,7 +216,7 @@ class ITalk(model.Schema):
190
216
191
217
email = Email(
192
218
title="Email",
193
-
description="Email adress of the speaker",
219
+
description="Email address of the speaker",
194
220
required=False,
195
221
)
196
222
@@ -199,11 +225,6 @@ class ITalk(model.Schema):
199
225
required=False,
200
226
)
201
227
202
-
twitter = schema.TextLine(
203
-
title="Twitter name",
204
-
required=False,
205
-
)
206
-
207
228
github = schema.TextLine(
208
229
title="Github username",
209
230
required=False,
@@ -231,27 +252,33 @@ The first class {py:class}`ITalk` is the schema for talks and defines quite a lo
231
252
232
253
- The fields in the schema are mostly from {py:mod}`zope.schema`.
233
254
- The most basic field is `schema.TextLine` which can store text.
234
-
- In the next chapter you will find a reference of all field-types available in Plone.
235
-
- The widget directives can be ignored by now, as we are implementing for a frontend app.
236
-
The widget directives like above do control the rendering of the fields in Plone Classic.
237
-
In the rare case that you need to tweak the rendering of a field in frontend, this can be done like described in {doc}`plone6docs:volto/development/widget`
255
+
- In the next chapter you will find a reference of all fieldtypes available in Plone.
256
+
- The widget directives can be ignored by now, as we are implementing for a Volto frontend.
257
+
The widget directives do control the rendering of the fields in Plone Blicca.
258
+
In the rare case that you need to tweak the rendering of a field in the frontend, this can be done as described in {doc}`plone6docs:volto/development/widget`.
238
259
239
260
240
261
## The instance class
241
262
242
263
The second class {py:class}`Talk` in {file}`talk.py` will be the class of instances for each talk.
243
264
It inherits from {py:class}`Container` which is one of the default classes of dexterity.
244
265
{py:class}`Container` is used for items that can contain other items.
245
-
It does nothing so far but it can be useful later when we want to add methods or properties to it that can be used directly from a talk instance.
266
+
It does nothing special so far, but it can be useful later when we want to add methods or properties to it that can be used directly from a talk instance.
267
+
246
268
247
269
## Try the new type
248
270
249
-
Now all pieces should be in place and you can enable the new type `Talk`.
271
+
Now all pieces should be in place and you can enable the new type `talk`.
250
272
251
-
- Restart Plone (to load the new Python code and the changed ZCML)
252
-
- You do not need to restart the Volto frontend since we did not do any changes there.
253
-
- Re-install the package ploneconf.site (deactivate and activate) to load the type registration and type configuration:
254
-
Follow the link "SITE SETUP" in the bottom of the toolbar and switch to "Add-Ons".
273
+
1. Restart Plone (to load the new Python code).
274
+
You do not need to restart the Volto frontend, since we did not do any changes there.
275
+
2. Reinstall the package ploneconf.site to apply the updated profile.
276
+
277
+
1. Go to {guilabel}`Site Setup`.
278
+
2. Open the {guilabel}`Add-Ons` control panel.
279
+
3. Find `PLONECONF SITE: INSTALL` in the list of installed add-ons and click to open its details.
280
+
4. Click the {guilabel}`Uninstall` button.
281
+
5. Find it again and click the {guilabel}`Install` button.
255
282
256
283
Now instances of the new type can be added.
257
284
Please check that you can add a talk to your site.
@@ -260,17 +287,16 @@ Please check that you can add a talk to your site.
260
287
Adding a talk in the frontend
261
288
```
262
289
263
-
- Test the type by adding a talk. Add some values in the fields, save it, look at the view and edit it again.
290
+
- Test the type by adding a talk. Add some values in the fields, save it, look at the view, and edit it again.
264
291
- Compare all the fields you see to the code in the schema.
265
-
- You can also make changes in the schema. After restarting the backend these changes are effective immediately.
266
-
- Find the tool `portal_types` in the ZMIhttp://localhost:8080/manage.
292
+
- You can also make changes in the schema. After restarting the backend, these changes are effective immediately.
293
+
- Find the tool `portal_types` in the ZMI: <http://localhost:8080/manage>.
267
294
Look at the FTI for type `talk` and inspect the configuration taken from the FTI.
268
-
269
-
You can make changes to the FTI here.
270
-
- A part of the configuration is also available in Plone control panels (SITE SETUP).
271
-
For example the content types control panel `http://localhost:3000/controlpanel/dexterity-types` allows to add behaviors to content types.
272
-
Please be aware that these changes are done on your site instance.
273
-
You can use the browser UI, but it's the add-on package where you configure your content types.
295
+
You can make changes to the FTI here.
296
+
- A part of the configuration is also available in Site Setup.
297
+
For example the [Content Types control panel](http://localhost:3000/controlpanel/dexterity-types) allows to add behaviors to content types.
298
+
Please be aware that these changes are done in your site database, but not on the filesystem.
299
+
You can use the browser UI, but then the configuration can get out of sync with your filesystem add-on package.
274
300
275
301
The field values of your talk instance are listed.
276
302
In one of the next chapters we will create a custom view for the new type.
@@ -280,12 +306,15 @@ In one of the next chapters we will create a custom view for the new type.
280
306
281
307
- You created a custom content type.
282
308
- You can now control the data that will be stored for talks.
283
-
- You can reuse and adapt these examples to model data for your own use-cases.
309
+
- You can reuse and adapt these examples to model data for your own usecases.
284
310
- Next up: After looking at even more fields that are available in Plone, you will learn to change how talks are displayed.
Copy file name to clipboardExpand all lines: docs/mastering-plone/dexterity_reference.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,13 @@ myst:
3
3
html_meta:
4
4
"description": "Fields and widgets"
5
5
"property=og:description": "Fields and widgets"
6
-
"property=og:title": "Content types: Reference"
6
+
"property=og:title": "Content types reference"
7
7
"keywords": "field, widget, schema"
8
8
---
9
9
10
10
(dexterity-reference-label)=
11
11
12
-
# Content types: Reference
12
+
# Content types reference
13
13
14
14
This chapter documents common fields, widgets, directives that you can use with content types.
15
15
Content types are often called dexterity types which refers to the rework of the content type concept by dexterity and abandoning the Archetypes system.
0 commit comments