Repository: django-extensions/django-extensions

Issue:
DeprecationWarning: SubfieldBase is being removed in Django 1.10
An early warning for you... I noticed this warning popping up when I'm testing against Django 1.9 (master branch):

```
/home/jaddison/project/src/django/django/db/models/fields/subclassing.py:22: RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead.
  RemovedInDjango110Warning)
```

I found that `SubfieldBase` is used in django-extensions, thought I'd pass this along.



Discussion:

Resolving patch:
diff --git a/django_extensions/db/fields/encrypted.py b/django_extensions/db/fields/encrypted.py
--- a/django_extensions/db/fields/encrypted.py
+++ b/django_extensions/db/fields/encrypted.py
@@ -84,6 +84,9 @@ def to_python(self, value):
             retval = value
         return retval
 
+    def from_db_value(self, value, expression, connection, context):
+        return self.to_python(value)
+
     def get_db_prep_value(self, value, connection, prepared=False):
         if value and not value.startswith(self.prefix):
             # We need to encode a unicode string into a byte string, first.
@@ -109,8 +112,7 @@ def deconstruct(self):
         return name, path, args, kwargs
 
 
-class EncryptedTextField(six.with_metaclass(models.SubfieldBase,
-                                            BaseEncryptedField)):
+class EncryptedTextField(BaseEncryptedField):
     def get_internal_type(self):
         return 'TextField'
 
@@ -120,8 +122,7 @@ def formfield(self, **kwargs):
         return super(EncryptedTextField, self).formfield(**defaults)
 
 
-class EncryptedCharField(six.with_metaclass(models.SubfieldBase,
-                                            BaseEncryptedField)):
+class EncryptedCharField(BaseEncryptedField):
     def __init__(self, *args, **kwargs):
         super(EncryptedCharField, self).__init__(*args, **kwargs)
 
diff --git a/django_extensions/db/fields/json.py b/django_extensions/db/fields/json.py
--- a/django_extensions/db/fields/json.py
+++ b/django_extensions/db/fields/json.py
@@ -56,14 +56,14 @@ def __repr__(self):
         return dumps(self)
 
 
-class JSONField(six.with_metaclass(models.SubfieldBase, models.TextField)):
+class JSONField(models.TextField):
     """JSONField is a generic textfield that neatly serializes/unserializes
     JSON objects seamlessly.  Main thingy must be a dict object."""
 
     def __init__(self, *args, **kwargs):
         default = kwargs.get('default', None)
         if default is None:
-            kwargs['default'] = '{}'
+            kwargs['default'] = {}
         elif isinstance(default, (list, dict)):
             kwargs['default'] = dumps(default)
         models.TextField.__init__(self, *args, **kwargs)
@@ -88,6 +88,9 @@ def get_prep_value(self, value):
         """Do not call `to_python` method."""
         return super(models.TextField, self).get_prep_value(value)
 
+    def from_db_value(self, value, expression, connection, context):
+        return self.to_python(value)
+
     def get_db_prep_save(self, value, connection, **kwargs):
         """Convert our JSON object to a string before we save"""
         if value is None and self.null:


Test patch: