Skip to content

Commit

Permalink
Add proper tagging with TokenFieldWidget which searches for
Browse files Browse the repository at this point in the history
existing values.
  • Loading branch information
Khairil Yusof committed Jul 18, 2012
1 parent 0813bf9 commit c4e299b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions buildout.cfg
@@ -1,8 +1,7 @@
[buildout]
develop = .
parts = scripts test omelette zopepy
extends = http://dist.plone.org/release/4.2rc2/versions.cfg
http://good-py.appspot.com/release/dexterity/1.2?plone=4.1.4
extends = http://dist.plone.org/release/4.2/versions.cfg
versions = versions

[instance]
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Expand Up @@ -29,6 +29,9 @@
'plone.app.dexterity',
'collective.autopermission',
'collective.portlet.collectionmultiview',
'collective.dexteritydiff',
'collective.z3cform.widgets',
'collective.dexteritytextindexer',
# -*- Extra requirements: -*-
'ipdb',
],
Expand Down
10 changes: 10 additions & 0 deletions src/sinar/corruptiontracker/__init__.py
Expand Up @@ -3,6 +3,16 @@

_ = MessageFactory("sinar.corruptiontracker")

from plone.autoform.interfaces import WIDGETS_KEY
from plone.directives.form.schema import TEMP_KEY
from plone.app.dexterity.behaviors.metadata import ICategorization
from zope import schema as _schema

_directives_values = ICategorization.queryTaggedValue(TEMP_KEY)
_directives_values.setdefault(WIDGETS_KEY, {})
widget = 'collective.z3cform.widgets.token_input_widget.TokenInputFieldWidget'
_directives_values[WIDGETS_KEY]['subjects'] = widget
_schema.getFields(ICategorization)['subjects'].index_name = 'Subject'

def initialize(context):
"""Initializer called when used as a Zope 2 product."""
2 changes: 2 additions & 0 deletions src/sinar/corruptiontracker/issue.py
Expand Up @@ -12,6 +12,8 @@
from z3c.relationfield.schema import RelationChoice
from plone.formwidget.contenttree import ObjPathSourceBinder
from plone.indexer import indexer
from collective.z3cform.widgets.token_input_widget import \
TokenInputFieldWidget

from sinar.corruptiontracker import _
from sinar.corruptiontracker.person import IPerson
Expand Down

0 comments on commit c4e299b

Please sign in to comment.