Skip to content

Instantly share code, notes, and snippets.

@sunny1304
sunny1304 / searchresource_api.py
Created August 22, 2012 20:26 — forked from MacMaru/searchresource_api.py
Tastypie (non-model) Resource example with a listfield populated with m2m data
class SimpleOwnerAuthorization(Authorization):
'''
Does what it says: filters objects by their owner (user).
'''
def __init__(self, ownerfilter=None, *args, **kwargs):
self.ownerfilter = ownerfilter # the user field i.e. 'person__user'
def is_authorized(self, request, object=None):
return True # for now