I am trying to manipulate two objects for a calculation, however I am getting the error:"Invalid filter"
In the html frontend I have a nested loop with objects: units and person as following:
{{units|myFilter:person}}
where units has several objects and person only has one.
my filter is defined by:
def myFilter(units,person):
n = 0
for i in units:
if i.name == person.name:
n = n + 1
return n
But is it not working, any ideas or suggestions please?