Skip to main content

Horizontal filter widget for django-sortedm2m

Project description

sortedm2m-filter-horizontal-widget is an admin widget for Gregor Mülleggers excellent django-sortedm2m library.

This allows for a familiar filter horizontal widget.


pip install django-sortedm2m-filter-horizontal-widget

What version do I need?

Django Install
< 1.8 0.2
1.8 1.1
>= 1.9 1.2.1
>= 2.0 latest


Add sortedm2m_filter_horizontal_widget to your INSTALLED_APPS. (needed for static files)

In your ModelAdmin add the following function to override the default widget.

from sortedm2m_filter_horizontal_widget.forms import SortedFilteredSelectMultiple

class MyModelAdmin(admin.ModelAdmin):
    # ...

    def formfield_for_manytomany(self, db_field, request=None, **kwargs):
        if == 'your_sortedm2m_field_name':
            kwargs['widget'] = SortedFilteredSelectMultiple()
        return super(MyModelAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)


  • Automatically assign widget if field is specified in ModelAdmin’s filter_horizontal.
  • Add tests


Fix incorrect class name
Fix duplicate “Add another” button in stacked inline (#12)
Handle responsive css introduced in django 2.0 Handle removal of old JS cross-browser utilities introduced in django 2.0
Add workaround to have verbose_name reference (#1) Fix Select and Clear All button (#2) Fix translation for Clear All button (#3)
Implement new admin style introduced in Django 1.9 Remove all images since buttons are now handled with css Get button active and hover states working Add example project
Use admin_prefix to find image, in case user changes STATIC_URL setting Add version requirements per Django version
Fixed bugs with popup closing. Added support for Django 1.10+

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-sortedm2m-filter-horizontal-widget, version 1.3.2
Filename, size File type Python version Upload date Hashes
Filename, size django-sortedm2m-filter-horizontal-widget-1.3.2.tar.gz (41.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page