#28590: Quotes around filter string omitted in query __str__()
-------------------------------------+-------------------------------------
               Reporter:  Aur Saraf  |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  1.11
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Very low severity, and probably easy pickings:

 In various versions of Django, up to 1.11.5, with sqlite, on Windows:

 {{{
 class M(models.Model):
     field = models.CharField(max_length=10)
 }}}

 {{{
 >>> from bug import models
 >>> print models.M.objects.filter(field='I am a string, look at
 me').query.__str__()
 SELECT "bug_m"."id", "bug_m"."field" FROM "bug_m" WHERE "bug_m"."field" =
 I am a string, look at me
 >>> models.M.objects.filter(field='I am a string, look at me')
 <QuerySet []>
 >>> from django.db import connection
 >>> print connection.queries[-1]['sql']
 SELECT "bug_m"."id", "bug_m"."field" FROM "bug_m" WHERE "bug_m"."field" =
 'I am a string, look at me' LIMIT 21
 }}}

 {{{
 SELECT "bug_m"."id", "bug_m"."field" FROM "bug_m" WHERE "bug_m"."field" =
 I am a string, look at me
 SELECT "bug_m"."id", "bug_m"."field" FROM "bug_m" WHERE "bug_m"."field" =
 'I am a string, look at me' LIMIT 21
 }}}

 {{{
 WHERE "bug_m"."field" = I am a string, look at me
 WHERE "bug_m"."field" = 'I am a string, look at me'
 }}}

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

Reply via email to