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 1.4 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

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 1.3.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 1.3.0
File Size Uploaded Provenance Actions
django_clearable_widget-1.3.0.tar.gz 9.3 kB With provenance Details for django_clearable_widget-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 17.8 kB

Release files / django_clearable_widget-1.3.0.tar.gz

Download URL django_clearable_widget-1.3.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bfbe1a07f89ba50eff55ad10ac3b6308d5fac8b29c0efad2ac69410d3113ee6e
BLAKE2b-256 checksum
How to use checksums
f34825872f7e45167037c60c8978d8fafa283b034cc019bdc4a625cfb8a01e70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 10, 2026.

Transparency log

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

Download URL django_clearable_widget-1.3.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9ed752c1518f6c03590f2fcadaa2bf204728c29f1417c203d9353692d4fb541
BLAKE2b-256 checksum
How to use checksums
f961ac873563fb0ab4ab6dcc556a54e2e5b5393dc1816ea521072c56a6504d0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 10, 2026.

Transparency log

Security for django-clearable-widget 1.3.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_clearable_widget-1.3.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 Oct 10, 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