27 | | FieldError Traceback (most recent call last) |
28 | | |
29 | | /Users/jbronn/geodjango/<ipython console> in <module>() |
30 | | |
31 | | /Users/jbronn/hg/django/gis/django/db/models/manager.pyc in filter(self, *args, **kwargs) |
32 | | 100 |
33 | | 101 def filter(self, *args, **kwargs): |
34 | | --> 102 return self.get_query_set().filter(*args, **kwargs) |
35 | | 103 |
36 | | 104 def complex_filter(self, *args, **kwargs): |
37 | | |
38 | | /Users/jbronn/hg/django/gis/django/db/models/query.pyc in filter(self, *args, **kwargs) |
39 | | 487 set. |
40 | | 488 """ |
41 | | --> 489 return self._filter_or_exclude(False, *args, **kwargs) |
42 | | 490 |
43 | | 491 def exclude(self, *args, **kwargs): |
44 | | |
45 | | /Users/jbronn/hg/django/gis/django/db/models/query.pyc in _filter_or_exclude(self, negate, *args, **kwargs) |
46 | | 505 clone.query.add_q(~Q(*args, **kwargs)) |
47 | | 506 else: |
48 | | --> 507 clone.query.add_q(Q(*args, **kwargs)) |
49 | | 508 return clone |
50 | | 509 |
51 | | |
52 | | /Users/jbronn/hg/django/gis/django/db/models/sql/query.pyc in add_q(self, q_object, used_aliases) |
53 | | 1246 else: |
54 | | 1247 self.add_filter(child, connector, q_object.negated, |
55 | | -> 1248 can_reuse=used_aliases) |
56 | | 1249 if connector == OR: |
57 | | 1250 # Aliases that were newly added or not used at all need to |
58 | | |
59 | | /Users/jbronn/hg/django/gis/django/db/models/sql/query.pyc in add_filter(self, filter_expr, connector, negate, trim, can_reuse, process_extras) |
60 | | 1121 field, target, opts, join_list, last, extra_filters = self.setup_joins( |
61 | | 1122 parts, opts, alias, True, allow_many, can_reuse=can_reuse, |
62 | | -> 1123 negate=negate, process_extras=process_extras) |
63 | | 1124 except MultiJoin, e: |
64 | | 1125 self.split_exclude(filter_expr, LOOKUP_SEP.join(parts[:e.level]), |
65 | | |
66 | | /Users/jbronn/hg/django/gis/django/db/models/sql/query.pyc in setup_joins(self, names, opts, alias, dupe_multis, allow_many, allow_explicit_fk, can_reuse, negate, process_extras) |
67 | | 1449 |
68 | | 1450 if pos != len(names) - 1: |
69 | | -> 1451 raise FieldError("Join on field %r not permitted." % name) |
70 | | 1452 |
71 | | 1453 return field, target, opts, joins, last, extra_filters |
72 | | |
73 | | FieldError: Join on field 'point' not permitted. |
| 28 | In [23]: qs.query.as_sql() |
| 29 | Out[23]: |
| 30 | (u'SELECT (ST_distance_sphere("tz_texascity"."point",%s)) AS "distance", "tz_city"."id", "tz_city"."name", "tz_city"."point", "tz_texascity"."city_ptr_id", "tz_texascity"."tx_county" FROM "tz_texascity" INNER JOIN "tz_city" ON ("tz_texascity"."city_ptr_id" = "tz_city"."id")', |
| 31 | (<django.contrib.gis.db.backend.postgis.adaptor.PostGISAdaptor object at 0x319b610>,)) |