<s> from pyramid . events import subscriber <EOL> from websauna . system . admin import menu <EOL> from websauna . system . admin . events import AdminConstruction <EOL> from websauna . system . admin . modeladmin import ModelAdminRoot <EOL> from websauna . system . core . traversal import Resource <EOL> @ subscriber ( AdminConstruction ) <EOL> def contribute_model_admin ( event ) : <EOL> """<STR_LIT>""" <EOL> admin = event . admin <EOL> request = event . admin . request <EOL> model_admin_root = ModelAdminRoot ( request ) <EOL> Resource . make_lineage ( admin , model_admin_root , "<STR_LIT>" ) <EOL> admin . children [ "<STR_LIT>" ] = model_admin_root <EOL> data_menu = admin . get_admin_menu ( ) . get_entry ( "<STR_LIT>" ) . submenu <EOL> for id , model_admin in model_admin_root . items ( ) : <EOL> entry = menu . TraverseEntry ( "<STR_LIT>" . format ( id ) , label = model_admin . title , resource = model_admin , name = "<STR_LIT>" ) <EOL> data_menu . add_entry ( entry ) </s>
