#29526: Use of QuerySet.extra() when excluding twice a string occurance
-----------------------------------------+--------------------------------
               Reporter:  Manuel Strehl  |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.0
               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              |
-----------------------------------------+--------------------------------
 The documentation told me to open this bug :-)

 My use case for `.extra()` is a query, where I have to filter for a
 certain term but need to exclude objects, where the term appears twice:

     MyModel.object.filter(name__contains=term).extra(where=['name NOT LIKE
 %s'], params=['{}%{}'.format(term, term)])

 One possibility to remove the need for `.extra()` in my case would be, if
 one could opt-out of the `%` escaping in `.filter()` and `.exclude()`:

     ....exclude(name__contains=term+'%'+term, keep_placeholders=True)

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.7aa41bd0b499485f105870fb01432c6a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to