diff --git a/.gitignore b/.gitignore
index 8c0f172..1b229d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
htmlcov
*.egg-info
.tox
+example.db
diff --git a/README.rst b/README.rst
index 0c4ed47..f41848e 100644
--- a/README.rst
+++ b/README.rst
@@ -35,8 +35,8 @@ USAGE
# settings.py
INSTALLED_APPS = (
- ...
- 'jsignature',
+ ...
+ 'jsignature',
)
* Use provided form field and widget:
@@ -121,7 +121,7 @@ Available settings are:
IN YOUR MODELS
==================
-If you wan to store signatures, provided mixin gives a ``signature`` and a ``signature_date`` that update themselves:
+If you want to store signatures, provided mixin gives a ``signature`` and a ``signature_date`` that update themselves:
::
@@ -132,11 +132,34 @@ If you wan to store signatures, provided mixin gives a ``signature`` and a ``sig
name = models.CharField()
+==================
+Example project
+==================
+
+If you want to have a demo of this package, just use the example project:
+
+::
+
+ 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/ `_ and login with the
+credentials your provided.
+
==================
AUTHORS
==================
* Florent Lebreton
+ * Sébastien Corbin
|makinacom|_
diff --git a/example_project/__init__.py b/example_project/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/example_project/admin.py b/example_project/admin.py
new file mode 100644
index 0000000..b4ccdd9
--- /dev/null
+++ b/example_project/admin.py
@@ -0,0 +1,5 @@
+from django.contrib import admin
+
+from .models import ExampleModel
+
+admin.site.register(ExampleModel)
diff --git a/example_project/manage.py b/example_project/manage.py
new file mode 100755
index 0000000..f9726f9
--- /dev/null
+++ b/example_project/manage.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)
diff --git a/example_project/migrations/0001_initial.py b/example_project/migrations/0001_initial.py
new file mode 100644
index 0000000..4ae89ff
--- /dev/null
+++ b/example_project/migrations/0001_initial.py
@@ -0,0 +1,26 @@
+# Generated by Django 3.0.5 on 2020-04-18 12:18
+
+from django.db import migrations, models
+import jsignature.fields
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='ExampleModel',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('signature', jsignature.fields.JSignatureField(blank=True, null=True, verbose_name='Signature')),
+ ('signature_date', models.DateTimeField(blank=True, null=True, verbose_name='Signature date')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ ]
diff --git a/example_project/migrations/__init__.py b/example_project/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/example_project/models.py b/example_project/models.py
new file mode 100644
index 0000000..a22b110
--- /dev/null
+++ b/example_project/models.py
@@ -0,0 +1,5 @@
+from jsignature.mixins import JSignatureFieldsMixin
+
+
+class ExampleModel(JSignatureFieldsMixin):
+ pass
diff --git a/example_project/settings.py b/example_project/settings.py
new file mode 100644
index 0000000..0e6db84
--- /dev/null
+++ b/example_project/settings.py
@@ -0,0 +1,67 @@
+import os
+
+BASE_DIR = os.path.abspath(os.path.dirname(__file__))
+
+DEBUG = True
+
+ALLOWED_HOSTS = ['*']
+
+MANAGERS = ADMINS = ()
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'example.db'),
+ 'USER': '',
+ 'PASSWORD': '',
+ 'HOST': '',
+ 'PORT': '',
+ }
+}
+
+SECRET_KEY = 'notsosecret'
+
+MIDDLEWARE = (
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+)
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': (
+ "django.template.context_processors.request",
+ "django.contrib.auth.context_processors.auth",
+ "django.template.context_processors.debug",
+ "django.template.context_processors.i18n",
+ "django.template.context_processors.media",
+ "django.template.context_processors.static",
+ "django.template.context_processors.tz",
+ "django.contrib.messages.context_processors.messages",
+ ),
+ },
+ },
+]
+
+ROOT_URLCONF = 'example_project.urls'
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.admin',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.staticfiles',
+ 'django.contrib.messages',
+ 'jsignature',
+ 'example_project',
+)
+
+STATIC_URL = '/static/'
+
+JSIGNATURE_JQUERY = 'admin'
diff --git a/example_project/urls.py b/example_project/urls.py
new file mode 100644
index 0000000..48e8c24
--- /dev/null
+++ b/example_project/urls.py
@@ -0,0 +1,8 @@
+from __future__ import unicode_literals
+
+from django.contrib import admin
+from django.urls import path
+
+urlpatterns = [
+ path('', admin.site.urls),
+]