[Django] #29112: Make it easier to update specific keys within nested Django JSONField data.

29 views
Skip to first unread message

Django

unread,
Feb 4, 2018, 5:28:07 PM2/4/18
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
--------------------------------------------+------------------------
Reporter: Michael | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
--------------------------------------------+------------------------
Django's docs have a great example of querying nested data using double
underscore syntax similar to querying across foreign keys


{{{
Dog.objects.filter(data__owner__name='Bob')
}}}

What if we wanted to update this dogs owner's name instead (without
touching anything else)? Rather than doing this


{{{
dog = Dog.objects.get(pk=n)
data = dog.data
data['owner']['name'] = 'Steve'
dog.data = data
dog.save()
}}}

It would be great to do this:


{{{
Dog.objects.filter(pk=2).update(data__owner__name='Steve')
}}}


Looks like django-postgres-extensions[0] attempts to do this, but I found
the library to be unstable on 1.11.


[0] - http://django-postgres-extensions.readthedocs.io/

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

Django

unread,
Feb 4, 2018, 7:52:01 PM2/4/18
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
----------------------------------+------------------------------------

Reporter: Michael | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
----------------------------------+------------------------------------
Changes (by Simon Charette):

* version: 1.11 => master
* stage: Unreviewed => Accepted


Comment:

This is kind of related to #24709 but for `JSONField` instead of
`ArrayField`.

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:1>

Django

unread,
Feb 21, 2018, 1:20:29 AM2/21/18
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Priyansh
| Saxena
Type: New feature | Status: assigned

Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Priyansh Saxena):

* owner: (none) => Priyansh Saxena
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:2>

Django

unread,
Feb 21, 2018, 4:29:40 AM2/21/18
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Priyansh
| Saxena
Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Priyansh Saxena):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9715 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:3>

Django

unread,
Feb 21, 2018, 8:54:05 AM2/21/18
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Priyansh
| Saxena
Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:4>

Django

unread,
Feb 14, 2019, 8:56:32 AM2/14/19
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
----------------------------------+--------------------------------------
Reporter: Michael | Owner: Tom Forbes

Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
----------------------------------+--------------------------------------
Changes (by Tom Forbes):

* owner: Priyansh Saxena => Tom Forbes
* cc: Tom Forbes (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:5>

Django

unread,
Apr 29, 2019, 6:29:30 AM4/29/19
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Asif
| Saifuddin Auvi

Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Asif Saifuddin Auvi):

* owner: Tom Forbes => Asif Saifuddin Auvi


--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:6>

Django

unread,
Jun 24, 2020, 2:59:48 PM6/24/20
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Asif
| Saifuddin Auvi
Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by shauryashahi):

https://stackoverflow.com/q/62561675/2415394

Similar question. Posting here for visibility.

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:7>

Django

unread,
Jun 28, 2020, 10:31:37 PM6/28/20
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Asif
| Saifuddin Auvi
Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Priyansh Saxena):

Is this ticket in active development ? If not, I'd like to take it back
and finish this off.

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:8>

Django

unread,
Jun 29, 2020, 7:57:25 AM6/29/20
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
----------------------------------+------------------------------------

Reporter: Michael | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
----------------------------------+------------------------------------

Changes (by Asif Saifuddin Auvi):

* owner: Asif Saifuddin Auvi => (none)
* status: assigned => new


Comment:

plz take this over

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:9>

Django

unread,
Jun 29, 2020, 10:40:44 PM6/29/20
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Priyansh
| Saxena
Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Priyansh Saxena):

* owner: (none) => Priyansh Saxena


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:10>

Django

unread,
Jul 6, 2020, 3:04:39 AM7/6/20
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: Priyansh
| Saxena
Type: New feature | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* ui_ux: 1 => 0


Comment:

[https://github.com/django/django/pull/13152 New PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:11>

Django

unread,
Apr 27, 2021, 3:46:07 PM4/27/21
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------

Reporter: Michael | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Priyansh Saxena => (none)


* status: assigned => new

* component: contrib.postgres => Database layer (models, ORM)


--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:12>

Django

unread,
Jul 26, 2021, 1:47:31 AM7/26/21
to django-...@googlegroups.com
#29112: Make it easier to update specific keys within nested Django JSONField data.
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: (none)
Type: New feature | Status: closed

Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

Marking as a duplicate of #32519, with a more comprehensive discussion.

--
Ticket URL: <https://code.djangoproject.com/ticket/29112#comment:13>

Reply all
Reply to author
Forward
0 new messages