Skip to content
Browse files

Add proper tagging with TokenFieldWidget which searches for

existing values.
  • Loading branch information...
1 parent 0813bf9 commit c4e299b0c4f7c64ca04af982dd692800bd05a123 Khairil Yusof committed Jul 18, 2012
Showing with 16 additions and 2 deletions.
  1. +1 −2 buildout.cfg
  2. +3 −0 setup.py
  3. +10 −0 src/sinar/corruptiontracker/__init__.py
  4. +2 −0 src/sinar/corruptiontracker/issue.py
View
3 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]
View
3 setup.py
@@ -29,6 +29,9 @@
'plone.app.dexterity',
'collective.autopermission',
'collective.portlet.collectionmultiview',
+ 'collective.dexteritydiff',
+ 'collective.z3cform.widgets',
+ 'collective.dexteritytextindexer',
# -*- Extra requirements: -*-
'ipdb',
],
View
10 src/sinar/corruptiontracker/__init__.py
@@ -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."""
View
2 src/sinar/corruptiontracker/issue.py
@@ -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

0 comments on commit c4e299b

Please sign in to comment.
Something went wrong with that request. Please try again.