Remove dependency over six
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
with jSignature jQuery plugin
|
||||
"""
|
||||
import json
|
||||
import six
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
from django.forms.widgets import HiddenInput
|
||||
@@ -17,6 +16,13 @@ from jsignature.settings import JSIGNATURE_DEFAULT_CONFIG
|
||||
JSIGNATURE_EMPTY_VALUES = validators.EMPTY_VALUES + ('[]', )
|
||||
|
||||
|
||||
try:
|
||||
from django.utils import six
|
||||
string_types = six.string_types
|
||||
except ImportError:
|
||||
string_types = str
|
||||
|
||||
|
||||
class JSignatureWidget(HiddenInput):
|
||||
"""
|
||||
A widget handling a signature capture field with with jSignature
|
||||
@@ -54,7 +60,7 @@ class JSignatureWidget(HiddenInput):
|
||||
""" Prepare value before effectively render widget """
|
||||
if value in JSIGNATURE_EMPTY_VALUES:
|
||||
return "[]"
|
||||
elif isinstance(value, six.string_types):
|
||||
elif isinstance(value, string_types):
|
||||
return value
|
||||
elif isinstance(value, list):
|
||||
return json.dumps(value)
|
||||
|
||||
Reference in New Issue
Block a user