[Product-Developers] collective.z3cform.datagridfield + plone.app.relation.RelationList

Asko Soukka asko.soukka at iki.fi
Sat Dec 10 00:27:46 UTC 2011


Hi,

Roel Bruggink wrote:
> On Thu, Dec 1, 2011 at 5:58 PM, David Glick <davidglick at groundwire.org
> <mailto:davidglick at groundwire.org>> wrote:
>
>     On 12/1/11 8:44 AM, Roel Bruggink wrote:
>
>         I'm using a datagridfield in which I have a schema with a
>         RelationList [1].
>         When this form is saved the referenced objects are stored
>         instead of a RelationValue.
>
>         Does anyone have an idea on how to fix this?
>
>         [1] http://pastie.org/2950299
>
>     Maybe related to
>     http://code.google.com/p/__dexterity/issues/detail?id=180
>     <http://code.google.com/p/dexterity/issues/detail?id=180> ?

Actually, it is not, because my patch concerns only about storing 
RelationLists on dictionaries (RelationChoices already have their data 
manager). And yes, I should do tests for it before merge.

Instead, I think this needs adding working query-method for 
RelationDictDataManager (see also https://dev.plone.org/ticket/12031, 
I'm sorry for terrible language there).

> It's the same sort of thing, but datagridfield doesn't actually uses a
> datamanger to store the values, right?

I think it should use. I made branches that should store relation values 
with your example schema:

collective.z3cform.datagridfield = git 
git at github.com:datakurre/collective.z3cform.datagridfield.git 
branch=relationchoice-integration

plone.app.relationfield = git 
git at github.com:datakurre/plone.app.relationfield.git 
branch=datagridfield-integration

I modified GridDataConverter to use data managers (did pass the existing 
tests, but may have side effects) and added query-method for 
RelationDictDataManager (needs tests).

Yet, while editing the content on browser, I have to manually click one 
extra row to get the 'counter' incremented and my data saved (the widget 
starts with only one visible row).

I'm also confused by this hack, I needed for data manager's 
'query'-method to get z3c.formwidget.query return selected values correctly:

https://github.com/datakurre/plone.app.relationfield/commit/2f0ce3c40f0cf523eeac7adfd7a78b8db1890a68#L0R83

-Asko


More information about the Product-Developers mailing list