#33489: Autocomplete broken on ManyToManyField
-----------------------------------------+------------------------
               Reporter:  Filipe         |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  3.2
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 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...

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.acdf29489b9c7df920a619ef25540a1f%40djangoproject.com.

Reply via email to