cosmetic
[unfold.git] / engine / views.py
1 # Create your views here.
2
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
7
8 from plugins.simplelist import SimpleList
9
10 from myslice.viewutils import topmenu_items, the_user, hard_wired_slice_names
11
12 def test_plugin_view (request):
13     
14     hard_wired_list=[]
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")
29
30     plugin_main = SimpleList (visible=True, 
31                               hidable=True, 
32                               list=hard_wired_list, 
33                               header='Hard wired', 
34                               foo='the value for foo')
35     content_main = plugin_main.render (request)
36
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, 
41                                  header='Slices' )
42     content_related = plugin_related.render (request)
43
44     
45
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),
52                                 },
53                                context_instance=RequestContext(request))
54