def test_filters(request): lst = Filter.get_all() res = [] for name in Filter.get_names(): res.append("<br><br>%s:" % name) tmp = Filter.execute([name], "OR") data = Filter.format_data(tmp, unicode) res.extend(data) return HttpResponse("<br>".join(res))
def test_filters_post(request): # TODO: extract filter params from post request # the full list of filters is obtained by Filter.get_names() filters = ["Zusatzabo Eier", "Depot GZ Oerlikon"] op = "AND" res = ["Eier AND Oerlikon:<br>"] locos = Filter.execute(filters, op) data = Filter.format_data(locos, lambda loco: "%s! (email: %s)" % (loco, loco.email)) res.extend(data) return HttpResponse("<br>".join(res))
def test_filters_post(request): # TODO: extract filter params from post request # the full list of filters is obtained by Filter.get_names() filters = ["Zusatzabo Eier", "Depot GZ Oerlikon"] op = "AND" res = ["Eier AND Oerlikon:<br>"] locos = Filter.execute(filters, op) data = Filter.format_data( locos, lambda loco: "%s! (email: %s)" % (loco, loco.email)) res.extend(data) return HttpResponse("<br>".join(res))