Changes between Initial Version and Version 2 of Ticket #305


Ignore:
Timestamp:
Aug 11, 2005, 11:23:24 AM (19 years ago)
Author:
Adrian Holovaty
Comment:

(Changed formatting in description)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #305 – Description

    initial v2  
    11Using the postgresql backend I have a model which has "albums" which only has two fields. The important field is:
    2       meta.CharField('name', maxlength = 512)
     2{{{
     3meta.CharField('name', maxlength = 512)
     4}}}
    35
    46so I create the model fun. Now in python code I do the following:
    57
    6    album = albums.get_object(name__exact = album_name)
     8{{{
     9album = albums.get_object(name__exact = album_name)
     10}}}
    711
    812Where album was the string "Dungeon Keeper 2"
     
    1014This died with the error:
    1115
     16{{{
    1217  File "/usr/local/lib/python2.4/site-packages/django/utils/functional.py", line 3, in _curried
    1318    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))
     
    2328
    2429SELECT music_albums.id,music_albums.name,music_albums.simplified_name FROM music_albums WHERE music_albums.name = Dungeon Keeper 2
     30}}}
    2531
    2632Now if I modified my call to be:
    27 
    28    album = albums.get_object(name__exact = "'%s'" % album_name)
    29 
    30 it works. (Note the "   '   %s  '  ") thus quoting the string.  I would have thought it would do sql safe quoting of my strings for me?
     33{{{
     34album = albums.get_object(name__exact = "'%s'" % album_name)
     35}}}
     36it works. (Note the {{{"   '   %s  '  "}}}) thus quoting the string.  I would have thought it would do sql safe quoting of my strings for me?
Back to Top