Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #20 from cbmi/issue-19
Browse files Browse the repository at this point in the history
Add support for passing the originating model to ModelTree.add_select
  • Loading branch information
naegelyd committed Nov 11, 2014
2 parents aaa6abd + 64e45d4 commit d0bf12b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modeltree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,14 @@ def add_select(self, *fields, **kwargs):

aliases = []

for field in fields:
queryset, alias = self.add_joins(field.model, queryset, **kwargs)
for pair in fields:
if isinstance(pair, (list, tuple)):
model, field = pair
else:
field = pair
model = field.model

queryset, alias = self.add_joins(model, queryset, **kwargs)

col = (alias, field.column)

Expand Down

0 comments on commit d0bf12b

Please sign in to comment.