[Django] #29919: Using RelatedOnlyFieldListFilter with ManyToMany causes exception

52 views
Skip to first unread message

Django

unread,
Nov 3, 2018, 10:44:29 PM11/3/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with ManyToMany causes exception
-----------------------------------------+------------------------
Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Using RelatedOnlyFieldListFilter with ManyToMany 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/29919>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 3, 2018, 10:47:24 PM11/3/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with ManyToMany causes exception
-------------------------------+--------------------------------------

Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by Dan Moore:

Old description:

> Using RelatedOnlyFieldListFilter with ManyToMany 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.

New description:

Using RelatedOnlyFieldListFilter with ManyToMany 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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:1>

Django

unread,
Nov 6, 2018, 7:02:22 PM11/6/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with ManyToMany causes exception
-------------------------------+--------------------------------------

Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Tim Graham):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:2>

Django

unread,
Nov 11, 2018, 9:13:43 AM11/11/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with ManyToMany causes exception
-------------------------------+--------------------------------------

Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Old description:

> Using RelatedOnlyFieldListFilter with ManyToMany 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

New description:

Using RelatedOnlyFieldListFilter with ManyToMany 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

--

Comment (by Dan Moore):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:3>

Django

unread,
Nov 11, 2018, 10:52:24 AM11/11/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with ManyToMany causes exception
-------------------------------+--------------------------------------

Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Dan Moore):

Test case added:
https://github.com/django/django/pull/10606/commits/da4785e82c9586c6f2ab41a0e9e5bc3eeeb8fd1c

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:4>

Django

unread,
Nov 12, 2018, 11:55:19 AM11/12/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
-------------------------------+------------------------------------

Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


Old description:

> Using RelatedOnlyFieldListFilter with ManyToMany 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

New description:

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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:5>

Django

unread,
Nov 14, 2018, 3:16:19 PM11/14/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
-------------------------------+------------------------------------
Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:6>

Django

unread,
Nov 17, 2018, 6:40:01 PM11/17/18
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
-------------------------------+------------------------------------
Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:7>

Django

unread,
Jan 10, 2019, 2:03:27 PM1/10/19
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
-------------------------------+------------------------------------
Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Collin Anderson):

* cc: Collin Anderson (added)


* needs_better_patch: 0 => 1

* needs_tests: 0 => 1


Comment:

Tim says "test should very the correct results of the Filter rather than
just checking that an exception isn't raised."

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:8>

Django

unread,
Oct 22, 2019, 4:20:15 PM10/22/19
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
-------------------------------+------------------------------------
Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:9>

Django

unread,
Oct 23, 2019, 5:14:18 AM10/23/19
to django-...@googlegroups.com
#29919: Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes
-------------------------------+------------------------------------
Reporter: Dan Moore | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"bc94e3c1a263da4b3eae3111c12270744907901b" bc94e3c]:
{{{
#!CommitTicketReference repository=""
revision="bc94e3c1a263da4b3eae3111c12270744907901b"
Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse
relationships.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29919#comment:10>

Reply all
Reply to author
Forward
0 new messages