【发布时间】:2016-08-08 09:48:51
【问题描述】:
以下 lte 和 gte 过滤器查询返回 0 个对象:
curl http://localhost/river/river/?runoff__lte=100.0&runoff__gte=150.0
curl http://localhost/river/river/?runoff__lte=100&runoff__gte=150
http://localhost/river/river/?dt_timestamp__lte=2015-01-01T03:00&dt_timestamp__gte=2015-01-07T18:00&format=json
这里是 models.py
class River(models.Model):
dt_timestamp = models.DateTimeField()
stage = models.DecimalField(max_digits=10, decimal_places=3, blank=True, null=True)
runoff = models.DecimalField(max_digits=10, decimal_places=3)
api.py
class RiverResults(ModelResource):
class Meta:
queryset = River.objects.all()
resource_name = 'river'
authorization = Authorization()
filtering = {
'user': ALL_WITH_RELATIONS,
'dt_timestamp': ALL
'stage': ALL,
'runoff': ALL,
}
在 settings.py USE_TZ = False
正在运行 Postgresql 9.3、Django 1.6 和 Tastypie 0.12.2。 不知道哪里做错了。
问候, 艾伦
【问题讨论】:
标签: python django postgresql tastypie