Permalink
Browse files

fixed a bug in build_filters method

  • Loading branch information...
Alper Kanat
Alper Kanat committed Dec 11, 2013
1 parent 5a8a1b6 commit f03a52fbb8203bd7c50ba5d853c9c4b6673084d3
Showing with 6 additions and 2 deletions.
  1. +6 −2 tastypie_mongodb/resources.py
@@ -5,6 +5,7 @@
from tastypie.bundle import Bundle
from tastypie.resources import Resource
from django.core.exceptions import ObjectDoesNotExist
+from django.http import QueryDict
class MongoDBResource(Resource):
@@ -24,8 +25,11 @@ def get_collection(self):
def apply_filters(self, request, applicable_filters):
return list(map(self.get_object_class(), self.get_collection().find(applicable_filters)))
- def build_filters(self, **kwargs):
- return kwargs
+ def build_filters(self, filters):
+ if isinstance(filters, QueryDict):
+ return filters.dict()
+
+ return filters
def get_object_list(self, request):
bundle = self.build_bundle(request=request)

0 comments on commit f03a52f

Please sign in to comment.