Fixed example use of deprecated function in GeoDjango tutorial.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15358 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2011-01-29 08:10:20 +00:00
parent fe0a15b6c9
commit 34288ec2f2
1 changed files with 3 additions and 4 deletions

View File

@ -630,14 +630,13 @@ in transformation SQL, allowing the developer to work at a higher level
of abstraction:: of abstraction::
>>> qs = WorldBorders.objects.filter(mpoly__intersects=pnt) >>> qs = WorldBorders.objects.filter(mpoly__intersects=pnt)
>>> qs.query.as_sql() # Generating the SQL >>> print qs.query # Generating the SQL
('SELECT "world_worldborders"."id", "world_worldborders"."name", "world_worldborders"."area", SELECT "world_worldborders"."id", "world_worldborders"."name", "world_worldborders"."area",
"world_worldborders"."pop2005", "world_worldborders"."fips", "world_worldborders"."iso2", "world_worldborders"."pop2005", "world_worldborders"."fips", "world_worldborders"."iso2",
"world_worldborders"."iso3", "world_worldborders"."un", "world_worldborders"."region", "world_worldborders"."iso3", "world_worldborders"."un", "world_worldborders"."region",
"world_worldborders"."subregion", "world_worldborders"."lon", "world_worldborders"."lat", "world_worldborders"."subregion", "world_worldborders"."lon", "world_worldborders"."lat",
"world_worldborders"."mpoly" FROM "world_worldborders" "world_worldborders"."mpoly" FROM "world_worldborders"
WHERE ST_Intersects("world_worldborders"."mpoly", ST_Transform(%s, 4326))', WHERE ST_Intersects("world_worldborders"."mpoly", ST_Transform(%s, 4326))
(<django.contrib.gis.db.backend.postgis.adaptor.PostGISAdaptor object at 0x25641b0>,))
>>> qs # printing evaluates the queryset >>> qs # printing evaluates the queryset
[<WorldBorders: United States>] [<WorldBorders: United States>]