mirror of
https://github.com/pinry/pinry.git
synced 2025-11-14 00:55:43 +01:00
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.
This commit is contained in:
@@ -15,6 +15,9 @@ class PinResource(ModelResource): # pylint: disable-msg=R0904
|
|||||||
queryset = Pin.objects.all()
|
queryset = Pin.objects.all()
|
||||||
resource_name = 'pin'
|
resource_name = 'pin'
|
||||||
include_resource_uri = False
|
include_resource_uri = False
|
||||||
|
filtering = {
|
||||||
|
'published': ['gt'],
|
||||||
|
}
|
||||||
|
|
||||||
def dehydrate_thumbnail(self, bundle):
|
def dehydrate_thumbnail(self, bundle):
|
||||||
pin = Pin.objects.only('image').get(pk=bundle.data['id'])
|
pin = Pin.objects.only('image').get(pk=bundle.data['id'])
|
||||||
|
|||||||
Reference in New Issue
Block a user