Skip to main content

django-sortedm2m-filter-horizontal-widget

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

This allows for a familiar filter horizontal widget.

https://image.ibb.co/fYO8On/Screen_Shot_2018_05_07_at_9_39_30_AM.png

Installation

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

Usage

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 db_field.name == 'your_sortedm2m_field_name':
            kwargs['widget'] = SortedFilteredSelectMultiple()
        return super(MyModelAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)

Todo

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

  • Add tests

Changelog

1.3.2:

Fix incorrect class name

1.3.1:

Fix duplicate “Add another” button in stacked inline (#12)

1.3:

Handle responsive css introduced in django 2.0 Handle removal of old JS cross-browser utilities introduced in django 2.0

1.2.1:

Add workaround to have verbose_name reference (#1) Fix Select and Clear All button (#2) Fix translation for Clear All button (#3)

1.2:

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

1.1:

Use admin_prefix to find image, in case user changes STATIC_URL setting Add version requirements per Django version

1.0:

Fixed bugs with popup closing. Added support for Django 1.10+

Metadata

Release files for django-sortedm2m-filter-horizontal-widget 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sortedm2m-filter-horizontal-widget 1.3.2
File Size Uploaded Provenance Actions
django-sortedm2m-filter-horizontal-widget-1.3.2.tar.gz 41.1 kB Without provenance Details for django-sortedm2m-filter-horizontal-widget-1.3.2.tar.gz

Release files / django-sortedm2m-filter-horizontal-widget-1.3.2.tar.gz

Download URL django-sortedm2m-filter-horizontal-widget-1.3.2.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ca8425e05a87bffac5b4e64adfb2cee91c96e074d66fe28ab263ad21f4687269
BLAKE2b-256 checksum
How to use checksums
ebf38d2ee3f866a9b04959aafd96d731506c2ad433c48f2ca99f6f5602905f5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-sortedm2m-filter-horizontal-widget 1.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page