Source

tw2.core-docs-pyramid / myapp / myapp / views.py

import tw2.core

def view_root(context, request):
    return {'items':list(context), 'project':'myapp'}

def view_model(context, request):
    return {'item':context, 'project':'myapp'}

def view_widget(context, request):
    context.fetch_data(request)
    mw = tw2.core.core.request_local()['middleware']
    mw.controllers.register(context, 'movie_submit')
    return {'widget':context}

def view_grid_widget(context, request):
    mw = tw2.core.core.request_local()['middleware']
    mw.controllers.register(context, 'db_jqgrid')
    return {'widget':context}