[Django] #33035: Autocomplete and populating Subcategories based on selected Categories (Admin and Forms)

3 views
Skip to first unread message

Django

unread,
Aug 18, 2021, 5:01:52 PM8/18/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon | Owner: nobody
Levischi |
Type: New | Status: new
feature |
Component: Forms | Version: 3.2
Severity: Normal | Keywords:
| autocomplete_fields,
Triage Stage: | limit_choices_to
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
-------------------------------------+-------------------------------------
A combination of the recently implemented "autocomplete_fields" with
dynamic "limit_choices_to" that actually works on Foreign AND ManyToMany
fields both on Admin site and Custom Forms.

Sample case:


{{{
class Project
categories = M2M [having "Cat A", "Cat B", "Cat C", etc.]
subcategories = M2M [having "Sub A1", "Sub A2", "Sub C1", etc.]
}}}


When selecting ''Cat A'' in the **category** it would populate
**subcategory** limited based on which categories are selected)

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

Django

unread,
Aug 18, 2021, 5:05:31 PM8/18/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon Levischi | Owner: Jon
| Levischi
Type: New feature | Status: assigned
Component: Forms | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage:
autocomplete_fields, | Unreviewed
limit_choices_to |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Jon Levischi):

* owner: nobody => Jon Levischi
* status: new => assigned


Old description:

> A combination of the recently implemented "autocomplete_fields" with
> dynamic "limit_choices_to" that actually works on Foreign AND ManyToMany
> fields both on Admin site and Custom Forms.
>
> Sample case:
>

> {{{
> class Project
> categories = M2M [having "Cat A", "Cat B", "Cat C", etc.]
> subcategories = M2M [having "Sub A1", "Sub A2", "Sub C1", etc.]
> }}}
>

> When selecting ''Cat A'' in the **category** it would populate
> **subcategory** limited based on which categories are selected)

New description:

A combination of the recently implemented "autocomplete_fields" with
dynamic "limit_choices_to" that actually works on Foreign AND ManyToMany
fields both on Admin site and Custom Forms.

Sample case:


{{{
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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33035#comment:1>

Django

unread,
Aug 18, 2021, 5:07:09 PM8/18/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon Levischi | Owner: Jon
| Levischi
Type: New feature | Status: assigned
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: | Triage Stage:
autocomplete_fields, | Unreviewed
limit_choices_to |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Description changed by Jon Levischi:

Old description:

> A combination of the recently implemented "autocomplete_fields" with
> dynamic "limit_choices_to" that actually works on Foreign AND ManyToMany
> fields both on Admin site and Custom Forms.
>
> Sample case:
>

> {{{
> 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.

New description:

A combination of the recently implemented "autocomplete_fields" 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!

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33035#comment:2>

Django

unread,
Aug 18, 2021, 5:08:13 PM8/18/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon Levischi | Owner: Jon
| Levischi
Type: New feature | Status: assigned
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: | Triage Stage:
autocomplete_fields, | Unreviewed
limit_choices_to |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Description changed by Jon Levischi:

Old description:

> A combination of the recently implemented "autocomplete_fields" 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!

New description:

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!

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33035#comment:3>

Django

unread,
Aug 25, 2021, 2:51:17 AM8/25/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon Levischi | Owner: Jon
| Levischi
Type: New feature | Status: assigned
Component: Forms | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
autocomplete_fields, |
limit_choices_to |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


Comment:

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!

--
Ticket URL: <https://code.djangoproject.com/ticket/33035#comment:4>

Django

unread,
Sep 8, 2021, 5:06:57 PM9/8/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon Levischi | Owner: (none)
Type: New feature | Status: new
Component: Forms | Version: 3.2

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
autocomplete_fields, |
limit_choices_to |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Jon Levischi):

* owner: Jon Levischi => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/33035#comment:5>

Django

unread,
Sep 10, 2021, 4:23:31 AM9/10/21
to django-...@googlegroups.com
#33035: Autocomplete and populating Subcategories based on selected Categories
(Admin and Forms)
-------------------------------------+-------------------------------------
Reporter: Jon Levischi | Owner: (none)
Type: New feature | Status: closed
Component: Forms | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Accepted
autocomplete_fields, |
limit_choices_to |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => needsinfo


Comment:

Jon de-assigned this ticket from themself, so closing as needsinfo, unless
someone provides PoC.

--
Ticket URL: <https://code.djangoproject.com/ticket/33035#comment:6>

Reply all
Reply to author
Forward
0 new messages