Changeset 3317
- Timestamp:
- 07/10/06 21:32:53 (2 years ago)
- Files:
-
- django/trunk/django/db/models/query.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/query.py
r3300 r3317 442 442 443 443 # Convert self._filters into SQL. 444 tables2, joins2, where2, params2 = self._filters.get_sql(opts) 445 tables.extend(tables2) 444 joins2, where2, params2 = self._filters.get_sql(opts) 446 445 joins.update(joins2) 447 446 where.extend(where2) … … 571 570 572 571 def get_sql(self, opts): 573 tables, joins, where, params = [],SortedDict(), [], []572 joins, where, params = SortedDict(), [], [] 574 573 for val in self.args: 575 tables2, joins2, where2, params2 = val.get_sql(opts) 576 tables.extend(tables2) 574 joins2, where2, params2 = val.get_sql(opts) 577 575 joins.update(joins2) 578 576 where.extend(where2) 579 577 params.extend(params2) 580 578 if where: 581 return tables,joins, ['(%s)' % self.operator.join(where)], params582 return tables,joins, [], params579 return joins, ['(%s)' % self.operator.join(where)], params 580 return joins, [], params 583 581 584 582 class QAnd(QOperator): … … 631 629 632 630 def get_sql(self, opts): 633 tables,joins, where, params = self.q.get_sql(opts)631 joins, where, params = self.q.get_sql(opts) 634 632 where2 = ['(NOT (%s))' % " AND ".join(where)] 635 return tables,joins, where2, params633 return joins, where2, params 636 634 637 635 def get_where_clause(lookup_type, table_prefix, field_name, value): … … 707 705 # there for others to implement custom Q()s, etc that return other join 708 706 # types. 709 tables, joins, where, params = [],SortedDict(), [], []707 joins, where, params = SortedDict(), [], [] 710 708 711 709 for kwarg, value in kwarg_items: … … 734 732 raise TypeError, "Cannot parse keyword query %r" % kwarg 735 733 736 tables2, joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None) 737 tables.extend(tables2) 734 joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None) 738 735 joins.update(joins2) 739 736 where.extend(where2) 740 737 params.extend(params2) 741 return tables,joins, where, params738 return joins, where, params 742 739 743 740 class FieldFound(Exception): … … 759 756 760 757 def lookup_inner(path, clause, value, opts, table, column): 761 tables, joins, where, params = [],SortedDict(), [], []758 joins, where, params = SortedDict(), [], [] 762 759 current_opts = opts 763 760 current_table = table … … 879 876 880 877 # There are name queries remaining. Recurse deeper. 881 tables2, joins2, where2, params2 = lookup_inner(path, clause, value, new_opts, new_table, join_column) 882 883 tables.extend(tables2) 878 joins2, where2, params2 = lookup_inner(path, clause, value, new_opts, new_table, join_column) 879 884 880 joins.update(joins2) 885 881 where.extend(where2) … … 926 922 params.extend(field.get_db_prep_lookup(clause, value)) 927 923 928 return tables,joins, where, params924 return joins, where, params 929 925 930 926 def delete_objects(seen_objs):
