I have discovered the exact same issue.
class Apt(Model):
geo = models.PointField(srid=4326,editable=False,default=Point(0,0))
bldg = models.ForeignKey(Bldg,null=True)
class AptStatus(Model):
apt = models.ForeignKey(Apt)
class DP_5cbc61d6(Model):
apt = models.ForeignKey(Apt)
# works fine of course
Apt.objects.filter(geo__within=box)
# neither foreign key works
AptStatus.objects.filter(apt__geo__within=box)
FieldError: Join on field 'geo' not permitted. Did you misspell 'within' for
the lookup type?
DP_5cbc61d6.objects.filter(apt__geo__within=box)
FieldError: Join on field 'geo' not permitted. Did you misspell 'within' for
the lookup type?
# but curiously this one does work, joining to a nullable foreign key
class Bldg(Model):
geo = models.PointField(srid=4326,editable=False,default=Point(0,0))
Apt.objects.filter(bldg__geo__within=box)
I submitted a ticket.
http://code.djangoproject.com/ticket/14922
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.