Since any string could be a key in a hstore value, any lookup other
than those listed below will be interpreted as a key lookup.
iexact is not listed below – but neither is contains, which is used
directly ''above'' the scary warning as an example of how "You can chain
other lookups after key lookups". (Actually, contains ''is'' listed below,
but it's a different contains that applies only to the field level and not
to a specific key.)
I suspect that the intended meaning is that ''all'' lookups are supported
after a key lookup, and that the ''first'' lookup on the hstore field must
be a key or one of the special lookups listed below.
JSONField does not mention being able to chain lookups after key lookups
at all - but I can see people using gt and in
[http://www.lexev.org/en/2015/trying-json-combo-django-and-postgresql/ in
blog posts like this]. BUT iexact lookups
[https://code.djangoproject.com/ticket/27693 don't currently work] on
JSONField.
--
Ticket URL: <https://code.djangoproject.com/ticket/27694>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:1>
Comment (by felixxm):
`JSONField`-part of this ticket is fixed as a part of
[https://github.com/django/django/pull/12392 PR].
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:2>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"6789ded0a6ab797f0dcdfa6ad5d1cfa46e23abcd" 6789ded0]:
{{{
#!CommitTicketReference repository=""
revision="6789ded0a6ab797f0dcdfa6ad5d1cfa46e23abcd"
Fixed #12990, Refs #27694 -- Added JSONField model field.
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.
Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.
Co-authored-by: Mariusz Felisiak <felisiak...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:3>
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:4>
* owner: nobody => cammil
* status: new => assigned
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/14367 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:5>
* owner: cammil => (none)
* status: assigned => new
* has_patch: 1 => 0
Comment:
Jacob, this patch has nothing to do with the `HStore` docs.
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:6>
Comment (by cammil):
Yeh. Not sure what that PR has to do with this ticket. Seems completely
unrelated to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:7>
Comment (by Jacob Walls):
Thanks, I've asked the author of the unrelated patch to update the ticket
number he referenced. Sorry for the noise (and for not reading the patch
before linking here).
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:8>
Comment (by Sarah Abderemane):
I'd be happy to help on this issue but HStore is new for me, {{{iexact}}}
on HStoreField lookup, it's based on which SQL operator ?
Same as ''contains'' {{{@>}}} but it's with case-insensitive or another
one ?
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:9>
Comment (by Mariusz Felisiak):
Replying to [comment:9 Sarah Abderemane]:
> I'd be happy to help on this issue but HStore is new for me,
{{{iexact}}} on HStoreField lookup, it's based on which SQL operator ?
> Same as ''contains'' {{{@>}}} but it's with case-insensitive or another
one ?
`iexact` and other text-lookups should work on
[https://github.com/django/django/blob/492ed60f236d770eb9a6d56d85ff2550bb1ecfff/django/contrib/postgres/fields/hstore.py#L79-L88
key transforms] on `HStoreField` because it returns `TextField`. Maybe
it's enough to add a similar note to the one about `JSONField`, e.g.:
{{{
.. note::
Key transforms can also be chained with: :lookup:`contains`,
:lookup:`icontains`, :lookup:`endswith`, :lookup:`iendswith`,
:lookup:`iexact`, :lookup:`regex`, :lookup:`iregex`,
:lookup:`startswith`,
and :lookup:`istartswith`.
}}}
This is untested so some tests will also be required.
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:10>
* owner: (none) => Sarah Abderemane
* status: new => assigned
Comment:
Thanks Mariusz, I'll try to see for that
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:11>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/14930 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:12>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"1953dd02b6719ee89fddbc3098d86968d79f3cd7" 1953dd0]:
{{{
#!CommitTicketReference repository=""
revision="1953dd02b6719ee89fddbc3098d86968d79f3cd7"
Refs #27694 -- Doc'd lookups that can be chained with HStoreField key
transforms.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:14>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"533f345c09c935ce0117f52aa124599c52ffa80b" 533f345]:
{{{
#!CommitTicketReference repository=""
revision="533f345c09c935ce0117f52aa124599c52ffa80b"
Refs #27694 -- Added more tests for chaining lookups with HStoreField key
transforms.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"7fa946c76b25ec84752d0ddf6d4afb0cfdc25c93" 7fa946c7]:
{{{
#!CommitTicketReference repository=""
revision="7fa946c76b25ec84752d0ddf6d4afb0cfdc25c93"
[4.0.x] Refs #27694 -- Doc'd lookups that can be chained with HStoreField
key transforms.
Backport of 1953dd02b6719ee89fddbc3098d86968d79f3cd7 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:15>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"51e4dbfeb24d6b3bb1df6a328f8243761dba087a" 51e4dbfe]:
{{{
#!CommitTicketReference repository=""
revision="51e4dbfeb24d6b3bb1df6a328f8243761dba087a"
[3.2.x] Refs #27694 -- Doc'd lookups that can be chained with HStoreField
key transforms.
Backport of 1953dd02b6719ee89fddbc3098d86968d79f3cd7 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:16>
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:17>