[Grok-dev] schema.Object

Souheil CHELFOUH trollfot at gmail.com
Wed Jul 21 09:06:31 EDT 2010


ok, let me recreate that in a grok app and i'll give you some
feedback, if I get through it

2010/7/21 Sascha Boch <sascha.boch at gmx.de>:
> Ok, still no joy. The form is rendered fine but the "Fields: Object is of
> wrong type." keeps coming. Here's the code:
>
> class IFooField(interface.Interface):
>     name = schema.TextLine(title=u'Name', required = True)
>     label = schema.TextLine(title=u'Label', required = True)
>     format = schema.Choice(title=u'Field Format', required = True, values =
> ['Text', 'Date', 'Number'])
>
> class FooField(grok.Model):
>     grok.implements(IFooField)
>     name = FieldProperty(IFooField['name'])
>     label = FieldProperty(IFooField['label'])
>     format = FieldProperty(IFooField['format'])
>
> class IFoo(interface.Interface):
>     title=schema.TextLine(title=u'Title',required=True)
>     description=schema.TextLine(title=u'Description',required=False)
>     data_fields_ext = schema.List(title=u'Fields', required = False, unique
> = True,
>         value_type = schema.Object(title=u'Field', required = False, schema
> = IFooField))
>
> class Foo(grok.Application, grok.Container):
>     grok.implements(IFoo)
>     title = u'Foobar'
>     description = u''
>
> class FooEditForm(grok.EditForm):
>     grok.context(Foo)
>     grok.name('admin')
>
>     form_fields = grok.AutoFields(Foo)
>     object_widget = CustomWidgetFactory(ObjectWidget, FooField)
>     form_fields['data_fields_ext'].custom_widget =
> CustomWidgetFactory(SequenceWidget, subwidget=object_widget)
>     template = grok.PageTemplateFile('custom_edit_form.pt')
>
>
> --
> Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
> Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>
>


More information about the Grok-dev mailing list