Commit 5a9f2314 by Florian Apolloner

Simplified ExtraJoinRestriction.as_sql

parent 8ef99797
...@@ -56,12 +56,10 @@ class ExtraJoinRestriction(object): ...@@ -56,12 +56,10 @@ class ExtraJoinRestriction(object):
def as_sql(self, qn, connection): def as_sql(self, qn, connection):
if len(self.content_types) == 1: if len(self.content_types) == 1:
extra_where = "%s.%s = %%s" % (qn(self.alias), qn(self.col)) extra_where = "%s.%s = %%s" % (qn(self.alias), qn(self.col))
params = [self.content_types[0]]
else: else:
extra_where = "%s.%s IN (%s)" % (qn(self.alias), qn(self.col), extra_where = "%s.%s IN (%s)" % (qn(self.alias), qn(self.col),
','.join(['%s'] * len(self.content_types))) ','.join(['%s'] * len(self.content_types)))
params = self.content_types return extra_where, self.content_types
return extra_where, params
def relabel_aliases(self, change_map): def relabel_aliases(self, change_map):
self.alias = change_map.get(self.alias, self.alias) self.alias = change_map.get(self.alias, self.alias)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment