Simplified BaseModelAdmin.lookup_allowed() a bit.

This commit is contained in:
Sergey Fedoseev 2017-12-06 23:54:51 +05:00
parent 85e6a1c634
commit b728ab22e1
1 changed files with 2 additions and 3 deletions

View File

@ -364,8 +364,7 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass):
# As ``limit_choices_to`` can be a callable, invoke it here.
if callable(fk_lookup):
fk_lookup = fk_lookup()
for k, v in widgets.url_params_from_lookup_dict(fk_lookup).items():
if k == lookup and v == value:
if (lookup, value) in widgets.url_params_from_lookup_dict(fk_lookup).items():
return True
relation_parts = []