On Tue, Feb 5, 2013 at 5:32 PM, KONTRA, Gergely <[email protected]> wrote:
> Okay, started evaluating TG2 in the meantime :) > > I am playing with EasyCrudRestController now (full project is here: > https://bitbucket.org/pihentagy/mindeningyen-tg2) > > There is also a tutorial, which has been merged into the documentation for upcoming TG release which covers some spots of the TGAdmin and so EasyCrudRestController: https://turbogears2-wikir-tutorial.readthedocs.org/en/latest/ > Some questions (I don't know if these type of questions should go to TG2 > or to the sprox list) > 1.) I would like to add an extra computed field to the table view of the > items (items has many attempts), the number of attempts. As I see, it > should be possible: > __table_options__ = { '__add_fields__':{'more':None}, 'more': lambda filler, row:'hi' } __add_fields__ tell that there is the field and that no particular widget has to be used to display it and the 'more' entry tells to the table what is the value for more > 2.) As moschlar pointed out, if I declare a _name property for a model, > it will be used in a one-to-many relation. (they kindly posted > https://gist.github.com/moschlar/4714146 for me) But could it be used in > the other direction? Eg. item has many attempts. Attempt has a _name > property. But on the page http://127.0.0.1:8080/items/1/edit Attempts are > just ids. > Not sure about this, try to playing with dropdown_field_names on both sides of the relation (http://blog.axant.it/archives/457 here an example). It's been some time since I had to do something like so I don't have the answer ready right now :D > 3.) I would like to filter the items: I would display by default only > those items, which don't have successful attempts. Is it possible with > EasyCrudRestController? > > Any argument you pass to the URL that shows the table will be used to filter the table itself (like ?name=something). If you want more control over that simply create your own TableFiller and set it as table_filler inside the EasyCrudRestController declaration. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

