瀏覽代碼

Enable filtering over the published field

Tastypie requires that we define a list of fields that can be used
for filtering; add the "published" to this list so we can query pinry
for the list of images created after some date.
tags/v0.4.0
Krzysztof Klimonda 12 年之前
父節點
當前提交
6fd0c91fd1
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. +3
    -0
      pinry/api/api.py

+ 3
- 0
pinry/api/api.py 查看文件

@@ -15,6 +15,9 @@ class PinResource(ModelResource): # pylint: disable-msg=R0904
queryset = Pin.objects.all()
resource_name = 'pin'
include_resource_uri = False
filtering = {
'published': ['gt'],
}

def dehydrate_thumbnail(self, bundle):
pin = Pin.objects.only('image').get(pk=bundle.data['id'])


Loading…
取消
儲存