X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fhazelnut%2Fhazelnut.py;h=9509dc0a3ef2d73c07b5d100a72bd8a34a703257;hb=69651f9a5760ec0995dbe592cd5c01e174408808;hp=a54cde7553d852a2159969a442e1c05e7d02fd5b;hpb=5e7a8cc34122f08c80efb3f995db87a5de7a3840;p=myslice.git diff --git a/plugins/hazelnut/hazelnut.py b/plugins/hazelnut/hazelnut.py index a54cde75..9509dc0a 100644 --- a/plugins/hazelnut/hazelnut.py +++ b/plugins/hazelnut/hazelnut.py @@ -5,17 +5,27 @@ class Hazelnut (Plugin): # set checkboxes if a final column with checkboxes is desired # pass columns as the initial set of columns # if None then this is taken from the query's fields - def __init__ (self, query=None, query_all_uuid=None, checkboxes=False, columns=None, datatables_options={}, **settings): + def __init__ (self, query=None, query_all=None, checkboxes=False, columns=None, datatables_options={}, **settings): Plugin.__init__ (self, **settings) self.query = query - self.query_all_uuid = query_all_uuid + # Until we have a proper way to access queries in Python + self.query_all = query_all + self.query_all_uuid = query_all.query_uuid if query_all else None self.checkboxes=checkboxes + # XXX We need to have some hidden columns until we properly handle dynamic queries if columns is not None: self.columns=columns + self.hidden_columns = [] elif self.query: - self.columns=self.query.fields + self.columns = self.query.fields + if query_all: + # We need a list because sets are not JSON-serilizable + self.hidden_columns = list(self.query_all.fields - self.query.fields) + else: + self.hidden_columns = [] else: self.columns = [] + self.hidden_columns = [] self.datatables_options=datatables_options def template_file (self): @@ -43,4 +53,4 @@ class Hazelnut (Plugin): # the list of things passed to the js plugin def json_settings_list (self): - return ['plugin_uuid', 'domid', 'query_uuid', 'query_all_uuid', 'checkboxes','datatables_options'] + return ['plugin_uuid', 'domid', 'query_uuid', 'query_all_uuid', 'checkboxes', 'datatables_options', 'hidden_columns']