Context
_evaluate_conditions in forms_pro/api/submission.py currently handles only 4 of the 15 operators defined in the frontend ConditionalOperators enum:
| Implemented |
Not implemented |
| Is |
Contains |
| Is Not |
Does Not Contain |
| Is Empty |
Is Less Than |
| Is Not Empty |
Is Less Than Or Equal To |
|
Is Greater Than |
|
Is Greater Than Or Equal To |
|
Starts With |
|
Does Not Start With |
|
Ends With |
|
Does Not End With |
|
Is Set |
Current behaviour
An unsupported operator silently passes (the condition evaluates to True), so a form with a Contains condition will behave as if the condition is always met. This can cause fields to be incorrectly required or visible.
Fix
Implement the missing operators in _evaluate_conditions, mirroring the logic in frontend/src/utils/conditionals.ts. The frontend implementation is the reference — the backend must produce identical results for all operators so that direct API calls cannot bypass frontend validation.
Add tests for each new operator.
Context
_evaluate_conditionsinforms_pro/api/submission.pycurrently handles only 4 of the 15 operators defined in the frontendConditionalOperatorsenum:Current behaviour
An unsupported operator silently passes (the condition evaluates to
True), so a form with aContainscondition will behave as if the condition is always met. This can cause fields to be incorrectly required or visible.Fix
Implement the missing operators in
_evaluate_conditions, mirroring the logic infrontend/src/utils/conditionals.ts. The frontend implementation is the reference — the backend must produce identical results for all operators so that direct API calls cannot bypass frontend validation.Add tests for each new operator.