TurboGears / tgext.pluggable

Pluggable applications support for TurboGears2
11 stars 13 forks source link

Pluggable apps and admin panel #13

Open nomed opened 10 years ago

nomed commented 10 years ago

I created a tgext.pluggable app with its db tables.

How can i get them on the default /admin panel ?

barjomet commented 7 years ago

I know the question is three years old. Nowadays it can be done by passing list of models to AdminController. Just replace admin = AdminController(model, DBSession, config_type=TGAdminConfig) in your RootController with

admin = AdminController(
        [getattr(models, model_name)
         for models in (model, app_model.plugged('name_of_plugged_app_here'))
         for model_name in models.__all__],
        DBSession,
        config_type=TGAdminConfig)

And of course you also need to plug app with global_models=True option and do from tgext.pluggable import app_model above your RootController definition.