Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#12390 closed (fixed)

distance query doesn't support * operand type

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

Description

Example:

>>>d1 = D(mi=10)
>>>d2 = D(mi=20) 
>>>qs = SouthTexasCity.objects.filter(point__distance_gte=(pnt, 0.5*d1 + 0.5*d2))

It raised:

TypeError: unsupported operand type(s) for *: 'float' and 'Distance'

But obviously it works fine with addition and subtraction. I think it will be nice that

multiplication be implemented as well.

Change History (3)

comment:1 by anonymous, 15 years ago

Mutiplication is supported, but only in right form: d1*0.5 would work. But yes, rmul seem to be forgotten at Distance class.

comment:2 by jbronn, 15 years ago

Resolution: fixed
Status: newclosed

(In [11898]) Fixed #12390 -- Distance and Area objects now support multiplication when they are the right-hand side.

comment:3 by jbronn, 15 years ago

(In [11899]) [1.1.X] Fixed #12390 -- Distance and Area objects now support multiplication when they are the right-hand side.

Backport of r11898 from trunk.

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