Exemple #1
0
 def get(self, *args, **kwargs):
     filters = Globals.parse_filters(self.request)
     results_dict = Objects.search(filters).get_dict()
     num_results = results_dict.pop('num_results')
     class Group:
         def __init__(self, name, rslts):
             self.name = name
             self.num_results = len(rslts)
             self.headers = list(set.union(
                 *(set(a.keys()) for a in rslts)
             ))
             class Item:
                 def __init__(self, d, headers):
                     self.fields = [
                         d.get(h, '') for h in headers
                     ]
             self.items = [Item(r, self.headers) for r in rslts]
     groups = enumerate(Group(*t) for t in results_dict.iteritems())
     self.render('templates/results.html', num_results=num_results, groups=groups)
Exemple #2
0
 def get(self, *args, **kwargs):
     filts = Globals.parse_filters(self.request)
     filters = [[f.query_string, f.query_type, f.fquery_string, f.fquery_type] for f in filts]
     self.render('templates/index.html')