Skip to content

Commit

Permalink
fix overflow on IntegerField lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Apr 25, 2024
1 parent f8fdc38 commit 1a28864
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
model_fields.test_decimalfield
model_fields.test_charfield
model_fields.test_floatfield
model_fields.test_integerfield
model_fields.test_textfield
model_fields.test_uuid
or_lookups
Expand Down
3 changes: 3 additions & 0 deletions django_mongodb/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
"model_fields.test_uuid.TestQuerying.test_istartswith",
"model_fields.test_uuid.TestQuerying.test_startswith",
},
"QuerySet.update() with expression not supported.": {
"model_fields.test_integerfield.PositiveIntegerFieldTests.test_negative_values",
},
}
6 changes: 5 additions & 1 deletion django_mongodb/query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
from functools import wraps

from django.core.exceptions import FullResultSet
from django.db import DatabaseError, IntegrityError, NotSupportedError
from django.db.models.lookups import UUIDTextMixin
from django.db.models.query import QuerySet
Expand Down Expand Up @@ -174,7 +175,10 @@ def add_filters(self, filters, query=None):

continue

field, lookup_type, value = self._decode_child(child)
try:
field, lookup_type, value = self._decode_child(child)
except FullResultSet:
continue

if lookup_type in ("month", "day"):
raise DatabaseError("MongoDB does not support month/day queries.")
Expand Down

0 comments on commit 1a28864

Please sign in to comment.