#29138: Add ModelAdmin.autocomplete_fields support for ForeignKeys that use to_field -------------------------------+-------------------------------------- Reporter: Jonathan Nye | Owner: Basu Dubey Type: Bug | Status: assigned Component: contrib.admin | Version: 2.0 Severity: Normal | Resolution: Keywords: autocomplete | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+--------------------------------------
Comment (by Constantino Schillebeeckx): I've put together a [https://github.com/ConstantinoSchillebeeckx/django/tree/fix-29138 bug fix] for this. '''Note''' I've been able to update all unit tests and create some new ones, however I haven't been able to leverage `to_field_allowed` to prevent data leaks. I've tried to implement it (see [https://github.com/ConstantinoSchillebeeckx/django/blob/fix-29138/django/contrib/admin/views/autocomplete.py#L29 here]), however I can't get it to play nicely with the unit tests. When uncommented, the `id_field` isn't properly being considered as to_field_allowed. I'm not familiar with this function, so could use some help troubleshooting. -- Ticket URL: <https://code.djangoproject.com/ticket/29138#comment:9> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.bbc3d4537ec7ba9e5cfe4fb2447ed5be%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.