1 from django.views.generic.base import TemplateView
3 from manifold.core.query import Query
4 from unfold.page import Page
6 from myslice.viewutils import topmenu_items, the_user
8 from plugins.hazelnut import Hazelnut
11 class PlatformsView(TemplateView):
12 template_name = "platforms.html"
14 def get_context_data(self, **kwargs):
15 page = Page(self.request)
17 #network_query = Query().get('local:platform').filter_by('disabled', '==', '0').select('platform','platform_longname','gateway_type')
18 network_query = Query().get('local:platform').select('platform','platform_longname','gateway_type')
19 page.enqueue_query(network_query)
21 page.expose_js_metadata()
23 networklist = Hazelnut(
27 # this is the query at the core of the slice list
28 query = network_query,
29 query_all = network_query,
31 datatables_options = {
32 # for now we turn off sorting on the checkboxes columns this way
33 # this of course should be automatic in hazelnut
34 'aoColumns' : [None, None, None, None, {'bSortable': False}],
35 'iDisplayLength' : 25,
36 'bLengthChange' : True,
40 # networklist = SimpleList(
44 # query = network_query,
47 context = super(PlatformsView, self).get_context_data(**kwargs)
48 context['person'] = self.request.user
49 context['networks'] = networklist.render(self.request)
51 # XXX This is repeated in all pages
52 # more general variables expected in the template
53 context['title'] = 'Platforms connected to MySlice'
54 # the menu items on the top
55 context['topmenu_items'] = topmenu_items('Platforms', self.request)
56 # so we can sho who is logged
57 context['username'] = the_user(self.request)
59 context.update(page.prelude_env())