#12990: New Field Type: JSONField
-------------------------------------+-------------------------------------
               Reporter:  paltman    |          Owner:  nobody
                   Type:  New        |         Status:  new
  feature                            |      Component:  Database layer
              Milestone:             |  (models, ORM)
                Version:  1.2-beta   |       Severity:  Normal
             Resolution:             |       Keywords:
           Triage Stage:  Design     |      Has patch:  1
  decision needed                    |    Needs tests:  1
    Needs documentation:  0          |  Easy pickings:  0
Patch needs improvement:  1          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------

Comment (by radbrad182+djangoproject@…):

 JSON fields are also a great way to store basic, dynamic, typed data.
 Being able to store Key Value data in the DB would be useful:

 {{{
 class Key(models.Model):
    user = models.ForeignKey(User)
    name = models.CharField()
    value = models.JSONField()

 user.key_set.create(name="an_integer", value=4)
 user.key_set.create(name="a_list", value=['a','b','c'])
 }}}

 Normally to get this kind of basic data typing you would need to store
 another field for value_type, and then parse manually.

 Arguing that this should be stored in a K/V store is not ideal as it adds
 dependency on another datastore type, and you lose out on
 user.key_set.get(name='something').

-- 
Ticket URL: <https://code.djangoproject.com/ticket/12990#comment:33>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to