Re: [Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-29 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
--+
 Reporter:  Shaheed Haque |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Documentation |  Version:  master
 Severity:  Normal|   Resolution:  wontfix
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * status:  new => closed
 * type:  Uncategorized => Cleanup/optimization
 * resolution:   => wontfix


Comment:

 Closing per discussion on PR.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.f12ff6d06bd9c938e5a392d23d4f421f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-21 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
---+
 Reporter:  Shaheed Haque  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Documentation  |  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:  0
---+
Changes (by Shaheed Haque):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.1db2a6ae098e2202eb8ed7744855aea2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-21 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
---+
 Reporter:  Shaheed Haque  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Documentation  |  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:  0
---+

Comment (by Shaheed Haque):

 I've created a PR at [https://github.com/django/django/pull/10077]. Please
 consider.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.55c13c968dc0d137a1f8c61044c9dafc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-19 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
---+
 Reporter:  Shaheed Haque  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Documentation  |  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:  0
---+
Changes (by Carlton Gibson):

 * cc: Carlton Gibson (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.95efd0c8f74656d589592ba6418da539%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-19 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
---+
 Reporter:  Shaheed Haque  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Documentation  |  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:  0
---+
Changes (by Carlton Gibson):

 * ui_ux:  1 => 0
 * version:  2.0 => master
 * stage:  Unreviewed => Accepted


Comment:

 OK, I'm going to provisionally accept this. If you can put together a
 patch we can have a look and see if there's a clarification to be made.

 I'm **half-minded** to say `wontfix` since JSON keys must always be
 strings, and whilst, like `'415'`, they might look like integers, there's
 no real ambiguity.
 But lets see what improvement you have in mind. :)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.ae2b91377e6059b67e1916de8bccde3e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-18 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
---+--
 Reporter:  Shaheed Haque  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Documentation  |  Version:  2.0
 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:  1
---+--
Description changed by Shaheed Haque:

Old description:

> The documentation on performing queries inside JSONField values
> [https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#key-
> index-and-path-lookups] says:
>
> {{{
> If the key is an integer, it will be interpreted as an index lookup in an
> array:
>
> >>> Dog.objects.filter(data__owner__other_pets__0__name='Fishy')
> }}}
>
> Note the specific mention of **array**. While this might be true, it is
> not the whole truth as applied to **dict/object**. For example, given a
> **dict/object** whose keys are strings (as always in JSON) but which look
> like integers:
>
> {{{
>   "employee": {
> "415": {
>   "email": "sherlock.hol...@acme.co.uk",
>   "mobile": "0700 1234567",
> }}}
>
> how is one supposed to select the **"415"** bit? It turns out that the
> same syntax as for the array case applies:
>
> {{{
> Foo.objects.filter(snapshot__employee__415__mobile='0700 1234567')
> }}}
>
> This was not at all obvious to me at least, especially as if the
> **"415"** is looked up as the terminal level in the query, the syntax
> becomes very different:
>
> {{{
> Foo.objects.filter(snapshot__employee__has_key='415')
> }}}
>
> Since I wasted quite a bit of time on this, I thought it might be useful
> to strengthen the documentation in this area to clarify how to lookup:
>
> * In arrays and dict/objects
> * if the key is the final term in the query
> * if the key is not the final term in the query

New description:

 The documentation on performing queries inside JSONField values
 [https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#key-
 index-and-path-lookups] says:

 {{{
 If the key is an integer, it will be interpreted as an index lookup in an
 array:

 >>> Dog.objects.filter(data__owner__other_pets__0__name='Fishy')
 }}}

 Note the specific mention of **array**. While this might be true, it is
 not the whole truth as applied to **dict/object**. For example, given a
 **dict/object** whose keys are strings (as always in JSON) but which look
 like integers:

 {{{
   "employee": {
 "415": {
   "email": "sherlock.hol...@acme.co.uk",
   "mobile": "0700 1234567",
 }}}

 how is one supposed to select the **"415"** bit? It turns out that the
 same syntax as for the array case applies:

 {{{
 Foo.objects.filter(snapshot__employee__415__mobile='0700 1234567')
 }}}

 This was not at all obvious to me at least, especially as if the **"415"**
 is looked up as the final key in the query, the syntax becomes very
 different:

 {{{
 Foo.objects.filter(snapshot__employee__has_key='415')
 }}}

 Since I wasted quite a bit of time on this, I thought it might be useful
 to strengthen the documentation in this area to clarify how to lookup:

 * In arrays and dict/objects
 * if the key is the final term in the query
 * if the key is not the final term in the query

--

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.a32b4d2a50f0e1182d6358c071f1ccdc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #29504: JSONField dictionary/object lookup using an "integer" key

2018-06-18 Thread Django
#29504: JSONField dictionary/object lookup using an "integer" key
-+
   Reporter:  Shaheed Haque  |  Owner:  nobody
   Type:  Uncategorized  | Status:  new
  Component:  Documentation  |Version:  2.0
   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  |
-+
 The documentation on performing queries inside JSONField values
 [https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#key-
 index-and-path-lookups] says:

 {{{
 If the key is an integer, it will be interpreted as an index lookup in an
 array:

 >>> Dog.objects.filter(data__owner__other_pets__0__name='Fishy')
 }}}

 Note the specific mention of **array**. While this might be true, it is
 not the whole truth as applied to **dict/object**. For example, given a
 **dict/object** whose keys are strings (as always in JSON) but which look
 like integers:

 {{{
   "employee": {
 "415": {
   "email": "sherlock.hol...@acme.co.uk",
   "mobile": "0700 1234567",
 }}}

 how is one supposed to select the **"415"** bit? It turns out that the
 same syntax as for the array case applies:

 {{{
 Foo.objects.filter(snapshot__employee__415__mobile='0700 1234567')
 }}}

 This was not at all obvious to me at least, especially as if the **"415"**
 is looked up as the terminal level in the query, the syntax becomes very
 different:

 {{{
 Foo.objects.filter(snapshot__employee__has_key='415')
 }}}

 Since I wasted quite a bit of time on this, I thought it might be useful
 to strengthen the documentation in this area to clarify how to lookup:

 * In arrays and dict/objects
 * if the key is the final term in the query
 * if the key is not the final term in the query

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.37068f1bdc02eb33cfa16e5385cf3f1e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.