Django Haystack在内容类型对象上引发属性错误

时间:2014-05-26 17:14:25

标签: python django django-haystack whoosh

这有点奇怪,因为Xapian中没有出现错误。

我在django-haystack==1.2.7Whoosh==2.4.1。它能够构建索引,但是当我运行搜索时,它的说法是

AttributeError at /search
'NoneType' object has no attribute 'concrete_model'

确切的回溯就在这里

Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "D:\Code\projects\MYPROJ\deploy\..\myapps\pages\views.py" in search
  46.     return SearchView().__call__(request)
File "C:\Python27\lib\site-packages\haystack\views.py" in __call__
  50.         return self.create_response()
File "C:\Python27\lib\site-packages\haystack\views.py" in create_response
  145.         return render_to_response(self.template, context, context_instance=self.context_class(self.request))
File "C:\Python27\lib\site-packages\django\shortcuts\__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "C:\Python27\lib\site-packages\django\template\loader.py" in render_to_string
  176.         return t.render(context_instance)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  140.             return self._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in _render
  134.         return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in _render
  134.         return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in _render
  134.         return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render
  281.                 return nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render
  476.         output = self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  155.         return self.render_template(self.template, context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render_template
  137.         output = template.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  140.             return self._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in _render
  134.         return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render
  185.                         nodelist.append(node.render(context))
File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render
  281.                 return nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render
  281.                 return nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render
  155.         return self.render_template(self.template, context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render_template
  137.         output = template.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  140.             return self._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in _render
  134.         return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render
  281.                 return nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py" in render
  823.                 bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node
  74.             return node.render(context)
File "C:\Python27\lib\site-packages\django\contrib\comments\templatetags\comments.py" in render
  67.         qs = self.get_query_set(context)
File "C:\Python27\lib\site-packages\django\contrib\comments\templatetags\comments.py" in get_query_set
  72.         ctype, object_pk = self.get_target_ctype_pk(context)
File "C:\Python27\lib\site-packages\django\contrib\comments\templatetags\comments.py" in get_target_ctype_pk
  100.             return ContentType.objects.get_for_model(obj), obj.pk
File "C:\Python27\lib\site-packages\django\contrib\contenttypes\models.py" in get_for_model
  32.         opts = self._get_opts(model)
File "C:\Python27\lib\site-packages\django\contrib\contenttypes\models.py" in _get_opts
  20.         return model._meta.concrete_model._meta

Exception Type: AttributeError at /search
Exception Value: 'NoneType' object has no attribute 'concrete_model'

我一直在使用django.contrib.comments(因为django框架版本是1.4.2),异常是在

引发的
{% get_comment_count for entry as comment_count %}

这有点奇怪,因为它不是搜索的一部分!

搜索视图端点返回

SearchView().__call__(request)

我无法弄清楚至少有什么不对,最近发生了什么。 任何新的领导都会非常有帮助

0 个答案:

没有答案