The problem:
I have some hierarchical data in a Django application that will be passed on through to javascript. Some of this data will need to be filtered out from javascript based on the state of several data classes in the javascript. I need a way of defining the filters in the backend (Django) that will then be applied in javascript.
The filters should look like the following:
dataobject.key operator value
Filters can also be conditional:
if dataobject.key operator value
and dataobject.key2 operator value
or dataobject.key3 operator value
And probably any combination of conditionals such as:
if (condition and condition) or condition
Some keys will have a set of allowed values, and other keys will have free text fields. This system must be usable by business-type end-users otherwise there is no point in having this system at all. The primary goal is to have a system that is fully managed by the end-users. If most of these goals can be implemented, I'll consider it a win.
Is a rule engine appropriate for this scenario? Is there a python or django framework available for implementing this behaviour or any well defined patterns?
Update (Based on S.Lott's answer):
I'm not talking about filtering the data using the Django ORM. I want to pass all the data and all the rules to javascript, so the javascript application can remain 'disconnected'.
What I need is a way of having users define these rules and combinations of rules, and storing them in a database. Then when a page is loaded, this data and all the rules are retrieved and placed onto the page. The definition of the rules is the important piece of the puzzle.