1 from manifold.core.query import Query
2 from unfold.page import Page
4 from unfold.loginrequired import FreeAccessView
5 from ui.topmenu import topmenu_items, the_user
7 from plugins.querytable import QueryTable
9 # View for 1 platform and its details
10 class PlatformView(FreeAccessView):
11 template_name = "platform.html"
13 def get_context_data(self, **kwargs):
14 page = Page(self.request)
15 page.add_js_files ( [ "js/common.functions.js" ] )
16 for key, value in kwargs.iteritems():
17 print "%s = %s" % (key, value)
18 if key == "platformname":
21 network_query = Query().get('local:platform')\
22 .filter_by('platform', '==', platformname)\
23 .select('platform','platform_longname','gateway_type')
24 page.enqueue_query(network_query)
26 page.expose_js_metadata()
28 networklist = QueryTable(
32 # this is the query at the core of the slice list
33 query = network_query,
34 query_all = network_query,
36 datatables_options = {
37 'iDisplayLength' : 25,
38 'bLengthChange' : True,
42 # networklist = SimpleList(
46 # query = network_query,
49 context = super(PlatformView, self).get_context_data(**kwargs)
50 context['person'] = self.request.user
51 context['networks'] = networklist.render(self.request)
53 # XXX This is repeated in all pages
54 # more general variables expected in the template
55 context['title'] = 'Platforms connected to MySlice'
56 # the menu items on the top
57 context['topmenu_items'] = topmenu_items('Platforms', self.request)
58 # so we can sho who is logged
59 context['username'] = the_user(self.request)
61 context.update(page.prelude_env())