[Django] #27134: JSONField key values are not escaped correctly in queries

10 views
Skip to first unread message

Django

unread,
Aug 27, 2016, 8:18:07 AM8/27/16
to django-...@googlegroups.com
#27134: JSONField key values are not escaped correctly in queries
-------------------------------+--------------------
Reporter: onurmatik | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
If a dictionary stored in a JSONField has a key that contains '/', like a
URI, it is not possible to use that value as a query parameter.

{{{
class Token(models.Model):
status = JSONField()

>>> Token.objects.create(status={
... '/help/tos': {'remaining': 10},
... })

>>> kwargs = {'status__/help/tos__remaining__gt': 0,}
>>> Token.objects.filter(**kwargs)
<QuerySet []>
}}}

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

Django

unread,
Aug 27, 2016, 8:19:10 AM8/27/16
to django-...@googlegroups.com
#27134: JSONField key values are not escaped correctly in queries
----------------------------------+--------------------------------------
Reporter: onurmatik | Owner: nobody
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by onurmatik):

* component: Uncategorized => contrib.postgres
* needs_better_patch: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Aug 27, 2016, 8:54:33 AM8/27/16
to django-...@googlegroups.com
#27134: JSONField key values are not escaped correctly in queries
----------------------------------+--------------------------------------
Reporter: onurmatik | Owner: nobody
Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by onurmatik):

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


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

Django

unread,
Aug 27, 2016, 8:55:32 AM8/27/16
to django-...@googlegroups.com
#27134: JSONField key values are not escaped correctly in queries
----------------------------------+--------------------------------------
Reporter: onurmatik | Owner: nobody

Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by onurmatik):

My bad. It was a typo. It is working as expected. Sorry.

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

Django

unread,
Aug 27, 2016, 10:48:10 AM8/27/16
to django-...@googlegroups.com
#27134: JSONField key values are not escaped correctly in queries
----------------------------------+--------------------------------------
Reporter: onurmatik | Owner: nobody

Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.10
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by timgraham):

* resolution: fixed => invalid


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

Reply all
Reply to author
Forward
0 new messages