Custom widget to add a (x) clear button to your input fields
Project description
django-clearable-widget
===
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.
Authored by [Basil Shubin](https://github.com/bashu)
[![Latest Version](https://img.shields.io/pypi/v/django-clearable-widget.svg)](https://pypi.python.org/pypi/django-clearable-widget/)
[![Downloads](https://img.shields.io/pypi/dm/django-clearable-widget.svg)](https://pypi.python.org/pypi/django-clearable-widget/)
[![License](https://img.shields.io/github/license/bashu/django-clearable-widget.svg)](https://pypi.python.org/pypi/django-clearable-widget/)
[![Build Status](https://img.shields.io/travis/bashu/django-clearable-widget.svg)](https://travis-ci.org/bashu/django-clearable-widget/)
## Installation
```shell
$ pip install django-clearable-widget
```
### External dependencies
* jQuery - This is not included in the package since it is expected that in most scenarios this would already be available.
## Setup
Add `clearable_widget` to `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
...
'clearable_widget',
]
```
and just include `clearable_widget` templates
```html
{% 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 :
```shell
$ python manage.py collectstatic
```
## Usage
All you need now is to import ``ClearableInput`` class and override field's widget, for example :
```python
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.
===
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.
Authored by [Basil Shubin](https://github.com/bashu)
[![Latest Version](https://img.shields.io/pypi/v/django-clearable-widget.svg)](https://pypi.python.org/pypi/django-clearable-widget/)
[![Downloads](https://img.shields.io/pypi/dm/django-clearable-widget.svg)](https://pypi.python.org/pypi/django-clearable-widget/)
[![License](https://img.shields.io/github/license/bashu/django-clearable-widget.svg)](https://pypi.python.org/pypi/django-clearable-widget/)
[![Build Status](https://img.shields.io/travis/bashu/django-clearable-widget.svg)](https://travis-ci.org/bashu/django-clearable-widget/)
## Installation
```shell
$ pip install django-clearable-widget
```
### External dependencies
* jQuery - This is not included in the package since it is expected that in most scenarios this would already be available.
## Setup
Add `clearable_widget` to `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
...
'clearable_widget',
]
```
and just include `clearable_widget` templates
```html
{% 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 :
```shell
$ python manage.py collectstatic
```
## Usage
All you need now is to import ``ClearableInput`` class and override field's widget, for example :
```python
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-clearable-widget-0.1.4.tar.gz
.
File metadata
- Download URL: django-clearable-widget-0.1.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 160395d289c90a8f4980acc96378e5568bd2215f69ead8a5274c0bcb9ed2cce1 |
|
MD5 | 56b4f1b6faa2b2c6fdfb2283046f760c |
|
BLAKE2b-256 | a1c90c5c5cd478daccb9f744c07cc64acb2ae46c167d08c95f82dea02633fe82 |