ubiquitousthey
unread,Jan 25, 2011, 10:50:42 PM1/25/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to geodjango
I posted this at the general Django group, and they pointed me here.
I am getting the following error when the queryset tries to generate
the SQL: "'str' object has no attribute 'ewkb'"
Here is what I am doing that causes the problem:
shapes = Shape.objects.filter(geom__bboverlaps=bbx)
shape_info = shape_info.filter(shape__in=shapes)
Models are:
class Shape(models.Model):
…
geom = models.PolygonField()
color = models.IntegerField()
class ShapeInfo(models.Model):
…
name = models.CharField(max_length=25)
shape = models.ForeignKey(Shape)
The code causing the problem seems to be:
if (len(params) == 1 and params[0] == '' and lookup_type ==
'exact'
and
connection.features.interprets_empty_strings_as_nulls):
lookup_type = 'isnull'
value_annot = True
Is this not an appropriate way to use this?
Here is the stacktrace:
/Library/Python/2.6/site-packages/django/db/models/query.py in
_result_iter
self._fill_cache() ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/query.py in
_fill_cache
self._result_cache.append(self._iter.next()) ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/query.py in
iterator
for row in compiler.results_iter(): ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py in
results_iter
for rows in self.execute_sql(MULTI): ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py in
execute_sql
sql, params = self.as_sql() ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py in
as_sql
where, w_params = self.query.where.as_sql(qn=qn,
connection=self.connection) ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/sql/where.py in
as_sql
sql, params = child.as_sql(qn=qn,
connection=connection) ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/sql/where.py in
as_sql
sql, params = self.make_atom(child, qn,
connection) ...
▶ Local vars
/Library/Python/2.6/site-packages/django/db/models/sql/where.py in
make_atom
if (len(params) == 1 and params[0] == '' and lookup_type ==
'exact' ...
▶ Local vars
/Library/Python/2.6/site-packages/django/contrib/gis/db/backends/
postgis/adapter.py in __eq__
return (self.ewkb == other.ewkb) and (self.srid ==
other.srid) ...
▼ Local vars
Variable Value
other
''
self
<django.contrib.gis.db.backends.postgis.adapter.PostGISAdapter object
at 0x10663bf90>