2

django-haystackで問題が発生しているので、助けが必要です。

プロジェクトのインデックスを作成するサイトを運営していますが、特定のプロジェクトは表示されるべきではない状態にありますstatus='DE'status='PR'

私の現在の設定はです。

from haystack.indexes import *
from haystack import site
from models import Project

class ProjectIndex(RealTimeSearchIndex):
    project_name = CharField(document=True, use_template=True)
    description = CharField(use_template=True, model_attr='description')
    location = CharField(use_template=True, model_attr='location')
    owner = CharField(model_attr='owner')

    def search(self):
        return Project.objects.filter(status='AP').exclude(status='PR').exclude(status='DE')

    def index_queryset(self):
        """Used when the entire index for model is updated."""
        return Project.objects.filter(status='AP').exclude(status='PR').exclude(status='DE')

    def get_queryset(self):
        """Used when the entire index for model is updated."""
        return Project.objects.filter(status='AP').exclude(status='PR').exclude(status='DE')

    def read_queryset(self):
        """Used when the entire index for model is updated."""
        return Project.objects.filter(status='AP').exclude(status='PR').exclude(status='DE')

site.register(Project, ProjectIndex)
4

1 に答える 1

5

1.1から1.2にアップデートすることで、この問題を解決することができました。

それから突然私はこれらを受け取り始めましたCaught VariableDoesNotExist while rendering: Failed lookup for key [object] in u'None'

Googleで検索したところ、特定のアイテムがシステムから消えた可能性があることがわかりました。そのための便利なコマンドがあります。

/usr/bin/python2.6 /www/mysite/manage.py update_index --remove今、私は数時間ごとに次のことを行うcronjobを持っています

于 2011-05-13T06:58:32.853 に答える