Skip to content

Commit 992e167

Browse files
committed
INTPYTHON-348 Add support for QuerySet.raw()
- Partial fix for datefield converter bug
1 parent 8e31bb6 commit 992e167

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

django_mongodb/compiler.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,20 @@ def explain_query(self):
630630
result.append(f"{key}: {formatted_value}")
631631
return result
632632

633+
def apply_converters(self, rows, converters):
634+
connection = self.connection
635+
converters = list(converters.items())
636+
for row in rows:
637+
for pos, (convs, expression) in converters:
638+
try:
639+
value = list(row.values())[pos]
640+
except AttributeError:
641+
value = row[pos]
642+
for converter in convs:
643+
value = converter(value, expression, connection)
644+
row[pos] = value
645+
yield row
646+
633647

634648
class SQLInsertCompiler(SQLCompiler):
635649
def execute_sql(self, returning_fields=None):

0 commit comments

Comments
 (0)