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)
Change History (11)
by , 11 years ago
Attachment: | distance-name.diff added |
---|
comment:1 by , 11 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
Version: | 1.5 → master |
comment:2 by , 11 years ago
Needs documentation: | unset |
---|
comment:3 by , 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 , 11 years ago
No, the proper file to add a test in is django/contrib/gis/tests/distapp/tests.py
.
comment:5 by , 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 , 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 , 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?
Thanks for the proposal. Could you please complete your patch with tests and documentation?