Skip to content

Commit

Permalink
Fixed FK popup for nested sets.
Browse files Browse the repository at this point in the history
  • Loading branch information
idlesign committed Sep 8, 2018
1 parent bfc04dc commit 0b09017
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ django-admirarchy changelog
===========================


Unreleased
----------
* Fixed FK popup for nested sets.


v0.2.2
------
* Dummy. No changes.
Expand Down
6 changes: 6 additions & 0 deletions admirarchy/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def actual_test(model_id, user_create, request_client):
assert model_id + '_child1' in resp.rendered_content
assert model_id + '_child2' in resp.rendered_content

# Foreign key popup.
resp = client.get(url_base + '?_to_field=id&_popup=1')

assert '?pid=1&_to_field=id&_popup=1' in resp.rendered_content
assert model_id + '_parent' in resp.rendered_content


def test_adjacency_list(request_client, user_create):

Expand Down
2 changes: 1 addition & 1 deletion admirarchy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def hook_get_queryset(self, changelist, request):

else:
changelist.params[self.level_field] = self.root_level
self.parent = qs.get(**changelist.params)
self.parent = qs.get(**{key: val for key, val in changelist.params.items() if not key.startswith('_')})

def hook_get_results(self, changelist):
"""Triggered by `ChangeList.get_results()`."""
Expand Down

0 comments on commit 0b09017

Please sign in to comment.