Metadata-Version: 2.4
Name: django-signature-field
Version: 0.1.0
Summary: Django field for storing canvas signatures as blob or image
Author-email: Octolo <dev@octolo.tech>
License-Expression: MIT
Project-URL: Homepage, https://github.com/octolo/django-signature-field
Project-URL: Repository, https://github.com/octolo/django-signature-field
Project-URL: Documentation, https://github.com/octolo/django-signature-field#readme
Project-URL: Issues, https://github.com/octolo/django-signature-field/issues
Keywords: django,django-field,signature,signature-pad,image-field,binary-field,django-orm,python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=3.2
Requires-Dist: Pillow>=9.0
Provides-Extra: dev
Requires-Dist: pytest>=8.3; extra == "dev"
Requires-Dist: pytest-django>=4.5; extra == "dev"
Requires-Dist: ruff>=0.5; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: django-stubs>=5.0.0; extra == "dev"
Dynamic: license-file

# django-signature-field

Django field for storing canvas signatures as binary data or image files.

## Purpose

Store signature pad output in the database either as a binary blob (default) or as an uploaded PNG file.

## Installation

```bash
pip install django-signature-field
```

## Quick Start

```python
from django.db import models
from signature import SignatureField


class Contract(models.Model):
    title = models.CharField(max_length=100)

    # Default: binary storage
    signature = SignatureField()

    # Or explicitly as blob
    signature_blob = SignatureField(field_type="blob")

    # Or as image file
    signature_image = SignatureField(field_type="image", upload_to="signatures/")
```

## Input formats

The field accepts:

- Raw bytes
- Base64 text
- Data URLs (`data:image/png;base64,...`)

## Field modes

| `field_type` | Storage | Django field |
|--------------|---------|--------------|
| `"blob"` (default) | Raw PNG bytes in database | `BinaryField` |
| `"image"` | PNG file on storage | `ImageField` |

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT
