0
を干し草の山、私は私のテンプレートで見たいと思って何は、私は次のモデルを持っている
class NoteIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
topic = indexes.CharField(model_attr='topic')
は次のとおりです。
Search for: <topic>
Results:
<ul>
<topic> <topic.user.username> <topic.user.referral_rcvd.filter(about=topic)
</ul>
シェルで作業するので、これで簡単です。
from haystack.query import SearchQuerySet as SQS
from models import *
s = SQS().models(Note).auto_query('topic_name')
[i.object.user.referral_rcvd.filter(about=i.object.topic).count() for i in s.all()]
しかし、これはHTMLテンプレートでは動作しません:
{% for result in object_list %}
{{ result.object.user.referral_rcvd.filter(about=i.object.topic).count() }}
{% endfor %}
それはシェルで動作する場合、どのように私はそれがテンプレートで作業するのですか?ありがとう!