Fixed #25995 -- Added an encoder option to JSONField

Thanks Berker Peksag and Tim Graham for the reviews.
This commit is contained in:
Claude Paroz 2016-08-11 21:05:52 +02:00
parent 989f6108d3
commit 13c3e5d5a0
7 changed files with 98 additions and 10 deletions

View file

@ -1,3 +1,4 @@
from django.core.serializers.json import DjangoJSONEncoder
from django.db import connection, models
from .fields import (
@ -132,6 +133,7 @@ class RangeLookupsModel(PostgreSQLModel):
if connection.vendor == 'postgresql' and connection.pg_version >= 90400:
class JSONModel(models.Model):
field = JSONField(blank=True, null=True)
field_custom = JSONField(blank=True, null=True, encoder=DjangoJSONEncoder)
else:
# create an object with this name so we don't have failing imports
class JSONModel(object):