Skip to main content

Provides a simple way to handle jSignature jQuery plugin through a django form.

Project description

A simple way to use jSignature jQuery plugin in your Django projects.

It provides:

  • A form field and a form widget to handle jquery plugin through a Django form;
  • A model field to store a captured signature;
  • A mixin adding two fields (signature / signature_date) in any of your Django models.


pip install django_jsignature3


  • Add jsignature to your INSTALLED_APPS:

In a Form

  • Use provided form field and widget:
from django import forms
from jsignature.forms import JSignatureField

class SignatureForm(forms.Form):
    signature = JSignatureField()
  • In your template
{{ }}
<form action="." method="POST">
    {% for field in form %}
        {{ field.label_tag }}
        {{ field }}
    {% endfor %}
    <input type="submit" value="Save"/>
    {% csrf_token %}
  • Render image after form validation:
from jsignature.utils import draw_signature
from myapp.forms import SignatureForm

def my_view(request):
    form = SignatureForm(request.POST or None)
    if form.is_valid():
        signature = form.cleaned_data.get('signature')
        if signature:
            # as an image
            signature_picture = draw_signature(signature)
            # or as a file
            signature_file_path = draw_signature(signature, as_file=True)

In Django Admin

from jsignature.fields import JSignatureField

class Firma(models.Model):
    firma = JSignatureField(blank=True, null=True)

If you wan to store signatures, provided mixin gives a signature and a signature_date that update themselves:

from django.db import models
from jsignature.mixins import JSignatureFieldsMixin

class JSignatureModel(JSignatureFieldsMixin):
    name = models.CharField()


JSignature plugin options are available in python:

  • Globally, in your settings:
  • Specifically, in your form:
from jsignature.forms import JSignatureField
from jsignature.widgets import JSignatureWidget

JSignatureField(widget=JSignatureWidget(jsignature_attrs={'color': '#CCC'}))

Available settings are:

  • JSIGNATURE_BACKGROUND_COLOR (background-color)
  • JSIGNATURE_DECOR_COLOR (decor-color)




Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-jsignature3, version 0.9.0
Filename, size File type Python version Upload date Hashes
Filename, size django_jsignature3-0.9.0-py3-none-any.whl (24.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django_jsignature3-0.9.0.tar.gz (19.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page