﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33489	Autocomplete broken on ManyToManyField	Filipe	nobody	"I've bumped into https://github.com/django/django/blob/3.2.8/django/contrib/admin/views/autocomplete.py#L42 after upgrading from django 3.1.5 to 3.2.8 (introduced in 3.2 looking at the tags, so adds up)

My current setup is a parent class:

{{{
# app ""vulns""
class Finding(models.Model):
    ...
    related_to = models.ManyToManyField('self', blank=True, help_text='Other findings related to this one')

}}}

And then child class (adding for completeness but not sure it matters)

{{{
# app ""burp""
class Finding(vuln_models.Finding):
 ...

}}}

`vulns.Finding` has an admin model defined with search fields `id` and `title`

When editing a burp.Finding (changeform) the autocomplete for `related_to` sends `related_to_rel+` as `field_name` resulting `self.source_field` being set to the `ManyToManyRel` (not the `ManyToManyField`).

The Rel has `limit_choices_to` but it does not have a `get_limit_choices_to` (while the Field does).

I've been trying to find if it's me doing something wrong in the model definition but it's pretty straightforward..."	Bug	closed	contrib.admin	3.2	Normal	invalid			Unreviewed	0	0	0	0	0	0
