It's a current issue in sprox that tries to resolve list of values as
relationships.
Which in case of list of subdocuments doesn't make much sense.
I'm going to report a ticket for this on sprox and try to write a test unit
to reproduce the issue and fix it.
In the mean time you can work-around it by omitting the field in the admin
configuration or providing an explicit value for the field when rendering
the column
Here is a snippet modified from an existing project:
class UserAdminController(EasyCrudRestController):
__table_options__ = {'__omit_fields__': ['_id'],
'__xml_fields__': ['facebook_friends'],
'facebook_friends': lambda filler, row:
h.format_facebook_friends(row.facebook_friends)}
h.format_facebook_friends is just an helper that formats nicely the list in
HTML.
Then you can see how to tell tg admin to use your customized version of the
controller on the TG documentation itself:
http://turbogears.readthedocs.org/en/latest/turbogears/wikier/admin.html#custom-admin-config
On Wed, Nov 13, 2013 at 5:02 PM, Stuart Zurcher <[email protected]>wrote:
> I have tried:
>
> name = FieldProperty(s.FancySchemaItem())
>>
>
> name = FieldProperty(s.Array(s.FancySchemaItem()))
>>
>
> name = FieldProperty(s.Array(dict(name1=str, name2=str))) #most accurate
>>
>
> None of the above work with tg.admin
>
>
> On Friday, November 8, 2013 9:19:59 AM UTC-6, Stuart Zurcher wrote:
>>
>> I have a collection with a nested fieldproperty:
>>
>>> name = fieldproperty(
>>> [
>>> dict(
>>> fieldName=str,
>>> fieldName2=str
>>> )])
>>>
>>
>> tg.admin on the collection raises KeyError in __getattr__(self, k) of
>> ming.odm.icollection.InstrumentedObj:
>>
>> Invalid search query "": <class 'ming.odm.icollection.InstrumentedObj'>
>>>
>> The page is shown with an empty table.
>>
>> Doing a simple collectionClassName.query.find().first() returns normal
>> results for the table schema.
>>
>> Anyone else have this problem? Work around?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.