|
1 | 1 | --- |
2 | 2 | myst: |
3 | 3 | html_meta: |
4 | | - "description": "" |
5 | | - "property=og:description": "" |
6 | | - "property=og:title": "" |
7 | | - "keywords": "" |
| 4 | + "description": "Miscellaneous contributor contributed recipes for content types and schema in Plone" |
| 5 | + "property=og:description": "Miscellaneous contributor contributed recipes for content types and schema in Plone" |
| 6 | + "property=og:title": "Miscellaneous contributor contributed recipes for content types and schema in Plone" |
| 7 | + "keywords": "Plone, miscellaneous, recipes, content types" |
8 | 8 | --- |
9 | 9 |
|
10 | | -# Miscellaneous |
| 10 | +# Miscellaneous recipes |
11 | 11 |
|
12 | | -## User contributed recipes |
| 12 | +## Hiding a field |
13 | 13 |
|
14 | | -**How to hide a field on a schema if we do not want to or cannot modify the original schema** |
15 | | - |
16 | | -To do this one can use tagged values on the schema. In this case want to hide 'introduction' and 'answers' fields: |
| 14 | +On occasion you may want to hide a field in a schema without modifying the original schema. |
| 15 | +To do this, you can use tagged values on the schema. |
| 16 | +In this example, you would hide the `introduction` and `answers` fields: |
17 | 17 |
|
18 | 18 | ```python |
19 | 19 | from example.package.content.assessmentitem import IAssessmentItem |
20 | 20 | from plone.autoform.interfaces import OMITTED_KEY |
21 | 21 | IAssessmentItem.setTaggedValue(OMITTED_KEY, |
22 | | - [(Interface, 'introduction', 'true'), |
23 | | - (Interface, 'answers', 'true')]) |
| 22 | + [(Interface, "introduction", "true"), |
| 23 | + (Interface, "answers", "true")]) |
24 | 24 | ``` |
25 | 25 |
|
26 | | -This code can sit in another.package.\_\_init\_\_.py for example. |
27 | | - |
28 | | -See also: [Original thread on coredev mailinglist] |
29 | | - |
30 | | -[original thread on coredev mailinglist]: http://plone.293351.n2.nabble.com/plone-autoform-why-use-tagged-values-td7560956.html |
| 26 | +This code can reside in {file}`another.package.__init__.py`. |
0 commit comments