1 from django.views.generic.base import TemplateView
3 from manifold.core.query import Query
4 from unfold.page import Page
6 from ui.topmenu 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 #platform_query = Query().get('local:platform').filter_by('disabled', '==', '0').select('platform','platform_longname','gateway_type')
18 platform_query = Query().get('local:platform').select('platform','platform_longname','gateway_type')
19 page.enqueue_query(platform_query)
21 page.expose_js_metadata()
23 platformlist = Hazelnut(
27 # this is the query at the core of the slice list
28 query = platform_query,
29 query_all = platform_query,
31 datatables_options = {
33 'bLengthChange' : True,
38 context = super(PlatformsView, self).get_context_data(**kwargs)
39 context['person'] = self.request.user
40 context['platforms'] = platformlist.render(self.request)
42 # XXX This is repeated in all pages
43 # more general variables expected in the template
44 context['title'] = 'Platforms connected to MySlice'
45 # the menu items on the top
46 context['topmenu_items'] = topmenu_items('Platforms', self.request)
47 # so we can sho who is logged
48 context['username'] = the_user(self.request)
50 context.update(page.prelude_env())