Ticket #3492: postgresql_unicode_extra_fix.patch
File postgresql_unicode_extra_fix.patch, 1.8 KB (added by , 18 years ago) |
---|
-
django/db/backends/postgresql/base.py
40 40 self.charset = charset 41 41 42 42 def execute(self, sql, params=()): 43 return self.cursor.execute(s ql, [smart_basestring(p, self.charset) for p in params])43 return self.cursor.execute(smart_basestring(sql, self.charset), [smart_basestring(p, self.charset) for p in params]) 44 44 45 45 def executemany(self, sql, param_list): 46 46 new_param_list = [tuple([smart_basestring(p, self.charset) for p in params]) for params in param_list] 47 return self.cursor.executemany(s ql, new_param_list)47 return self.cursor.executemany(smart_basestring(sql, self.charset), new_param_list) 48 48 49 49 def __getattr__(self, attr): 50 50 if self.__dict__.has_key(attr): -
tests/modeltests/many_to_one/models.py
154 154 >>> Article.objects.filter(reporter__first_name__exact='John').extra(where=["many_to_one_article__reporter.last_name='Smith'"]) 155 155 [<Article: John's second story>, <Article: This is a test>] 156 156 157 # And should work fine with the unicode that comes out of newforms.Form.clean_data 158 >>> Article.objects.filter(reporter__first_name__exact='John').extra(where=["many_to_one_article__reporter.last_name='%s'" % u'Smith']) 159 [<Article: John's second story>, <Article: This is a test>] 160 157 161 # Find all Articles for the Reporter whose ID is 1. 158 162 # Use direct ID check, pk check, and object comparison 159 163 >>> Article.objects.filter(reporter__id__exact=1)