#33035 closed New feature (needsinfo)
Autocomplete and populating Subcategories based on selected Categories (Admin and Forms)
Reported by: | Jon Levischi | Owned by: | |
---|---|---|---|
Component: | Forms | Version: | 3.2 |
Severity: | Normal | Keywords: | autocomplete_fields, limit_choices_to |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | yes |
Description (last modified by )
A combination of the recently implemented "autocomplete_fields" (awesome btw!) with dynamic "limit_choices_to" that actually works on Foreign AND ManyToMany fields both on Admin site and Custom Forms.
class Project categories = M2M [having "Cat A", "Cat B", "Cat C", "Cat D", etc.] subcategories = M2M [having "Sub A1", "Sub A2", "Sub B1", "Sub B2", "Sub C1", "Sub C2", etc.]
When selecting Cat A in the category it would populate subcategory limiting options to "Sub A1", "Sub A2", "Sub C1", "Sub C2", based on their parents, but not "Cat B" nor "Cat D" children).
I know this is possible using Ajax, django-autocomplete-light or similar, but it's so frequently used that I think it makes sense to be included in Django itself.
Thank you!
Change History (6)
comment:1 by , 3 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 3 years ago
Description: | modified (diff) |
---|
comment:3 by , 3 years ago
Description: | modified (diff) |
---|
comment:4 by , 3 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:5 by , 3 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:6 by , 3 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Jon unassigned this ticket from themself, so closing as needsinfo, unless someone provides PoC.
Hi Jon — Sounds like a nice feature if it's feasible. I'm not sure it'll be quite Easy Pickings but since you've assigned yourself, very happy to have a look at one you come up with. Thanks!