Skip to main content

django-clearable-widget

https://badge.fury.io/py/django-clearable-widget.svg https://img.shields.io/pypi/pyversions/django-clearable-widget.svg https://img.shields.io/pypi/djversions/django-clearable-widget.svg https://github.com/bashu/django-clearable-widget/actions/workflows/test.yml/badge.svg

django-clearable-widget is a custom widget that adds a input clearing button on any input fields that are using it. It clears the value, and returns focus to that field.

https://raw.githubusercontent.com/bashu/django-clearable-widget/develop/showcase.gif

Installation

pip install django-clearable-widget

Setup

Add clearable_widget to INSTALLED_APPS:

INSTALLED_APPS += (
    'clearable_widget',
)

and just include clearable_widget templates

{% include "clearable_widget/clearable_widget_css.html" %} {# Before the closing head tag #}
{% include "clearable_widget/clearable_widget_js.html" %} {# Before the closing body tag #}

When deploying on production server, don’t forget to run:

python manage.py collectstatic

Usage

All you need now is to import ClearableInput class and override field’s widget, for example:

from clearable_widget import ClearableInput

class Form(forms.Form):

    field = forms.CharField(widget=ClearableInput)

Please see example application. This application is used to manually test the functionalities of this package. This also serves as a good example.

You need only Django 5.2 or above to run that. It might run on older versions but that is not tested.

License

django-clearable-widget is released under the BSD license.

Changes

2.0.0 (2026-11-14)

  • Removed Jinja2 support: the USE_JINJA setting is no longer recognised and the clearable_widget/input.jinja template is gone; the widget always renders clearable_widget/input.html.

  • Moved the package to a src layout and switched the build backend from setuptools to hatchling; tests moved to a top-level tests directory.

  • Shipped a py.typed marker, so type checkers now use the package’s inline type hints.

1.3.0 (2026-10-10)

  • Dropped Python 3.10 support; 3.11 is now the minimum required version.

1.2.0 (2026-09-08)

  • Dropped the jQuery dependency; clearable.js is now plain vanilla JS.

1.1.0 (2026-08-14)

  • Dropped Python <3.10 / Django <5.2 support; added Django 6.0 / 6.1 support.

  • Moved the Jinja2 template into clearable_widget/jinja2/ so it’s genuinely served by the Jinja2 backend instead of silently falling through to DjangoTemplates.

  • Fixed the clear button staying hidden on pre-filled fields until the first keystroke.

  • Fixed a dead if (form) check in clearable.js that never actually guarded anything.

1.0.0 (2021-11-30)

  • Added Django 3+ support.

  • Dropped Python 2.7 support.

  • Dropped Django 1.10 / 1.11 support.

Metadata

Release files for django-clearable-widget 2.0.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 django-clearable-widget 2.0.0
File Size Uploaded Provenance Actions
django_clearable_widget-2.0.0.tar.gz 9.4 kB With provenance Details for django_clearable_widget-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-clearable-widget 2.0.0
File Interpreter ABI Platform Actions
django_clearable_widget-2.0.0-py3-none-any.whl Python 3 none any Details for django_clearable_widget-2.0.0-py3-none-any.whl

Total release size: 17.8 kB

Release files / django_clearable_widget-2.0.0.tar.gz

Download URL django_clearable_widget-2.0.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b62820ce371f08e457c2f133dbdd905f01781349d09c424a6f8e15a16a6f1273
BLAKE2b-256 checksum
How to use checksums
ffc30a166da88b249940386aecda9f9153cb18045171f03fcd091b5c148aa1e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / django_clearable_widget-2.0.0-py3-none-any.whl

Download URL django_clearable_widget-2.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df4e3f1b462348033019a69e8946db577261aad8bc03ac8cfb2b3340d2497ae9
BLAKE2b-256 checksum
How to use checksums
cde6ced245b3dc3fb93b5369c1ef0b3bf7bd5120bd090d9ba49ff2dbfda2f931
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for django-clearable-widget 2.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_clearable_widget-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

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