[Django] #29996: QuerySet.extra using contains, startswith on integerfield

2 views
Skip to first unread message

Django

unread,
Nov 28, 2018, 6:53:34 PM11/28/18
to django-...@googlegroups.com
#29996: QuerySet.extra using contains, startswith on integerfield
-----------------------------------------+--------------------------------
Reporter: openafox | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Keywords: QuerySet.extra
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+--------------------------------
Reporting my use as requested in docs
https://docs.djangoproject.com/en/2.1/ref/models/querysets/#extra

Maybe I'm doing something strange?
Ex.
qs = qs.extra(where=["foreignkey_id LIKE %s + '%%'"], params=[param])

--
Ticket URL: <https://code.djangoproject.com/ticket/29996>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 28, 2018, 7:19:22 PM11/28/18
to django-...@googlegroups.com
#29996: QuerySet.extra using contains, startswith on integerfield
-------------------------------------+-------------------------------------
Reporter: openafox | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: invalid

Keywords: QuerySet.extra | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid
* component: Uncategorized => Database layer (models, ORM)


Old description:

> Reporting my use as requested in docs
> https://docs.djangoproject.com/en/2.1/ref/models/querysets/#extra
>
> Maybe I'm doing something strange?
> Ex.
> qs = qs.extra(where=["foreignkey_id LIKE %s + '%%'"], params=[param])

New description:

Maybe I'm doing something strange?
Ex.
`qs = qs.extra(where=["foreignkey_id LIKE %s + '%%'"], params=[param])`

--

Comment:

You can use a
[https://docs.djangoproject.com/en/stable/ref/models/expressions/ query
expression] for that. See TicketClosingReasons/UseSupportChannels to get
help if the documentation isn't enough.

--
Ticket URL: <https://code.djangoproject.com/ticket/29996#comment:1>

Reply all
Reply to author
Forward
0 new messages