1 # Create your views here.
3 from django.core.context_processors import csrf
4 from django.template import RequestContext
5 from django.template.loader import render_to_string
6 from django.shortcuts import render_to_response
8 from django.contrib.auth.decorators import login_required
10 from unfold.page import Page
11 from manifold.manifoldquery import ManifoldQuery
13 from plugins.stack.stack import Stack
14 from plugins.tabs.tabs import Tabs
15 from plugins.lists.staticlist import StaticList
16 from plugins.quickfilter.quickfilter import QuickFilter
17 from plugins.querycode.querycode import QueryCode
18 from plugins.raw.raw import Raw
19 from plugins.messages.messages import Messages
20 from plugins.hazelnut.hazelnut import Hazelnut
21 from plugins.updater.updater import Updater
23 from myslice.viewutils import topmenu_items, the_user
24 from myslice.viewutils import hard_wired_slice_names, hard_wired_list, lorem_p, lorem, quickfilter_criterias
27 def test_plugin_view (request):
31 # variables that will get passed to this template
34 slicename='ple.inria.omftest'
35 main_query = ManifoldQuery (action='get',
38 fields=['network','type','hrn','hostname'],
39 filters= [ [ 'slice_hrn', '=', slicename, ] ],
41 # don't run this one as nothing listens to this
42 page.enqueue_query (main_query, run_it=False)
59 title="Runtime messages",
65 # define 'unfold1_main' to the template engine
66 template_env [ 'unfold1_main' ] = main_plugin.render(request)
68 # more general variables expected in the template
69 template_env [ 'title' ] = 'Single Plugin View'
70 template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
71 template_env [ 'username' ] = the_user (request)
73 # run queries when we have any
74 page.expose_queries ()
76 # the prelude object in page contains a summary of the requirements() for all plugins
77 # define {js,css}_{files,chunks}
78 prelude_env = page.prelude_env()
79 template_env.update(prelude_env)
80 return render_to_response ('view-unfold1.html',template_env,
81 context_instance=RequestContext(request))