#25843: Ampersands in icontains filter returns inconsistent results
----------------------------------------------+--------------------
Reporter: gadybadger | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
Ampersands in `icontains` filter returns inconsistent results based on if
the ampersand is the last character or not. Replacing the ampersand
character with `&` fixes the issue. The following examples illustrate
the issue, assuming there is one record with `field = 'Fish & Chips'`:
{{{
query1 = 'Fish &'
Model.objects.filter(field__icontains=query1)
# returns a result
query2 = 'Fish & Chips'
Model.objects.filter(field__icontains=query2)
# returns no results
query3 = 'Fish & Chips'
Model.objects.filter(field__icontains=query3)
# returns a result
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25843>
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/053.d067f73f542cb2ae11e81f99c3e1cd6b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.