Skip to content

Commit 6fa0b4d

Browse files
aclark4lifetimgraham
authored andcommitted
INTPYTHON-348 Add support for QuerySet.raw()
- Partial fix for datefield converter bug
1 parent 33ae84a commit 6fa0b4d

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
@@ -639,6 +639,20 @@ def explain_query(self):
639639
result.append(f"{key}: {formatted_value}")
640640
return result
641641

642+
def apply_converters(self, rows, converters):
643+
connection = self.connection
644+
converters = list(converters.items())
645+
for row in rows:
646+
for pos, (convs, expression) in converters:
647+
try:
648+
value = list(row.values())[pos]
649+
except AttributeError:
650+
value = row[pos]
651+
for converter in convs:
652+
value = converter(value, expression, connection)
653+
row[pos] = value
654+
yield row
655+
642656

643657
class SQLInsertCompiler(SQLCompiler):
644658
def execute_sql(self, returning_fields=None):

0 commit comments

Comments
 (0)