Tuesday, October 29, 2013

Tastypie valid lookups


exact
iexact
contains
icontains
in
gt
gte
lt
lte
startswith
istartswith
endswith
iendswith
range
year
month
day
week_day
isnull
search
regex
iregex

Ex:

class ThemeResource(ModelResource):
class Meta:
allowed_methods = ['get', 'put']
queryset = Theme.objects.all()
resource_name = 'theme'
filtering = {
'name': ['exact', 'icontains'],
'id':('exact'),
}

http://local.test:8000/api/v1/theme/?format=json&name__icontains=agenda

No comments:

Post a Comment