Opened 7 years ago
Closed 7 years ago
#28993 closed New feature (wontfix)
Make admin's many to many picker widget available in django.forms
Reported by: | Rick Graves | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.11 |
Severity: | Normal | Keywords: | widget many to many picker |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello,
This is a request for code reuse.
The many to many picker widget is available via the admin interface, but I need to put it on a form that users access. I asked on stackoverflow, but no one has answered.
https://stackoverflow.com/questions/48040322/django-where-is-the-many-to-many-picker-widget
I upload a picture of the widget I have in mind.
Is there a way to reuse the code for this widget?
Thanks,
Attachments (1)
Change History (3)
by , 7 years ago
Attachment: | many_2_many_picker_widget.png added |
---|
comment:1 by , 7 years ago
you can use the widget from
from django.forms.widgets import SelectMultiple
The filter_horizontal / filter_vertical widget is accessible from
from django.contrib.admin.widgets import FilteredSelectMultiple
Fun Fact- I found this out using pycharm. Tracked the widgets of the ModelAdmin using it's Go To Declaration Feature
comment:2 by , 7 years ago
Component: | Utilities → Forms |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Summary: | make many to many picker widget available to user forms → Make admin's many to many picker widget available in django.forms |
FilteredSelectMultiple
isn't available in django.forms
because it relies on jQuery and we want to avoid coupling generally available form widgets to a specific JavaScript library. You can use the widget as suggested in the previous comment, but be aware that backwards compatibility isn't guaranteed.
screen shot of the many to many picker widget on the users admin page