Opened 6 years ago

Closed 6 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)

many_2_many_picker_widget.png (67.3 KB ) - added by Rick Graves 6 years ago.
screen shot of the many to many picker widget on the users admin page

Download all attachments as: .zip

Change History (3)

by Rick Graves, 6 years ago

screen shot of the many to many picker widget on the users admin page

comment:1 by Dev Aggarwal, 6 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

Last edited 6 years ago by Dev Aggarwal (previous) (diff)

comment:2 by Tim Graham, 6 years ago

Component: UtilitiesForms
Resolution: wontfix
Status: newclosed
Summary: make many to many picker widget available to user formsMake 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.

Note: See TracTickets for help on using tickets.
Back to Top