-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added first draft of additional fields for education person
- Loading branch information
1 parent
685a4af
commit 45c82ac
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:browser="http://namespaces.zope.org/browser" | ||
xmlns:plone="http://namespaces.plone.org/plone" | ||
xmlns:zcml="http://namespaces.zope.org/zcml" | ||
i18n_domain="collective.person" | ||
> | ||
|
||
<include | ||
package="plone.behavior" | ||
file="meta.zcml" | ||
/> | ||
|
||
<!-- EduPerson Behavior --> | ||
<plone:behavior | ||
name="plone.edu.eduperson" | ||
title="Education Person Behavior" | ||
description="Fields with education person information" | ||
provides=".eduperson.IEduPersonData" | ||
/> | ||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from plone.autoform.interfaces import IFormFieldProvider | ||
from plone.edu import _ | ||
from plone.namedfile.field import NamedBlobImage | ||
from plone.schema import Email | ||
from plone.schema import JSONField | ||
from plone.supermodel import model | ||
from zope.interface import provider | ||
from zope.schema import TextLine | ||
|
||
|
||
import json | ||
|
||
AFFILIATION_SCHEMA = json.dumps( | ||
{ | ||
'type': 'object', | ||
'properties': {'items': {'type': 'array', 'items': {'type': 'object', 'properties': {}}}}, | ||
} | ||
) | ||
|
||
@provider(IFormFieldProvider) | ||
class IEduPersonData(model.Schema): | ||
"""A Person in context of educational institutions.""" | ||
|
||
academic_title = TextLine( | ||
title=_("label_academic_title", default="Academic title"), | ||
description=_("help_academic_title", default="The academic titles of the person."), | ||
required=False, | ||
) | ||
|
||
image = NamedBlobImage( | ||
title=_("label_image", default="Person image"), | ||
description=_("help_image", default="A picture of the person."), | ||
required=False, | ||
) | ||
|
||
affiliation = JSONField( | ||
title='Mixedfield: datagrid field for Plone', | ||
required=False, | ||
schema=AFFILIATION_SCHEMA, | ||
widget='affiliation_widget', | ||
default={'items': []}, | ||
missing_value={'items': []}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters