Skip to content

Commit

Permalink
_decode_child now leverages the Lookup API
Browse files Browse the repository at this point in the history
I managed to find the new location for everything except annotations. I tried self.query.get_aggregation(self.connection.alias) but that gave me a recursion error. I'm pretty sure that if an annotation isn't included in the query, it's set to true.
  • Loading branch information
kavdev authored and sethdenner committed Apr 15, 2015
1 parent bd09e07 commit 697d84e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions djangotoolbox/db/basecompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,22 @@ def _decode_child(self, child):

# TODO: Call get_db_prep_lookup directly, constraint.process
# doesn't do much more.
constraint, lookup_type, annotation, value = child
packed, value = constraint.process(lookup_type, value, self.connection)
alias, column, db_type = packed
field = constraint.field
# constraint, lookup_type, annotation, value = child
# packed, value = constraint.process(lookup_type, value, self.connection)
# alias, column, db_type = packed
# field = constraint.field

lhs, lhs_params = child.process_lhs(self.compiler, self.connection)
rhs, rhs_params = child.process_rhs(self.compiler, self.connection)

lookup_type = child.lookup_name
annotation = True # No idea from where to pull this...
value = rhs_params

packed = child.lhs.get_group_by_cols()[0]
alias, column = packed
field = child.lhs.output_field
db_type = field.db_type(self.connection)

opts = self.query.model._meta
if alias and alias != opts.db_table:
Expand Down

0 comments on commit 697d84e

Please sign in to comment.