#26641: Unable to concatenate 2 fields when filtering
----------------------------------------------+----------------------------
     Reporter:  FoxPotato                     |      Owner:  nobody
         Type:  Uncategorized                 |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.9
     Severity:  Normal                        |   Keywords:  QuerySet.extra
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+----------------------------
 The docs said I should file a ticket when using the extra API.

 I just need a way to use the icontains field lookup on 2 fields at once,
 for example the full name (first_name + last_name) of a user.

 I managed it using the extra API like this:
 {{{
 User.objects.extra(where=['upper(concat(first_name, " ", last_name)) LIKE
 upper(%s)'], params=[query])
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26641>
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/052.b2d204eafd8cded561515996b274a367%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to