views:

11

answers:

0

As far as I have understood, a django filter is just a python function which could be used in a html page. I need to do some thing like this - I need to group functions / django filters as python classes. For example, if I have a filter to do list operation like: {{ my_list|index:3 }} which will return the 3rd item of my_list. I have another filter like {{ my_list|append:"another item" }} which will append the given string to my_list. Now I need to group these filters in a class called 'listOperations' so that it will be easy for me to logically maintain the reusable filters in an organized way ..

As far as I have tried, django alows to have a python function call back for a filter, but not a class definition. i.e., my filter - {{ my_list|listOperations.index:3 }} did not work for me :( Could any one suggest some method for this? does django support this sort of requirements?