Ticket #1532: query_set_select.diff
File query_set_select.diff, 1.0 KB (added by , 19 years ago) |
---|
-
django/db/models/query.py
314 314 assert self._limit is None and self._offset is None, \ 315 315 "Cannot change a query once a slice has been taken" 316 316 clone = self._clone() 317 if select: clone._select. extend(select)317 if select: clone._select.update(select) 318 318 if where: clone._where.extend(where) 319 319 if params: clone._params.extend(params) 320 320 if tables: clone._tables.extend(tables) … … 386 386 387 387 # Add any additional SELECTs. 388 388 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()]) 390 390 391 391 # Start composing the body of the SQL statement. 392 392 sql = [" FROM", backend.quote_name(opts.db_table)]