Can anyone tell me how to define a json data type to a particular field in models.
I have tried this
from django.db import models
import jsonfield
class Test(models.Model):
data = jsonfield.JSONField()
but when I say python manage.py sqlall xyz
its taking the data field as text
BEGIN;
CREATE TABLE "xyz_test" (
"data" text NOT NULL
)
;
I still tried to insert json data into that field but its giving error as :
ERROR: value too long for type character varying(15)
someone please help. Thanks in Advance.