Skip to content

Commit

Permalink
Merge pull request #18 from danpoland/improve-expandables
Browse files Browse the repository at this point in the history
Improve expandables
  • Loading branch information
danpoland authored Feb 1, 2018
2 parents cfee611 + 552c82c commit a4ecf2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyramid_restful/expandables.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_query(self):
if name in available_expands:
field = self.expandable_fields[name]

innerjoin = fild.get('join')
innerjoin = field.get('join')
outerjoin = field.get('outerjoin')

if innerjoin:
Expand Down
7 changes: 3 additions & 4 deletions tests/test_expandables.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_query(self):
class ExpandableAccountView(ExpandableViewMixin, AccountView):
schema_class = AccountSchema
expandable_fields = {'owner': {
'column': 'owner_id'
'join': 'owner_id'
}}


Expand Down Expand Up @@ -82,8 +82,7 @@ def test_expandable_view_mixin_outer_join(self):
request.params = {'expand': 'owner'}
view = ExpandableAccountView()
view.expandable_fields = {'owner': {
'column': 'owner_id',
'outerjoin': True
'outerjoin': 'owner_id',
}}
view.request = request
query = view.get_query()
Expand All @@ -94,7 +93,7 @@ def test_expandable_view_mixin_options(self):
request.params = {'expand': 'owner'}
view = ExpandableAccountView()
view.expandable_fields = {'owner': {
'column': 'owner_id',
'join': 'owner_id',
'options': {'preselect': True}
}}
view.request = request
Expand Down

0 comments on commit a4ecf2a

Please sign in to comment.