2016-09-27 3 views
0

私はZinniaのブログアプリケーションとそのアグリゲータとエントリに関連するエラーのポップアップの問題を修正しようとしています。 I上記エントリのDjango Zinniaブログのエラー

def get_authors(context, template='zinnia/tags/authors.html'): 
    """ 
    Return the published authors. 
    """ 

    return {'template': template, 
      'authors': Author.published.all().annotate(
       count_entries_published=Count('entries')), 
      'context_author': context.get('author')} 

がすべての問題の原因とは思いませんが、下の2番目の最後の行にあるすべての大騒ぎを引き起こしている可能性がありますコードは次のとおりです。誰かが提案を持っている場合は、コードを以下に示します。

def get_queryset(self): 
     """ 
     Return a queryset containing published entries. 
     """ 
     now = timezone.now() 
     return super(
      EntryRelatedPublishedManager, self).get_queryset().filter(
      models.Q(entries__start_publication__lte=now) | 
      models.Q(entries__start_publication=None), 
      models.Q(entries__end_publication__gt=now) | 
      models.Q(entries__end_publication=None), 
      entries__status=PUBLISHED, 
      entries__sites=Site.objects.get_current() 
      ).distinct() 

総合的なジニアは印象的なアプリですが、1つのエラーはほとんど役に立たないので、解決策を提案してください。レポの所有者には、すでに多くのユーザーが同じ不平を持っています。エラーはPython2とPYthon3の両方で同じです。

repoはhttps://github.com/Fantomas42/django-blog-zinnia/issuesにあります。

Traceback: 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\core\handlers\exception.py" in inner 
    39.    response = get_response(request) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\core\handlers\base.py" in _legacy_get_response 
    249.    response = self._get_response(request) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\core\handlers\base.py" in _get_response 
    217.     response = self.process_exception_by_middleware(e, request) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\core\handlers\base.py" in _get_response 
    215.     response = response.render() 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\response.py" in render 
    109.    self.content = self.rendered_content 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\response.py" in rendered_content 
    86.   content = template.render(context, self._request) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\backends\django.py" in render 
    66.    return self.template.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render 
    208.      return self._render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in _render 
    199.   return self.nodelist.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render 
    994.     bit = node.render_annotated(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render_annotated 
    961.    return self.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\loader_tags.py" in render 
    174.   return compiled_parent._render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in _render 
    199.   return self.nodelist.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render 
    994.     bit = node.render_annotated(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render_annotated 
    961.    return self.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\loader_tags.py" in render 
    174.   return compiled_parent._render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in _render 
    199.   return self.nodelist.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render 
    994.     bit = node.render_annotated(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render_annotated 
    961.    return self.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\loader_tags.py" in render 
    174.   return compiled_parent._render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in _render 
    199.   return self.nodelist.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render 
    994.     bit = node.render_annotated(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render_annotated 
    961.    return self.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\loader_tags.py" in render 
    70.     result = block.nodelist.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render 
    994.     bit = node.render_annotated(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\base.py" in render_annotated 
    961.    return self.render(context) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\template\library.py" in render 
    225.   _dict = self.func(*resolved_args, **resolved_kwargs) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django_blog_zinnia-0.18-py2.7.egg\zinnia\templatetags\zinnia.py" in get_authors 
    85.    'authors': Author.published.all().annotate(

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\manager.py" in all 
    160.   return self.get_queryset() 

File "C:\Users\Shazia\zinblog\lib\site-packages\django_blog_zinnia-0.18-py2.7.egg\zinnia\managers.py" in get_queryset 
    107.    entries__sites=Site.objects.get_current() 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\query.py" in filter 
    796.   return self._filter_or_exclude(False, *args, **kwargs) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\query.py" in _filter_or_exclude 
    814.    clone.query.add_q(Q(*args, **kwargs)) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\sql\query.py" in add_q 
    1227.   clause, _ = self._add_q(q_object, self.used_aliases) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\sql\query.py" in _add_q 
    1247.      current_negated, allow_joins, split_subq) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\sql\query.py" in _add_q 
    1253.      allow_joins=allow_joins, split_subq=split_subq, 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\sql\query.py" in build_filter 
    1133.   lookups, parts, reffed_expression = self.solve_lookup_type(arg) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\sql\query.py" in solve_lookup_type 
    1019.   _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta()) 

File "C:\Users\Shazia\zinblog\lib\site-packages\django-1.10.1-py2.7.egg\django\db\models\sql\query.py" in names_to_path 
    1327.          "Choices are: %s" % (name, ", ".join(available))) 

Exception Type: FieldError at /weblog/ 
Exception Value: Cannot resolve keyword 'entries' into field. Choices are: comment_comments, comment_flags, date_joined, email, first_name, groups, id, is_active, is_staff, is_superuser, last_login, last_name, logentry, password, user_permissions, username 
+0

'Count( 'entries')'は 'get_authors(**)'の 'Count(entries)'であってはなりませんか? –

+0

エントリは文字列です。正しいプレゼンテーションです –

+0

そして、他のすべてのエンティティ 'entries = item.objects.all()'を検索するのはなぜですか?なぜなら、それは決してそのコンテキストでは使用しないからです。 –

答えて

2

zinniaの後にdjango_commentsをINSTALLED_APPS設定で登録してみてください。

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.admin', 
    'django.contrib.sites', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django.contrib.contenttypes', 
    'mptt', 
    'tagging', 
    'zinnia', 
    'django_comments', 
) 

この解決方法は、repoのオーナーから入手してください。 Githubの問題を確認してください。

+0

どうもありがとうございました...この問題では数日で時間がかかりました。 –

関連する問題