[Product-Developers] overriding widget of the subjects field with dexterity
Gonzalo Almeida
flecox at gmail.com
Wed Apr 11 21:44:50 UTC 2012
Hi everyone,
I've created a new z3c widget and I want that widget to replace the
actual widget of the subject field.
right now the subject field is provided by a dexterity behavior.. this
is the code of that behavior:
class ICategorization(form.Schema):
# categorization fieldset
form.fieldset(
'categorization',
label=_(u'Categorization'),
fields=['subjects', 'language'],
)
subjects = schema.Tuple(
title = _(u'label_categories', default=u'Categories'),
description = _(u'help_categories', default=u'Also known as
keywords, tags or labels, these help you categorize your content.'),
value_type = schema.TextLine(),
required = False,
missing_value = (),
)
form.widget(subjects = TextLinesFieldWidget)
what I want to do, is to override the part:
form.widget(subjects = TextLinesFieldWidget) to
form.widget(subjects = MyFieldWidget)
I've tried to do it with a new behavior .. but it's repeating the fields..
I don't want to change the widget for all Tuple fields I just want to
change the widget for the subject field.
I thought may be overriding the ICategorization behavior.. but I
couldn't find a way to override a behavior
anyone know how can I achieve this in dexterity?
thanks in advance
--
Linux user #466939
More information about the Product-Developers
mailing list