SEBA-804 add regex and contains to api
Change-Id: Idf437c0fcd2a1c5fd113738184495b95de412a4a
diff --git a/xos/coreapi/apihelper.py b/xos/coreapi/apihelper.py
index 005bed3..2c6d012 100644
--- a/xos/coreapi/apihelper.py
+++ b/xos/coreapi/apihelper.py
@@ -471,6 +471,14 @@
q = Q(**{element.name + "__gte": value})
elif element.operator == element.IEXACT:
q = Q(**{element.name + "__iexact": value})
+ elif element.operator == element.CONTAINS:
+ q = Q(**{element.name + "__contains": value})
+ elif element.operator == element.ICONTAINS:
+ q = Q(**{element.name + "__icontains": value})
+ elif element.operator == element.REGEX:
+ q = Q(**{element.name + "__regex": value})
+ elif element.operator == element.IREGEX:
+ q = Q(**{element.name + "__iregex": value})
else:
raise Exception("unknown operator")
diff --git a/xos/coreapi/protos/common.proto b/xos/coreapi/protos/common.proto
index 5f82f7d..6005ac8 100644
--- a/xos/coreapi/protos/common.proto
+++ b/xos/coreapi/protos/common.proto
@@ -14,6 +14,10 @@
GREATER_THAN_OR_EQUAL = 3;
LESS_THAN_OR_EQUAL = 4;
IEXACT = 5;
+ CONTAINS = 6;
+ ICONTAINS = 7;
+ REGEX = 8;
+ IREGEX = 9;
}
QueryOperator operator = 1;
bool invert = 2;