Django 1.9 - JSONField in Models

后端 未结 6 573
天命终不由人
天命终不由人 2020-12-30 02:16

I\'m trying to set up a models file in Django 1.9 using the new JSONField. I have found examples using postgres but none with MySql. In the examples with postgres they do

6条回答
  •  礼貌的吻别
    2020-12-30 02:35

    # Install jsonfield package
    pip install jsonfield
    
    # Define my model
    from django.db import models
    import jsonfield
    
    class MyModel(models.Model):
        the_json = jsonfield.JSONField()
    

    More detail:https://pypi.python.org/pypi/django-jsonfield

提交回复
热议问题