collective/collective.z3cform.datagridfield — Issue #2: NamedImage widgets do not retain content when modified
Author: zedr
Created: 2012-02-28 16:51:23+00:00
State: open

#Description

I have the following content type type defined:

class IImageRow(interface.Interface):
home_image = NamedImage(
title=_(u"Image"),
required=False,
)
url = schema.TextLine(title=_(u'URL'),
required=False)

class IMyContent(form.Schema):
"""My content type
"""
form.widget(gallery=DataGridFieldFactory)
gallery= schema.List(
title=_(u"A simple gallery of images"),
value_type=DictRow(schema=IImageRow),
required=True,
)

(...)

I can load and store a datagrid of images, but when I edit the content and save it, asking to "Keep the existing image", the reference to the image is not kept. The "url" is kept however.

#Steps to reproduce

##Actions
1. Define a datagridfield of NamedImages in code
2. Add the content in the site
3. Upload some images in the datagrid
4. Edit the content again
5. Save the content, keeping the existing images

##Outcome
* The stored images are lost

##Expected result
* The stored images should be kept