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_live, the_user
7 from plugins.querytable import QueryTable
10 class PlatformsView(FreeAccessView):
11 template_name = "platforms.html"
13 def get_context_data(self, **kwargs):
14 page = Page(self.request)
15 page.add_js_files ( [ "js/common.functions.js" ] )
16 platform_query = Query().get('local:platform').filter_by('disabled', '==', '0').select('platform','platform_longname','gateway_type')
17 #platform_query = Query().get('local:platform').select('platform','platform_longname','gateway_type')
18 page.enqueue_query(platform_query)
20 page.expose_js_metadata()
21 platformlist = QueryTable(
25 # this is the query at the core of the slice list
26 query = platform_query,
27 query_all = platform_query,
29 datatables_options = {
31 'bLengthChange' : True,
36 context = super(PlatformsView, self).get_context_data(**kwargs)
37 context['person'] = self.request.user
38 context['platforms'] = platformlist.render(self.request)
40 # XXX This is repeated in all pages
41 # more general variables expected in the template
42 context['title'] = 'Platforms connected to MySlice'
43 # the menu items on the top
44 context['topmenu_items'] = topmenu_items_live('Platforms', page)
45 # so we can sho who is logged
46 context['username'] = the_user(self.request)
48 context.update(page.prelude_env())
50 context['layout_1_or_2']="layout-unfold2.html" if not context['username'] else "layout-unfold1.html"