Closed ndunn219 closed 3 years ago
+1
Seems linked: https://code.djangoproject.com/ticket/32619
Let me voice my +1 out loud :)
There is a workaround:
from django.db import models
class ModelA(models.Model):
pass
class ModelB(models.Model):
model_a = models.ForeignKey(to=ModelA, related_name="models_b")
class NonWorkingAutocompleteWithDj32(AutocompleteFilter):
""" Autocomplete in the admin of model B """"
title = _("Model A")
field_name = "model_a"
class WorkingAutocompleteWithDj32(AutocompleteFilter):
""" Autocomplete in the admin of model B """"
title = _("Model A")
rel_model = ModelA
field_name = "models_b"
parameter_name = "model_a"
There is a workaround:
@MDziwny 's workaround filtered correctly for me, but it then changes the filter field to an incorrect value (i.e., not the selection that it's being filtered on).
it then changes the filter field to an incorrect value
Oh! You're right, I didn't notice it before, thanks :/
I've opened a PR with a fix, but there is no tests yet and I'm not sure I will have time to add some.
When opening the select, the choices don't show up due to this error: