For fields that are iterable expressions, such as `ArrayField`s or
`HStoreField`s, those could utilize slicing notation in a Pythonic manner.
--
Ticket URL: <https://code.djangoproject.com/ticket/29049>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Tim Graham):
Could you give an example of what the syntax would look like?
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:1>
Comment (by Simon Charette):
I think this is a reference to [https://groups.google.com/d/msg/django-
developers/PsHDk1doTDg/B8iPrpgFAQAJ my post on the developers mailing
list].
That would be `F('textfield')[0:5]` which would map to `SubStr` and
`F('arrayfield')[0:10]` which would map to PostgreSQL `arrayfield[1:10]`.
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:3>
* cc: Adam (Chainz) Johnson (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:4>
* owner: nobody => Priyansh Saxena
* needs_docs: 0 => 1
* status: new => assigned
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:5>
* cc: josh.smeaton@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:6>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/9670 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:7>
* needs_docs: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:8>
* needs_better_patch: 0 => 1
Comment:
Comments on PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:9>
* owner: Priyansh Saxena => Niclas Olofsson
Comment:
Taking over this since the current asignee hasn't worked on it in a while.
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:10>
* needs_better_patch: 1 => 0
Comment:
New PR: https://github.com/django/django/pull/11208
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:11>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:12>
* cc: Sergey Fedoseev (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:13>
* owner: Niclas Olofsson => (none)
* status: assigned => new
Comment:
Since feedback on the review came 10 months after I submitted the patch,
and it now has been more than a year since it was submitted, it would be
too much of an effort for me to put my mind into this again and get it
into a mergable state.
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:14>
* owner: (none) => Sergey Fedoseev
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:15>
* owner: Sergey Fedoseev => David Smith
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:16>
* cc: Sergey Fedoseev (removed)
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:17>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:18>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:19>
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:20>
* owner: David Smith => Abhinav Yadav
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:21>
Comment (by Abhinav Yadav):
I have been reading up about this issue to continue and finish it off from
where David left it, and I have some doubts. The SQL query left by Felix
[https://github.com/django/django/pull/14731#discussion_r745505740 in this
comment] also doesn't generate any QuerySet or objects. I tried to run
that query using `Manager.raw()`, which generated no results.
Further I investigated the `resolve_expression` method of `SliceableF`
class in `django/db/models/expressions.py`, and compared it to other
implementations of resovle_expression method in other classes but couldn't
find anything concrete which might point to where the error might be.
Does a special method for handling slicing and indexing for OuterRef query
need to be written so it is properly resolved? That is what I'm thinking
because I can't find anything else that is properly handling slicing for
OuterRef Queries, unless I'm missing something.
Also should `None` be used instead of `''` in slice_expression for end if
length is not provided?
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:22>
* needs_better_patch: 1 => 0
Comment:
[https://github.com/django/django/pull/16310 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:23>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:24>
* owner: Abhinav Yadav => Nick Pope
* needs_better_patch: 1 => 0
Comment:
New [https://github.com/django/django/pull/17596 PR] with some fixes.
Hopefully we can finally get this over the line...
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:25>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:26>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"94b6f101f7dc363a8e71593570b17527dbb9f77f" 94b6f10]:
{{{
#!CommitTicketReference repository=""
revision="94b6f101f7dc363a8e71593570b17527dbb9f77f"
Fixed #29049 -- Added slicing notation to F expressions.
Co-authored-by: Priyansh Saxena <askpr...@gmail.com>
Co-authored-by: Niclas Olofsson <n...@niclasolofsson.se>
Co-authored-by: David Smith <smi...@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak...@gmail.com>
Co-authored-by: Abhinav Yadav <abhinav....@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29049#comment:27>