Opened 6 years ago

Last modified 5 years ago

#29919 closed Bug

Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes — at Version 5

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 Tim Graham)

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 (5)

comment:1 by Dan Moore, 6 years ago

Description: modified (diff)

comment:2 by Tim Graham, 6 years ago

I can't reproduce the crash on a ManyToManyField with limit_choices_to. Could you give more details?

comment:3 by Dan Moore, 6 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:5 by Tim Graham, 6 years ago

Description: modified (diff)
Summary: Using RelatedOnlyFieldListFilter with ManyToMany causes exceptionUsing RelatedOnlyFieldListFilter with reverse ManyToMany crashes
Triage Stage: UnreviewedAccepted
Note: See TracTickets for help on using tickets.
Back to Top