매우 이상한 : Pymongo 쿼리 일반적으로,하지만 Mongoengine 쿼리 아무것도 :일반적으로 Pymongo 쿼리하지만 Mongoengine 쿼리 아무것도
class VkWallPostListView(ListView):
model = VkWallPost
context_object_name = "vk_list"
def get_template_names(self):
return ["blog/vk_list.html"]
def get_queryset(self):
wallposts = VkWallPost.objects
if 'all_posts' not in self.request.GET:
#wallposts = wallposts.filter(text='S')
wallposts = VkWallPost._get_collection().find({"text":'S'})
tag = self.request.GET.get('tag', None)
if tag:
wallposts = wallposts.filter(tags=tag)
return wallposts
옵션 wallposts = VkWallPost._get_collection().find({"text":'S'})
객체를 반환하지만, 같은 Mongoengine wallposts = wallposts.filter(text='S')
가 작동하지 않습니다 - 빈 결과, 오류없이! more : 나는 다른 컬렉션에 대한 쿼리와 동일한 클래스를 가지고 있습니다. 거기 엔 몽고 엔진이 정상적으로 작동합니다.
VkWallPost가 사용자의 mongoengine 모델 인 경우 VkWallPost.objects (text = 'S')를 사용하여 객체를 필터링 할 수 있습니다. –
@Rajsubit -이 행을 놓친 것일 수도 있습니다. wallposts = VkWallPost.objects - 정확히 동일한 작업이 이미 완료되었습니다. –