diff --git a/themis/fields/__init__.py b/themis/fields/__init__.py index 219b2dd..19d31d2 100644 --- a/themis/fields/__init__.py +++ b/themis/fields/__init__.py @@ -22,6 +22,9 @@ from themis.fields.vocabs import DeputiesAndMinistriesSource from themis.fields.interfaces import IContact, IContacts from themis.fields.vocabs import ContactsSource +from themis.fields.interfaces import ISpeakers +from themis.fields.vocabs import SpeakersSource + from themis.fields.interfaces import IDateOnly from themis.fields.interfaces import IRadioChoice from themis.fields.interfaces import ISubjects, ILegisSession, IList @@ -334,6 +337,23 @@ class DeputiesOrMinistries(Field): super(DeputiesOrMinistries, self).__init__(**kw) + +class Speakers(Field): + implements(ISpeakers, IList) + _type = list + + def __init__(self, **kw): + self.required = False + self.value_type = SourcedChoice(source=SpeakersSource()) + self.unique = True + self.min_length = None + self.max_length = None + + for attr in ('min_length', 'max_length', 'unique', 'value_type'): + if attr in kw: del kw[attr] + super(Speakers, self).__init__(**kw) + + class DateOnly(Field): implements(IDateOnly) min = None diff --git a/themis/fields/editors.py b/themis/fields/editors.py index 305d0d7..6e008c5 100644 --- a/themis/fields/editors.py +++ b/themis/fields/editors.py @@ -11,6 +11,7 @@ from themis.fields import LegisSession from themis.fields import Contact, Contacts from themis.fields import Deputy, Deputies from themis.fields import Ministry, Ministries +from themis.fields import Speakers from themis.fields import DeputyOrMinistry, DeputiesOrMinistries from themis.fields import RelatedDoc from themis.fields import RelatedDocs @@ -43,6 +44,8 @@ MinistriesFactory = FieldFactory(Ministries, u'Ministries') DeputyOrMinistryFactory = FieldFactory(DeputyOrMinistry, u'Deputy or Ministry') DeputiesOrMinistriesFactory = FieldFactory(DeputiesOrMinistries, u'Deputies or Ministries') +SpeakersFactory = FieldFactory(Speakers, u'Speakers') + LegisSessionFactory = FieldFactory(LegisSession, u'Legislative Session') DateOnlyFactory = FieldFactory(DateOnly, u'Date') diff --git a/themis/fields/editors.zcml b/themis/fields/editors.zcml index a74b804..4025b28 100644 --- a/themis/fields/editors.zcml +++ b/themis/fields/editors.zcml @@ -62,6 +62,11 @@ component=".editors.DeputiesOrMinistriesFactory" /> + + + + + +