first comit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -0,0 +1,311 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: django-jsignature
|
||||
Version: 0.12
|
||||
Summary: Use jSignature jQuery plugin in your django projects
|
||||
Home-page: https://github.com/fle/django-jsignature
|
||||
Download-URL: http://pypi.python.org/pypi/django-jsignature
|
||||
Author: Florent Lebreton
|
||||
Author-email: florent.lebreton@makina-corpus.com
|
||||
License: LPGL, see LICENSE file.
|
||||
Classifier: Topic :: Utilities
|
||||
Classifier: Natural Language :: English
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Django
|
||||
Classifier: Framework :: Django :: 4.2
|
||||
Classifier: Framework :: Django :: 5.0
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
License-File: LICENSE
|
||||
Requires-Dist: Django >=4.2
|
||||
Requires-Dist: pillow
|
||||
Requires-Dist: pyquery >=1.4.2
|
||||
|
||||
A simple way to use `jSignature jQuery plugin <https://github.com/brinley/jSignature/blob/master/README.md>`_ in your `Django <https://www.djangoproject.com>`_ 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.
|
||||
* A template filter to render signatures as base64 image urls.
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/django-jsignature.svg
|
||||
:target: https://pypi.python.org/pypi/django-jsignature/
|
||||
:alt: Latest PyPI version
|
||||
|
||||
.. image:: https://github.com/fle/django-jsignature/actions/workflows/actions.yml/badge.svg
|
||||
:target: https://github.com/fle/django-jsignature/actions
|
||||
:alt: Build status
|
||||
|
||||
.. image:: https://coveralls.io/repos/github/fle/django-jsignature/badge.svg?branch=master
|
||||
:target: https://coveralls.io/github/fle/django-jsignature?branch=master
|
||||
:alt: Coverage status
|
||||
|
||||
.. image:: https://github.com/fle/django-jsignature/blob/master/screen.png
|
||||
|
||||
==================
|
||||
Installation
|
||||
==================
|
||||
|
||||
::
|
||||
|
||||
pip install django-jsignature
|
||||
|
||||
==================
|
||||
Usage
|
||||
==================
|
||||
|
||||
* Add ``jsignature`` to your ``INSTALLED_APPS``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# settings.py
|
||||
INSTALLED_APPS = (
|
||||
...
|
||||
'jsignature',
|
||||
)
|
||||
|
||||
* Use provided model field (for easy storage):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# models.py
|
||||
from django.db import models
|
||||
from jsignature.fields import JSignatureField
|
||||
|
||||
class SignatureModel(models.Model):
|
||||
signature = JSignatureField()
|
||||
|
||||
* In your form template
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
{{ form.media }}
|
||||
<form action="" method="post">
|
||||
{{ form }}
|
||||
<input type="submit" value="Save" />
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
|
||||
* Render image from db value in your display template:
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
{# yourtemplate.html #}
|
||||
{% load jsignature_filters %}
|
||||
|
||||
<img src="{{ obj.signature|signature_base64 }}" alt="{{ obj }}" />
|
||||
|
||||
|
||||
* By default, jSignature is made to work outside of admin, requiring that
|
||||
you include the jQuery library in your ``<head>``.
|
||||
|
||||
If you want to use jSignature in the Django admin site, set the
|
||||
``JSIGNATURE_JQUERY`` setting to ``admin``. Otherwise if set to any url
|
||||
pointing to jQuery, it will be automatically included.
|
||||
|
||||
It is strongly suggested to take example from ``example_project``, which is
|
||||
`located in this repo <https://github.com/fle/django-jsignature/tree/master/example_project>`_
|
||||
|
||||
==================
|
||||
Customization
|
||||
==================
|
||||
|
||||
JSignature plugin options are available in python:
|
||||
|
||||
* Globally, in your settings:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# settings.py
|
||||
JSIGNATURE_WIDTH = 500
|
||||
JSIGNATURE_HEIGHT = 200
|
||||
|
||||
* Specifically, in your form:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# forms.py
|
||||
from jsignature.forms import JSignatureField
|
||||
from jsignature.widgets import JSignatureWidget
|
||||
|
||||
JSignatureField(widget=JSignatureWidget(jsignature_attrs={'color': '#CCC'}))
|
||||
|
||||
Available settings are:
|
||||
|
||||
* ``JSIGNATURE_WIDTH`` (width)
|
||||
* ``JSIGNATURE_HEIGHT`` (height)
|
||||
* ``JSIGNATURE_COLOR`` (color)
|
||||
* ``JSIGNATURE_BACKGROUND_COLOR`` (background-color)
|
||||
* ``JSIGNATURE_DECOR_COLOR`` (decor-color)
|
||||
* ``JSIGNATURE_LINE_WIDTH`` (lineWidth)
|
||||
* ``JSIGNATURE_UNDO_BUTTON`` (UndoButton)
|
||||
* ``JSIGNATURE_RESET_BUTTON`` (ResetButton)
|
||||
|
||||
==================
|
||||
In your models
|
||||
==================
|
||||
|
||||
If you want to store signatures easily, a provided mixin gives a ``signature``
|
||||
and a ``signature_date`` that update themselves:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.db import models
|
||||
from jsignature.mixins import JSignatureFieldsMixin
|
||||
|
||||
class JSignatureModel(JSignatureFieldsMixin):
|
||||
name = models.CharField()
|
||||
|
||||
|
||||
==================
|
||||
In your forms
|
||||
==================
|
||||
|
||||
* If you need more precise handling of the form field, you can use it directly:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# forms.py
|
||||
from django import forms
|
||||
from jsignature.forms import JSignatureField
|
||||
|
||||
class SignatureForm(forms.Form):
|
||||
signature = JSignatureField()
|
||||
|
||||
|
||||
* And upon saving, have direct access to the image with ``draw_signature()``
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# views.py
|
||||
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)
|
||||
|
||||
|
||||
==================
|
||||
Example project
|
||||
==================
|
||||
|
||||
If you want to have a demo of this package, just use the example project:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/fle/django-jsignature.git
|
||||
cd django-jsignature
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
pip install -e .
|
||||
cd example_project
|
||||
./manage.py migrate
|
||||
./manage.py createsuperuser
|
||||
|
||||
Fill the user info, launch django with ``./manage.py runserver`` and head over
|
||||
to `http://127.0.0.1:8000/ <http://127.0.0.1:8000/>`_, you can also
|
||||
`login to the admin <http://127.0.0.1:8000/admin>`_ with the credentials your
|
||||
provided.
|
||||
|
||||
==================
|
||||
Authors
|
||||
==================
|
||||
|
||||
* Florent Lebreton <florent.lebreton@makina-corpus.com> (original author)
|
||||
* Sébastien Corbin <sebastien.corbin@makina-corpus.com> (maintainer)
|
||||
|
||||
|makinacom|_
|
||||
|
||||
.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif
|
||||
.. _makinacom: http://www.makina-corpus.com
|
||||
|
||||
|
||||
|
||||
=========
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
0.12 (2024-01-27)
|
||||
==================
|
||||
|
||||
** Bug fixed **
|
||||
|
||||
- Draw single points
|
||||
|
||||
** New **
|
||||
|
||||
- Updated Github Actions.
|
||||
- Dropped support for python < 3.8
|
||||
- Dropped support for Django < 4.2
|
||||
- Add support for pillow >= 10
|
||||
- Updated jSignature to latest version
|
||||
|
||||
|
||||
0.11 (2022-01-17)
|
||||
==================
|
||||
|
||||
** New **
|
||||
|
||||
- Django 4.0 compatibility.
|
||||
- Moved to Github Actions for testing.
|
||||
- Added flake8 in CI.
|
||||
- Dropped support for python < 3.6
|
||||
- Dropped support for Django 1.11, 2.0, 2.1, 3.0, 3.1.
|
||||
|
||||
|
||||
0.10 (2020-07-26)
|
||||
==================
|
||||
|
||||
** New **
|
||||
|
||||
- Add template filter to easily render a signature structure as base64 url.
|
||||
- Add a full example of front-office usage.
|
||||
|
||||
|
||||
0.9 (2020-04-18)
|
||||
==================
|
||||
|
||||
** New **
|
||||
|
||||
- Add support for Django 2+
|
||||
- Drop support for Django<1.11
|
||||
- Add a ``JSIGNATURE_JQUERY`` settings to handle usage in admin in Django 2.1+
|
||||
|
||||
|
||||
0.8 (2014-12-04)
|
||||
==================
|
||||
|
||||
** New **
|
||||
|
||||
- Add support for Python 3 (@Gagaro)
|
||||
- Add support for Django 1.7 (@Gagaro)
|
||||
|
||||
|
||||
0.7.6 (2014-11-26)
|
||||
==================
|
||||
|
||||
** New features **
|
||||
|
||||
- A setting to display (or not) the reset button has been added (@jsayles)
|
||||
|
||||
** Internal changes **
|
||||
|
||||
- Rendering is now based on a template (@andybak)
|
||||
- Javascript is properly initialized (@andybak)
|
||||
@@ -0,0 +1,32 @@
|
||||
django_jsignature-0.12.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
django_jsignature-0.12.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
|
||||
django_jsignature-0.12.dist-info/METADATA,sha256=BfbPKisQ0qul3hbV1cgFGIYgcqJbfP7BO_eibEF8BRI,8117
|
||||
django_jsignature-0.12.dist-info/RECORD,,
|
||||
django_jsignature-0.12.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
django_jsignature-0.12.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
||||
django_jsignature-0.12.dist-info/top_level.txt,sha256=v858vRuS8YrknusEtTbt2JyqdlydeI02oC_Ckl2T8A4,11
|
||||
jsignature/__init__.py,sha256=YySwuXKRg4uH06S33MK71w5tuYEU0UE5REJJtDeMZC4,185
|
||||
jsignature/__pycache__/__init__.cpython-310.pyc,,
|
||||
jsignature/__pycache__/fields.cpython-310.pyc,,
|
||||
jsignature/__pycache__/forms.cpython-310.pyc,,
|
||||
jsignature/__pycache__/mixins.cpython-310.pyc,,
|
||||
jsignature/__pycache__/models.cpython-310.pyc,,
|
||||
jsignature/__pycache__/settings.cpython-310.pyc,,
|
||||
jsignature/__pycache__/utils.cpython-310.pyc,,
|
||||
jsignature/__pycache__/widgets.cpython-310.pyc,,
|
||||
jsignature/fields.py,sha256=qG-XFR2Rzj1_c2_4glwrAxxNOOirWlrMPMj10aLlH44,1448
|
||||
jsignature/forms.py,sha256=h513kJ51EMi3cvQOnOrrkOYvtsuHBoUNkLFPOfQD0D8,881
|
||||
jsignature/locale/fr/LC_MESSAGES/django.mo,sha256=fDGfrzvy-GeE3im7Nz8kyZGeL_vNdNp50k4O2LnliQY,576
|
||||
jsignature/mixins.py,sha256=6S7BxJJotx7NzMAgbOVEBIM2AVXL0U5Dlll5zrPU4JQ,1050
|
||||
jsignature/models.py,sha256=GBmymZS35dTYieoLPTWdFRlFknJNPlXbT0io_-NNfR8,49
|
||||
jsignature/settings.py,sha256=4V36R1rwvTZ0BaBgBH3dom9hzLS63wera3tBLiciDWM,1085
|
||||
jsignature/static/js/django_jsignature.js,sha256=efC8jAtKcBYwziYxeBuBfExATJ05k_TP53VF9wcIQ0U,824
|
||||
jsignature/static/js/jSignature.min.js,sha256=h6BJ8y9E-78DOlTE7KUJzDkfE9kEBr9PGoPoSd6Lnk4,24240
|
||||
jsignature/static/js/jsignature_admin_init.js,sha256=3kRMXFswgFJobGV0v4cBeD1lyOEXpurqcZEVBtkAGSE,88
|
||||
jsignature/templates/jsignature/widget.html,sha256=QvrzVM70QcabDZ3ogd8C1oyPWDwnI-hmkb1ke_jYhvk,302
|
||||
jsignature/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
jsignature/templatetags/__pycache__/__init__.cpython-310.pyc,,
|
||||
jsignature/templatetags/__pycache__/jsignature_filters.cpython-310.pyc,,
|
||||
jsignature/templatetags/jsignature_filters.py,sha256=81VMh9Q9DfuL_5VWDtoKt54B0s2wg6cV5Pd5qu34-uY,529
|
||||
jsignature/utils.py,sha256=MokkLFEY1PMLJUFG_7_tSPcJAUYY997px91B7Ws70BM,2678
|
||||
jsignature/widgets.py,sha256=DlF2vlRU9OJhepfBs349vFClvJMeqd5Kr7jtIk0XFVQ,3267
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.42.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
jsignature
|
||||
Reference in New Issue
Block a user