On Mon, Sep 23, 2013 at 1:43 PM, Craig Small <[email protected]> wrote:
> On Sun, Sep 22, 2013 at 08:18:58AM +1000, Craig Small wrote: > > What I am trying to do in the admin controller is have a grid that gets > > its data from json and can show foreign keys. It's only the last bit > > I'm missing now. > I've worked out why my changes work for the normal controllers and not > for the admin. The normal controllers basically call: > MyTableFiller.get_value() > and returns that for json processing. My changes sit in that method. > > If I'm not wrong, in sprox is common practice to override _do_get_provider_count_and_objs because it is in charge of only retrieving data. While get_value is actually in charge of formatting it for the widget, so if you need to change the retrieved data you just override _do_get_provider_count_and_objs and it will cascade to get_value > At the very least the comment needs to be changed. I'm not sure why > the controller calls this private method instead of get_value but it does > explain the difference. > The controller calls _do_get_provider_count_and_objs when behaving like a JSON API because it needs the actual retrieved entities so that they can be encoded in JSON. While get_value formats the data to be displayed in a widget and performs additional conversions which are not correct for an API (like formatting dates in US format and removing any binary field and so on...) -- 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.

