Ticket #6523: 6523.diff
File 6523.diff, 1.5 KB (added by , 16 years ago) |
---|
-
django/db/backends/postgresql/operations.py
35 35 def deferrable_sql(self): 36 36 return " DEFERRABLE INITIALLY DEFERRED" 37 37 38 def lookup_cast(self, lookup_type): 39 if lookup_type in ('iexact', 'contains', 'icontains', 'startswith', 'istartswith', 40 'endswith', 'iendswith'): 41 return "%s::text" 42 return "%s" 43 38 44 def field_cast_sql(self, db_type): 39 45 if db_type == 'inet': 40 46 return 'HOST(%s)' -
tests/modeltests/lookup/models.py
34 34 >>> a7 = Article(headline='Article 7', pub_date=datetime(2005, 7, 27)) 35 35 >>> a7.save() 36 36 37 # text matching tests for PostgreSQL 8.3 38 >>> Article.objects.filter(id__iexact='1') 39 [<Article: Article 1>] 40 >>> Article.objects.filter(pub_date__startswith='2005') 41 [<Article: Article 5>, <Article: Article 6>, <Article: Article 4>, <Article: Article 2>, <Article: Article 3>, <Article: Article 7>, <Article: Article 1>] 42 37 43 # Each QuerySet gets iterator(), which is a generator that "lazily" returns 38 44 # results using database-level iteration. 39 45 >>> for a in Article.objects.iterator():