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 plugins.simplelist import SimpleList
10 from myslice.viewutils import topmenu_items, the_user, hard_wired_slice_names
12 def test_plugin_view (request):
15 hard_wired_list.append("this hard-wired list")
16 hard_wired_list.append("is defined")
17 hard_wired_list.append("in <code>plugins.simplelist.py</code>")
18 hard_wired_list.append("which in turn relies on")
19 hard_wired_list.append("template <code>widget-template.html</code>")
20 hard_wired_list.append("while it should of course")
21 hard_wired_list.append("instead issue a query")
22 hard_wired_list.append("and fill the DOM in js from there")
23 hard_wired_list.append("it would however maybe make sense")
24 hard_wired_list.append("to offer the option to 'datatablify'")
25 hard_wired_list.append("the list from the python code")
26 hard_wired_list.append("just like a standard plugin can be set as visible or not")
27 hard_wired_list.append("")
28 hard_wired_list.append("OTOH and IMHO, there should be two separate and explicit subclasses of SimpleList for slices or testbeds")
30 plugin_main = SimpleList (visible=True,
34 foo='the value for foo')
35 content_main = plugin_main.render (request)
37 # lacks a/href to /slice/%s
38 plugin_related = SimpleList (visible=True, hidable=True,
39 need_datatables='yes',
40 list=hard_wired_slice_names,
42 content_related = plugin_related.render (request)
46 return render_to_response ('view-plugin.html',
47 {'title': 'Test Plugin View',
48 'topmenu_items': topmenu_items('plugin', request),
49 'content_main' : content_main,
50 'content_related' : content_related,
51 'username' : the_user (request),
53 context_instance=RequestContext(request))