Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12334 closed (invalid)

GeoQuerySet creates invalid SQL on calls to `__nonzero__` or `__len__`

Reported by: wardi Owned by: nobody
Component: GIS Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


from django.contrib.gis.db import models
from django.contrib.gis.geos import Point

class Location(models.Model):
    point = models.PointField()


causes an exception in the regular django db layer (not the gis one), it looks like the implementation of __nonzero__ and __len__ in QuerySet are not properly overridden by GeoQuerySet.

Change History (3)

comment:1 Changed 6 years ago by wardi

  • Component changed from Uncategorized to GIS
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by jbronn

  • Resolution set to invalid
  • Status changed from new to closed

You forgot:

    objects = models.GeoManager()

See also the GeoManager documentation.

comment:3 Changed 6 years ago by wardi

Thanks jbronn!

The error is a little misleading, though, and the result of user error probably shouldn't be generating invalid SQL.


Note: See TracTickets for help on using tickets.
Back to Top