Stuart,

you can have a look at base.py and provider.py in
https://github.com/moschlar/SAUCE/tree/develop/sauce/controllers/crc,
where I implemented exactly what you are trying for SQLAlchemy (in plain
Sprox/tgext.crud, but tgext.admin should be possible, too).
I plan on cleaning out the reusable parts and contributing it to Sprox
sometime...

Am 04.11.2013 19:43, schrieb Stuart Zurcher:
> Alesandro, thanks your for your quick reply.  You are correct. I need a
> subset of the collection.
>  I have the following and would like all users displayed who have
> groupname in groups from User in auth.py:
>            
>     class user(CrudRestControllerConfig):
>         class table_type(TableBase):
>             __entity__ = User
>             __limit_fields__ = ['display_name', 'email_address']
>             __url__ = '../user.json' #this just tidies up the URL a bit
>  
>         class table_filler_type(TableFiller):
>             __entity__ = User
>             __limit_fields__ = ['_id', 'display_name',  'email_address']
>         value =
> table_filler_type.get_value(table_filler_type(DBSession), values={},
> limit=20, offset=0, display_name='*SZURCHER')
> 
> I'm still trying to find out how to use it semantically.  The get_value
> runs thru _do_get_provider_count_and_objs and the entity is queried in
> sprox.mg.provider.py line 305 with the filter display_name.  The count
> for the query is 1.  However, the values are being filled from somewhere
> else as the all the users still get displayed.
> 
> 
> On Monday, November 4, 2013 9:53:31 AM UTC-6, Alessandro Molina wrote:
> 
>     You mean a subset of the entity (only part of the fields) or a
>     subset of the collection (only some of the entities)?
> 
>     I suppose you need to provide a subset of the collection, which is
>     the most common case.
>     In that case you can provide a custom TableFiller and override the
>     _do_get_provider_count_and_objs methods.
> 
>     The current TurboGears doc doesn't have a documentation entry for
>     that, but you can find some informations on the development
>     documention (which will be released as stable shortly anyway).
>     Look at the table_filler options:
>     
> http://turbogears.readthedocs.org/en/development/cookbook/Crud/index.html#options-reference
>     
> <http://turbogears.readthedocs.org/en/development/cookbook/Crud/index.html#options-reference>
> 
> 
>     On Mon, Nov 4, 2013 at 3:05 PM, Stuart Zurcher <[email protected]
>     <javascript:>> wrote:
> 
>         I have been looking around and have not found any documentation
>         or examples of providing a subset of the entity for admin.
> 
>         I would like to provide all users of a group for that group's
>         administrator.  I can hard code the forms but was wondering if
>         there is a simpler way with the admin module as I have several
>         of these type of instances which a simple solution would save
>         considerable time.
> 
>         -- 
>         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] <javascript:>.
>         To post to this group, send email to [email protected]
>         <javascript:>.
>         Visit this group at http://groups.google.com/group/turbogears
>         <http://groups.google.com/group/turbogears>.
>         For more options, visit https://groups.google.com/groups/opt_out
>         <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.

-- 
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.

Reply via email to