Skip to main content

acdh-django-widgets

acdh-django-widgets is a Django app providing a collection of custom widgets for Django-Forms/Filter

Installation/Usage

Install the package e.g.

pip install acdh-django-widgets

add acdh-django-widgets to your INSTALLED_APPS

INSTALLED_APPS = [
    ...
    "acdh-django-widgets",
    ...
]

Widgets

MartinAntonMuellerWidget

This widget extends django_filters.widgets.RangeWidget to provide a one-line range input interface, separated with a 'Halbgeviertstrich' ('–'). It's designed for numeric range filtering where two input fields (min and max) are displayed in a single line. It is named after @martinantonmueller because he likes the 'Halbgeviertstrich' ('–').

from acdh_django_widgets.widgets import MartinAntonMuellerWidget

class MyCustomFilter(FilterSet):
    
    start_date__year = RangeFilter(
        label=" Zeitraum: Anfang – Ende (z. B. 1862–1931)",
        widget=MartinAntonMuellerWidget
    )
    

DateRangePickerWidget

A custom DateRangeWidget that renders a date range picker using a template. This widget extends django_filters.widgets.DateRangeWidget to provide a date range picker interface. It uses a custom template for rendering the widget and allows setting minimum and maximum date values.

from acdh_django_widgets.widgets import DateRangePickerWidget

class MyCustomFilter(FilterSet):
    decission_date = django_filters.DateFromToRangeFilter(
        help_text=CourtDecission._meta.get_field("decission_date").help_text,
        label=CourtDecission._meta.get_field("decission_date").verbose_name,
        widget=DateRangePickerWidget
    )

RangeSliderWidget

A Django widget that renders a range slider using noUiSlider. This widget extends django_filters.widgets.RangeWidget to create an interactive range slider for selecting numeric ranges. It uses the noUiSlider JavaScript library for the slider functionality and wNumb for number formatting.

from acdh_django_widgets.widgets import RangeSliderWidget

class MyCustomFilter(FilterSet):
    year = django_filters.RangeFilter(
        help_text=YearBook._meta.get_field("year").help_text,
        label=YearBook._meta.get_field("year").verbose_name,
        widget=RangeSliderWidget(
            attrs={"min": "1900", "max": "2030", "hide_input_fileds": False}
        ),
    )

[!IMPORTANT]
The templates used in those widgets are using bootstrap5 classes so ideally those widgets are used with django-crispy-forms and crispy-bootstrap5

Metadata

Release files for acdh-django-widgets 0.1.0

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

Source distribution (sdist)

Source distribution for acdh-django-widgets 0.1.0
File Size Uploaded
acdh_django_widgets-0.1.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for acdh-django-widgets 0.1.0
File Interpreter ABI Platform
acdh_django_widgets-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / acdh_django_widgets-0.1.0.tar.gz

Download URL acdh_django_widgets-0.1.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
456ffb5b590f9809b477e06cfd739361400e4b7aa2884c95c241c0ea2d31e6d5
BLAKE2b-256 checksum
How to use checksums
38ff7fcbce15eb3a1c080d044c62d0aa8c1beda7404fd520fdc55932ed98f21b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / acdh_django_widgets-0.1.0-py3-none-any.whl

Download URL acdh_django_widgets-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b6206fde4b808c5727c2bf368ae0289ac1f52c4930264781c942a4d104665bc
BLAKE2b-256 checksum
How to use checksums
0014a867c29658aa51ab6034d8e6bceee60a8dd71e74889f43e5bd0e48e73484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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