i learning django , frustrated creating json field in model. trying create json field in model got error: 'module' object has no attribute 'jsonfield'. here class in models.py:
class question(models.model): question_text = models.jsonfield(max_length=200) pub_date = models.datetimefield('date published')
i using django 1.9.8 , postgresql 9.2.13. need table created in postgresql db has column json type. how can in model class? thank you!
there's no jsonfield
in models. there's handy jsonfield
package available use jsonfield
in django models. install package, do:
pip install jsonfield
once installed, do:
from jsonfield import jsonfield django.db import models class question(models.model): question_text = jsonfield(max_length=200) pub_date = models.datetimefield('date published')
Comments
Post a Comment