Ticket #14733: force_select_raw_queries.patch

File force_select_raw_queries.patch, 1.4 KB (added by dzentoo, 14 years ago)

attached patch

  • models/sql/query.py

     
    3030    A single raw SQL query
    3131    """
    3232
    33     def __init__(self, sql, using, params=None):
    34         self.validate_sql(sql)
     33    def __init__(self, sql, using, params=None, force=False):
     34        if not force:
     35            self.validate_sql(sql)
    3536        self.params = params or ()
    3637        self.sql = sql
    3738        self.using = using
  • models/query.py

     
    12841284    Provides an iterator which converts the results of raw SQL queries into
    12851285    annotated model instances.
    12861286    """
    1287     def __init__(self, raw_query, model=None, query=None, params=None,
     1287    def __init__(self, raw_query, model=None, query=None, params=None, force=False)
    12881288        translations=None, using=None):
    12891289        self.raw_query = raw_query
    12901290        self.model = model
    12911291        self._db = using
    1292         self.query = query or sql.RawQuery(sql=raw_query, using=self.db, params=params)
     1292        self.query = query or sql.RawQuery(sql=raw_query, using=self.db, params=params, force=force)
    12931293        self.params = params or ()
    12941294        self.translations = translations or {}
    12951295
Back to Top