Fixed #23460 -- Added literal %s support to extra() QuerySets.

This commit is contained in:
Matt Robenolt 2014-09-10 07:23:58 +00:00 committed by Tim Graham
parent 17557d068c
commit ef5f9b6ae8
4 changed files with 26 additions and 6 deletions

View file

@ -1775,7 +1775,8 @@ class Query(object):
entry_params = []
pos = entry.find("%s")
while pos != -1:
entry_params.append(next(param_iter))
if pos == 0 or entry[pos - 1] != '%':
entry_params.append(next(param_iter))
pos = entry.find("%s", pos + 2)
select_pairs[name] = (entry, entry_params)
# This is order preserving, since self.extra_select is an OrderedDict.