permit the establishment of a field with the name of size or other
Example: # model class Example(Document): size = ReferenceField(Size, verbose_name='Size') # query examples = Example.objects(size=instance_size) # caused an error """ File ".../mongoengine/queryset/transform.py", line 50, in query if parts[-1] == 'not': IndexError: list index out of range """
This commit is contained in:
parent
5bcc454678
commit
70b320633f
@ -43,11 +43,11 @@ def query(_doc_cls=None, _field_operation=False, **query):
|
|||||||
parts = [part for part in parts if not part.isdigit()]
|
parts = [part for part in parts if not part.isdigit()]
|
||||||
# Check for an operator and transform to mongo-style if there is
|
# Check for an operator and transform to mongo-style if there is
|
||||||
op = None
|
op = None
|
||||||
if parts[-1] in MATCH_OPERATORS:
|
if len(parts) > 1 and parts[-1] in MATCH_OPERATORS:
|
||||||
op = parts.pop()
|
op = parts.pop()
|
||||||
|
|
||||||
negate = False
|
negate = False
|
||||||
if parts[-1] == 'not':
|
if len(parts) > 1 and parts[-1] == 'not':
|
||||||
parts.pop()
|
parts.pop()
|
||||||
negate = True
|
negate = True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user