Opened 11 years ago

Closed 11 years ago

#21096 closed New feature (invalid)

Allow setting of 'distance' attribute name

Reported by: Simon Litchfield Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In a distance query, the attribute name is currently hardcoded at 'distance', which prevents the use of multiple distance measurements (used in routing etc).

Patch attached that accepts the name as an optional arg.

Attachments (2)

distance-name.diff (2.9 KB ) - added by Simon Litchfield 11 years ago.
documentation.diff (1008 bytes ) - added by Luca Marra 11 years ago.
updated method documentation

Download all attachments as: .zip

Change History (11)

by Simon Litchfield, 11 years ago

Attachment: distance-name.diff added

comment:1 by Claude Paroz, 11 years ago

Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 1.5master

Thanks for the proposal. Could you please complete your patch with tests and documentation?

by Luca Marra, 11 years ago

Attachment: documentation.diff added

updated method documentation

comment:2 by Luca Marra, 11 years ago

Needs documentation: unset

comment:3 by anonymous, 11 years ago

I'm currently trying to add a test. I've been looking into the geos/tests/test_geos.py file, where the test_distance() function is defined. Is this the correct file to add a test?

comment:4 by Claude Paroz, 11 years ago

No, the proper file to add a test in is django/contrib/gis/tests/distapp/tests.py.

comment:5 by Susan Tan, 11 years ago

Thanks! In addition, I'm having trouble visualizing the use case for allowing the "distance" attribute to be a different name. What are some specific, concrete use cases?
Knowing the use cases can help me write tests; I'm currently still stumped on how to resolve this ticket in terms of test code logic.

comment:6 by Simon Charette, 11 years ago

Maybe I'm completely off the track here but isn't model_att perfectly suited for the OP's use case?

comment:7 by Claude Paroz, 11 years ago

I think that charettes is not off the track :-) Simon29, can you check if model_att is effectively filling your use case?

comment:8 by Simon Litchfield, 11 years ago

charettes you are right, I completely overlooked model_att. Thanks!

comment:9 by Simon Charette, 11 years ago

Resolution: invalid
Status: newclosed

You're welcome!

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