Changes between Initial Version and Version 2 of Ticket #305
- Timestamp:
- Aug 11, 2005, 11:23:24 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #305 – Description
initial v2 1 1 Using 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 {{{ 3 meta.CharField('name', maxlength = 512) 4 }}} 3 5 4 6 so I create the model fun. Now in python code I do the following: 5 7 6 album = albums.get_object(name__exact = album_name) 8 {{{ 9 album = albums.get_object(name__exact = album_name) 10 }}} 7 11 8 12 Where album was the string "Dungeon Keeper 2" … … 10 14 This died with the error: 11 15 16 {{{ 12 17 File "/usr/local/lib/python2.4/site-packages/django/utils/functional.py", line 3, in _curried 13 18 return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) … … 23 28 24 29 SELECT music_albums.id,music_albums.name,music_albums.simplified_name FROM music_albums WHERE music_albums.name = Dungeon Keeper 2 30 }}} 25 31 26 32 Now if I modified my call to be: 27 28 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 {{{ 34 album = albums.get_object(name__exact = "'%s'" % album_name) 35 }}} 36 it works. (Note the {{{" ' %s ' "}}}) thus quoting the string. I would have thought it would do sql safe quoting of my strings for me?