org_mod.add_menu('About Us', 'organization.default' ) # ############################################################################## # side panel menu org_mod.add_side_menu( 'Organization/Officers', # Side panel title [ ( 'Update Offices', 'organization.update_offices' ), ( 'Update Officers', 'organization.edit_officer' ), ( 'Edit About Us', 'organization.edit_aboutus') ], 'admin' ) # ############################################################################## # Load the module implementation import models # filename: models.py import views # filename: views.py # attach module to website add_content_module( org_mod ) # register our data models register_data_models([ models.Office, models.Officer ])
from base.module import ContentModule # ######################################################################3####### # Initialization newsMod = ContentModule('news', __name__) newsMod.add_menu('News', 'news.default' ) newsMod.add_side_menu( 'News', [ ('Add Post', 'news.add_post'), ('List Posts', 'news.admin_list_posts') ], 'admin' ) import models import views # ######################################################################3####### # Hooking into main website add_content_module( newsMod ) # ######################################################################3####### # Register data models register_data_models( [ models.NewsPost, models.NewsPostComment ] )
seminar_mod.add_menu('Seminars', 'seminars.default') # ############################################################################## # Add a side panel menu seminar_mod.add_side_menu( 'Seminars', # Side panel title [ ( 'Add Seminar', 'seminars.add_seminar' ), ( 'Edit Seminars', 'seminars.update_seminars' ), ( 'Edit Talks', 'seminars.update_talks' ) ], 'seminar-organizer' ) # ############################################################################## # Load the module implementation import models # filename: models.py import views # filename: views.py # attach module to website add_content_module( seminar_mod ) # register our data models register_data_models([ models.Seminar, models.Talk ]) # register user roles register_user_role('seminar-organizer')
# ######################################################################3####### # Initialization articles_mod = ContentModule('articles', __name__) articles_mod.add_menu('Articles', 'articles.default' ) articles_mod.add_side_menu( 'Articles', [ ('Add Article', 'articles.add_article'), ('Edit Articles', 'articles.update_articles') ], 'contributor' ) import models import views # ######################################################################3####### # Hooking into main website add_content_module( articles_mod ) # ######################################################################3####### # Register data models register_data_models( [ models.Article, models.Article_Comment ] ) # ############################################################################## # register user roles register_user_role('contributor')
# define aux objects #templates_obj = AutoIndex(admin_mod, browse_root="static" ) # ############################################################################## # Add admin side panel menu admin_mod.add_side_menu( 'Administration', # Side panel title [ # A link which will be in the side-menu # the format is: ([Name], [target]) ( 'Database', 'ifadmin.database_admin' ), ( 'Users', 'ifadmin.user_admin' ), ( 'Modules', 'ifadmin.modules_admin' ), ( 'Templates', 'ifadmin.templates_admin' ), ( 'Static Files', 'ifadmin.static_admin' ) ], 'admin' ) # ############################################################################## # Load views import views # filename: views.py # ############################################################################## # Finally we hook the module into the main website add_content_module( admin_mod )
( 'Item 1', 'example.callback' ), ( 'Item 2', 'example.callback' ), ( 'Item 3', 'example.another_callback' ), ( 'Item 4', 'example.another_callback' ) ] ) # ############################################################################## # Load the module implementation # Here we have split the module into two parts models and views. The # views will govern how the user interacts with the content, and will determine # how we extend the main template: layout.html. In addition, the models consist of # database objects which this module implements and uses. # import models # filename: models.py import views # filename: views.py # ############################################################################## # Finally we hook the module into the main website # we do this by calling the function add_content_module( [module obj] ) # after we have imported all the relavent implementations. And we call # the function register_data_model( [datamodel type] ) to inform the admin # system about the models we have defined in this module # attach module to website add_content_module( example_mod ) # register our data models register_data_models([ models.ExampleTag ])
# ############################################################################## # Module: usertools # Synop: A collection of views which allow the user to update his/her profile # and provides a sidepane menu including links for logout, and others # actions # Menus: # Main menu: none # Side menu: user info access, and logout # from base import add_content_module, register_data_models, url_for from base.module import ContentModule from base.user import Role, User usertools_mod = ContentModule('usertools', __name__) usertools_mod.add_side_menu( 'User', # Side panel title [ ( 'Update Information', 'user_update' ), ( 'Logout', 'auth_logout' ) ] ) # attach module to website add_content_module( usertools_mod ) register_data_models([User, Role])