wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

Problem in django_tastypie-0.9.15-py2.7 #49

Closed ghost closed 11 years ago

ghost commented 11 years ago

I have the following versions installed: django_tastypie-0.9.15-py2.7 mongoengine-0.8.0RC4-py2.7 pymongo-2.5.1-py2.7 python 2.7.4 Red Hat 4.4.6-4

When I any HTTP GET, I get the following error message: {"error_message": "'QuerySet' object has no attribute '_reset_already_indexed'", "traceback": "Traceback (most recent call last):\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 217, in wrapper\n response = callback(request, _args, *_kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 459, in dispatch_list\n return self.dispatch('list', request, kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 373, in dispatch\n return super(MongoEngineResource, self).dispatch(request_type, request, _kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 491, in dispatch\n response = method(request, _kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 1299, in get_list\n objects = self.obj_get_list(bundle=base_bundle, self.remove_api_resource_names(kwargs))\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2112, in obj_get_list\n objects = self.apply_filters(bundle.request, applicable_filters)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2084, in apply_filters\n return self.get_object_list(request).filter(**applicable_filters)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 309, in get_object_list\n self._reset_collection()\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 301, in _reset_collection\n self._meta.queryset._reset_already_indexed()\n\nAttributeError: 'QuerySet' object has no attribute '_reset_already_indexed'\n"}

One thing I noticed is that, in windows, the using mongoengine if I save collections, I get the following structure, for example. {"_types" : [ "Test" ], "f1" : "Ranjith", "_cls" : "Test" }

But with the above mentioned configuration, I'm just getting: {"f1": "Ranjith"}

Any help is highly appreciated as it's the project demo day.. Thanks

rozza commented 11 years ago

Uninstall mongoengine-0.8.0RC4 and install mongoengine-0.7.10 - that should fix it.

ghost commented 11 years ago

Thanks a ton, rozza. Fixed!!

mitar commented 11 years ago

Vau, thanks @rozza for help here.