diff options
| author | Josh Schneier <josh.schneier@gmail.com> | 2017-03-15 13:45:18 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-03-15 13:45:18 -0400 |
| commit | 6bc4ff36db0d85ac96ca91ae758159ee43836f86 (patch) | |
| tree | 33e2bdd530af46c143c62b13c9e3011943ecda3b /django | |
| parent | 7a7b331cd5975477597dac4dec7ee0ddb67f59e0 (diff) | |
Fixed #27897 -- Fixed crash with 'pk' in ModelAdmin.search_filters.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/utils.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py index 4d39693e5d..6e59c83548 100644 --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -32,6 +32,8 @@ def lookup_needs_distinct(opts, lookup_path): lookup_fields = lookup_fields[:-1] # Now go through the fields (following all relations) and look for an m2m for field_name in lookup_fields: + if field_name == 'pk': + field_name = opts.pk.name field = opts.get_field(field_name) if hasattr(field, 'get_path_info'): # This field is a relation, update opts to follow the relation |
