mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #25995 -- Added an encoder option to JSONField
Thanks Berker Peksag and Tim Graham for the reviews.
This commit is contained in:
parent
989f6108d3
commit
13c3e5d5a0
7 changed files with 98 additions and 10 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue