Support datetime ranges in field queries

This commit is contained in:
allegroai 2022-09-29 19:15:50 +03:00
parent 9c118d14e0
commit 7772f47773

View File

@ -368,6 +368,15 @@ class GetMixin(PropsMixin):
if data is not None: if data is not None:
if not isinstance(data, list): if not isinstance(data, list):
data = [data] data = [data]
# date time fields also support simplified range queries. Check if this is the case
if len(data) == 2 and not any(
d.startswith(mod)
for d in data
if d is not None
for mod in ACCESS_MODIFIER
):
query &= cls.get_range_field_query(field, data)
else:
for d in data: # type: str for d in data: # type: str
m = ACCESS_REGEX.match(d) m = ACCESS_REGEX.match(d)
if not m: if not m: