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>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to