Include example project
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
htmlcov
|
htmlcov
|
||||||
*.egg-info
|
*.egg-info
|
||||||
.tox
|
.tox
|
||||||
|
example.db
|
||||||
|
|||||||
25
README.rst
25
README.rst
@@ -121,7 +121,7 @@ Available settings are:
|
|||||||
IN YOUR MODELS
|
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()
|
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/ <http://127.0.0.1:8000/>`_ and login with the
|
||||||
|
credentials your provided.
|
||||||
|
|
||||||
==================
|
==================
|
||||||
AUTHORS
|
AUTHORS
|
||||||
==================
|
==================
|
||||||
|
|
||||||
* Florent Lebreton <florent.lebreton@makina-corpus.com>
|
* Florent Lebreton <florent.lebreton@makina-corpus.com>
|
||||||
|
* Sébastien Corbin <sebastien.corbin@makina-corpus.com>
|
||||||
|
|
||||||
|makinacom|_
|
|makinacom|_
|
||||||
|
|
||||||
|
|||||||
0
example_project/__init__.py
Normal file
0
example_project/__init__.py
Normal file
5
example_project/admin.py
Normal file
5
example_project/admin.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import ExampleModel
|
||||||
|
|
||||||
|
admin.site.register(ExampleModel)
|
||||||
10
example_project/manage.py
Executable file
10
example_project/manage.py
Executable file
@@ -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)
|
||||||
26
example_project/migrations/0001_initial.py
Normal file
26
example_project/migrations/0001_initial.py
Normal file
@@ -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,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
0
example_project/migrations/__init__.py
Normal file
0
example_project/migrations/__init__.py
Normal file
5
example_project/models.py
Normal file
5
example_project/models.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from jsignature.mixins import JSignatureFieldsMixin
|
||||||
|
|
||||||
|
|
||||||
|
class ExampleModel(JSignatureFieldsMixin):
|
||||||
|
pass
|
||||||
67
example_project/settings.py
Normal file
67
example_project/settings.py
Normal file
@@ -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'
|
||||||
8
example_project/urls.py
Normal file
8
example_project/urls.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('', admin.site.urls),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user