Opened 5 years ago

Closed 5 years ago

#30925 closed New feature (invalid)

Missing queryset filter operator leads to extra operator use

Reported by: golways Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Normal Keywords: QuerySet.extra
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by golways)

Hi,

startof / istartof / endof / iendof operators are missing.

In my project, I would need to use something like:

.filter(attr\_\_istartof= myVar)

Since istartof is missing, I do:

.extra(where=["%s ILIKE attr||'%%'"], params=[myVar])

Thanks for your great job with Django !
Regards,
Franck

Change History (2)

comment:1 by golways, 5 years ago

Description: modified (diff)

comment:2 by Simon Charette, 5 years ago

Resolution: invalid
Status: newclosed

You should be able to use __startswith, __endswith end their case insensitive variants for this exact purpose.

https://docs.djangoproject.com/en/2.2/ref/models/querysets/#startswith

Please use support channels before submitting a feature request.

Note: See TracTickets for help on using tickets.
Back to Top