64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
from five import grok
|
|
from zope import schema
|
|
from zope.interface import implements
|
|
from zope.component import adapts, provideAdapter
|
|
from z3c.relationfield.interfaces import IHasRelations
|
|
|
|
from z3c.relationfield.schema import RelationChoice
|
|
from plone.formwidget.contenttree import ObjPathSourceBinder
|
|
from plone.dexterity.content import Item
|
|
from plone.app.textfield import RichText
|
|
from plone.namedfile.field import NamedImage
|
|
|
|
from plone.app.content.interfaces import INameFromTitle
|
|
from plone.directives import form, dexterity
|
|
|
|
from themis.datatypes.interfaces import MessageFactory as _
|
|
|
|
from themis.datatypes.polgroup import IPolGroup
|
|
|
|
class IDeputy(form.Schema):
|
|
firstname = schema.TextLine(title=_(u'First Name'))
|
|
lastname = schema.TextLine(title=_(u'Last Name'))
|
|
active = schema.Bool(title=_(u'Active'), default=True)
|
|
sex = schema.Choice(title=_(u'Sex'), values=('M', 'F'), required=False)
|
|
birthdate = schema.Date(title=_(u'Birthdate'), required=False)
|
|
polgroup = RelationChoice(
|
|
title=_(u"Political Group"),
|
|
source=ObjPathSourceBinder(object_provides=IPolGroup.__identifier__),
|
|
required=False)
|
|
district = schema.TextLine(title=_(u'District'), required=False)
|
|
|
|
birthplace = schema.TextLine(title=_(u'Birthplace'), required=False)
|
|
bio = schema.Text(title=_(u'Bio'), required=False)
|
|
picture = NamedImage(title=_(u'Picture'), required=False)
|
|
website = schema.TextLine(title=_(u'Website'), required=False)
|
|
degrees = schema.Text(title=_(u'Degrees'), required=False)
|
|
mandates = schema.Text(title=_(u'Other Mandates'), required=False)
|
|
|
|
|
|
class INameFromPersonNames(INameFromTitle):
|
|
def title():
|
|
'''Return a processed title'''
|
|
|
|
class NameFromPersonNames(object):
|
|
implements(INameFromPersonNames)
|
|
|
|
def __init__(self, context):
|
|
self.context = context
|
|
|
|
@property
|
|
def title(self):
|
|
return self.context.firstname + ' ' + self.context.lastname
|
|
|
|
class Deputy(Item):
|
|
implements(IDeputy, IHasRelations)
|
|
|
|
@property
|
|
def title(self):
|
|
return self.firstname + ' ' + self.lastname
|
|
|
|
def setTitle(self, value):
|
|
pass
|
|
|