Opened 9 years ago

Last modified 8 days ago

#29111 assigned New feature

Use autocomplete_fields in list_filter for related models

Reported by: Paul Tiplady Owned by: NAYAN SHARMA
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: Christophe Baldy, Johannes Maron Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

In Django 2.0, support for select2 AJAX autocomplete fields was added:

​https://github.com/django/django/pull/6385
https://code.djangoproject.com/ticket/14370

This makes foreign key fields much more usable in the Admin, as the full list of objects doesn't need to be loaded to populate a dropdown list (as was the old way of doing this).

This issue covers using the new vendored select2 widgets to provide similar autocomplete functionality for the list_filter UI (specifically, presumably extending/replacing RelatedFieldListFilter).

Some discussion in the Github PR 6385 suggesting that the next step would be to open an issue to track this work.

Change History (12)

comment:1 by Tim Graham, 9 years ago

Component: Uncategorized → contrib.admin
Triage Stage: Unreviewed → Accepted

comment:2 by Christophe Baldy, 8 years ago

Cc: Christophe Baldy added

comment:3 by Phil Krylov, 8 years ago

There is a third-party app dealing with this, although it could be improved a bit: ​https://github.com/farhan0581/django-admin-autocomplete-filter

comment:4 by Gav O'Connor, 4 years ago

Owner: changed from nobody to Gav O'Connor
Status: new → assigned
Version: 2.0 → dev

comment:5 by Gav O'Connor, 3 years ago

Owner: changed from Gav O'Connor to Gav O'Connor

comment:6 by David, 23 months ago

There is an updated third party app which does this ​https://github.com/vigo/django-admin-list-filter

comment:7 by Gav O'Connor, 23 months ago

Owner: Gav O'Connor removed
Status: assigned → new

comment:8 by Hemnath P, 2 months ago

Hi, I'd like to work on this ticket. Before starting, I noticed there's a maintained third-party package that already implements this: ​https://github.com/vigo/django-admin-list-filter — it adds select2/AJAX autocomplete support to list_filter using Django's built-in AutocompleteJsonView, following a similar approach to what's described here.
Given that package exists and appears to work well, is there still interest in having this in Django core, or would the recommendation be to point users to that package instead? I'm happy to attempt a patch if the team feels it's still worth including in core

in reply to:  8 comment:9 by Md. Saikat Islam, 2 months ago

Are you working on it?
Replying to Hemnath P:

Hi, I'd like to work on this ticket. Before starting, I noticed there's a maintained third-party package that already implements this: ​https://github.com/vigo/django-admin-list-filter — it adds select2/AJAX autocomplete support to list_filter using Django's built-in AutocompleteJsonView, following a similar approach to what's described here.
Given that package exists and appears to work well, is there still interest in having this in Django core, or would the recommendation be to point users to that package instead? I'm happy to attempt a patch if the team feels it's still worth including in core

comment:10 by NAYAN SHARMA, 3 weeks ago

Has patch: set
Owner: set to NAYAN SHARMA
Status: new → assigned

comment:11 by Johannes Maron, 12 days ago

Cc: Johannes Maron added

comment:12 by Johannes Maron, 8 days ago

Needs tests: set
Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top