forked from 0x2620/pandora
use postgres json field
This commit is contained in:
parent
bbaaeb7263
commit
1bac062a50
24 changed files with 284 additions and 45 deletions
|
|
@ -5,10 +5,19 @@ import copy
|
|||
|
||||
from django.db import models
|
||||
from django.utils import datetime_safe
|
||||
import django.contrib.postgres.fields
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
|
||||
from six import string_types
|
||||
|
||||
from ox.utils import json
|
||||
|
||||
class JSONField(django.contrib.postgres.fields.JSONField):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'encoder' not in kwargs:
|
||||
kwargs['encoder'] = DjangoJSONEncoder
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def to_json(python_object):
|
||||
if isinstance(python_object, datetime.datetime):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue