【发布时间】:2015-07-12 13:25:23
【问题描述】:
我有一个存储用户位置的模型:
[
{
"url": "http://192.168.0.22:8000/status/1/",
"id": 1,
"owner": 1,
"test_info": "",
"created_at": "2015-05-02T07:09:16.535689Z",
"updated_at": "2015-05-02T07:09:16.535746Z",
"geolocation": null,
"jukebox_mode_enabled": false
},
{
"url": "http://192.168.0.22:8000/status/2/",
"id": 2,
"owner": 2,
"test_info": "",
"created_at": "2015-05-02T07:09:24.206959Z",
"updated_at": "2015-05-02T07:09:24.207042Z",
"geolocation": null,
"jukebox_mode_enabled": false
},
我正在尝试实现一个允许用户查询并查看附近还有谁的系统,但出于安全原因,我想将结果限制为 1KM 的用户。
实现这一目标的最佳方法是什么?
P.S - “状态”使用 oneToOneField 与 django 模型中的普通用户模型相关联。
【问题讨论】:
标签: python django geolocation django-rest-framework