Ticket #12268: django_fixpercent_s_on_extra.patch

File django_fixpercent_s_on_extra.patch, 860 bytes (added by manuel@…, 15 years ago)

this patch fixes the bug described.

  • db/models/sql/query.py

    diff -uprN django.orig/db/models/sql/query.py django/db/models/sql/query.py
    old new class BaseQuery(object):  
    21772177                entry_params = []
    21782178                pos = entry.find("%s")
    21792179                while pos != -1:
    2180                     entry_params.append(param_iter.next())
     2180                    # allow %s to be sent to the database, example calling strftime
     2181                    # from sqlite
     2182                    if entry.find("%%s", pos-1) != pos-1:
     2183                        entry_params.append(param_iter.next())
    21812184                    pos = entry.find("%s", pos + 2)
    21822185                select_pairs[name] = (entry, entry_params)
    21832186            # This is order preserving, since self.extra_select is a SortedDict.
Back to Top