Opened 3 years ago

Last modified 6 weeks ago

#29049 assigned New feature

Add slicing notation to F expressions

Reported by: Matthew Pava Owned by: Sergey Fedoseev
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: slice F
Cc: Adam (Chainz) Johnson, josh.smeaton@…, Sergey Fedoseev Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

For fields that are string expressions, the slicing notation should utilize database functions Substr, Left, and Right. Those functions could even be deprecated to require the use of slicing notation.

For fields that are iterable expressions, such as ArrayFields or HStoreFields, those could utilize slicing notation in a Pythonic manner.

Change History (15)

comment:1 Changed 3 years ago by Tim Graham

Could you give an example of what the syntax would look like?

comment:2 Changed 3 years ago by Simon Charette

I think this is a reference to 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].

comment:3 Changed 3 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:4 Changed 3 years ago by Adam (Chainz) Johnson

Cc: Adam (Chainz) Johnson added

comment:5 Changed 3 years ago by Priyansh Saxena

Needs documentation: set
Needs tests: set
Owner: changed from nobody to Priyansh Saxena
Status: newassigned

comment:6 Changed 3 years ago by Josh Smeaton

Cc: josh.smeaton@… added

comment:7 Changed 3 years ago by Priyansh Saxena

Has patch: set

comment:8 Changed 2 years ago by Tim Graham

Needs documentation: unset
Needs tests: unset

comment:9 Changed 2 years ago by Carlton Gibson

Patch needs improvement: set

Comments on PR.

comment:10 Changed 16 months ago by Niclas Olofsson

Owner: changed from Priyansh Saxena to Niclas Olofsson

Taking over this since the current asignee hasn't worked on it in a while.

comment:11 Changed 16 months ago by Niclas Olofsson

Patch needs improvement: unset

comment:12 Changed 6 months ago by felixxm

Needs tests: set
Patch needs improvement: set

comment:13 Changed 6 weeks ago by Sergey Fedoseev

Cc: Sergey Fedoseev added

comment:14 Changed 6 weeks ago by Niclas Olofsson

Owner: Niclas Olofsson deleted
Status: assignednew

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.

comment:15 Changed 6 weeks ago by Sergey Fedoseev

Owner: set to Sergey Fedoseev
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top