mirror of
https://github.com/django/django.git
synced 2025-08-22 11:34:33 +00:00
Support 'pyformat' style parameters in raw queries, Refs #10070
Add support for Oracle, fix an issue with the repr of RawQuerySet, add tests and documentations. Also added a 'supports_paramstyle_pyformat' database feature, True by default, False for SQLite. Thanks Donald Stufft for review of documentation.
This commit is contained in:
parent
7c0b72a826
commit
d097417025
9 changed files with 147 additions and 34 deletions
|
@ -1445,7 +1445,10 @@ class RawQuerySet(object):
|
|||
yield instance
|
||||
|
||||
def __repr__(self):
|
||||
return "<RawQuerySet: %r>" % (self.raw_query % tuple(self.params))
|
||||
text = self.raw_query
|
||||
if self.params:
|
||||
text = text % (self.params if hasattr(self.params, 'keys') else tuple(self.params))
|
||||
return "<RawQuerySet: %r>" % text
|
||||
|
||||
def __getitem__(self, k):
|
||||
return list(self)[k]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue