Opened 7 years ago
Closed 6 years ago
#29919 closed Bug (fixed)
Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
| Reported by: | Dan Moore | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | 2.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Collin Anderson | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Using RelatedOnlyFieldListFilter with a reverse ManyToMany relation causes this exception:
get_choices() got an unexpected keyword argument 'limit_choices_to'
This method in ForeignObjectRel.get_choices is missing the parameter that Field.get_choices has.
Pull Request: https://github.com/django/django/pull/10606
Demo of how to trigger bug: https://github.com/mgrdcm/django-bug-reverse-related/blob/master/rrbug/rrapp/admin.py#L11-L15
Change History (10)
comment:1 by , 7 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 7 years ago
comment:3 by , 7 years ago
| Description: | modified (diff) |
|---|
Apologies for my lack of response on this, have been traveling. I'm going to be working on adding tests for my fix ASAP but here's a minimal example of how to trigger: Demo of how to trigger bug: https://github.com/mgrdcm/django-bug-reverse-related/blob/master/rrbug/rrapp/admin.py#L11-L15
comment:4 by , 7 years ago
comment:5 by , 7 years ago
| Description: | modified (diff) |
|---|---|
| Summary: | Using RelatedOnlyFieldListFilter with ManyToMany causes exception → Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes |
| Triage Stage: | Unreviewed → Accepted |
comment:6 by , 7 years ago
| Patch needs improvement: | set |
|---|
comment:7 by , 7 years ago
| Patch needs improvement: | unset |
|---|
comment:8 by , 7 years ago
| Cc: | added |
|---|---|
| Needs tests: | set |
| Patch needs improvement: | set |
Tim says "test should very the correct results of the Filter rather than just checking that an exception isn't raised."
comment:9 by , 6 years ago
| Needs tests: | unset |
|---|---|
| Patch needs improvement: | unset |
I can't reproduce the crash on a
ManyToManyFieldwithlimit_choices_to. Could you give more details?