Ticket #1532: query_set_select.diff

File query_set_select.diff, 1.0 KB (added by jkocherhans, 19 years ago)
  • django/db/models/query.py

     
    314314        assert self._limit is None and self._offset is None, \
    315315                "Cannot change a query once a slice has been taken"
    316316        clone = self._clone()
    317         if select: clone._select.extend(select)
     317        if select: clone._select.update(select)
    318318        if where: clone._where.extend(where)
    319319        if params: clone._params.extend(params)
    320320        if tables: clone._tables.extend(tables)
     
    386386
    387387        # Add any additional SELECTs.
    388388        if self._select:
    389             select.extend(['(%s) AS %s' % (quote_only_if_word(s[1]), backend.quote_name(s[0])) for s in self._select])
     389            select.extend(['(%s) AS %s' % (quote_only_if_word(s[1]), backend.quote_name(s[0])) for s in self._select.items()])
    390390
    391391        # Start composing the body of the SQL statement.
    392392        sql = [" FROM", backend.quote_name(opts.db_table)]
Back to Top