Have you solved this issue? On Wednesday, November 26, 2014 at 7:39:20 PM UTC, Michael Link wrote: > > Skriv inn kode her > > > Hi, > > Much head scratching, wondering if anyone could offer me a helping hand. > > My project uses django 1.7 and django-haystack 2.3.1 > I get the problem below with both the Whoosh and ElasticSearch backends. > > My project contains what I though was a very basic haystack setup. > > hcore/search_indexes.py > > import datetime > from haystack import indexes > from hcore.models import Device > > > class DeviceIndex(indexes.SearchIndex, indexes.Indexable): > text = indexes.CharField(document=True, use_template=True) > hostname = indexes.CharField(indexed=False, stored=True, > model_attr='hostname') > > def get_model(self): > return Device > > def index_queryset(self, using=None): > """Used when the entire index for model is updated.""" > return self.get_model().objects.filter( > last_updated__lte=datetime.datetime.now()) > > webui/urls.py > > from django.conf.urls import patterns, include, url > import haystack > > urlpatterns = patterns('', > url(r'^search/', include('haystack.urls')), > ) > > > webui/templates/search/search.html > > ... > <h3>Results</h3> > > Hits: {{ page.paginator.count }} > <ul> > {% for result in page.object_list %} > <li> > <a href="/blank">{{ result.hostname }}</a> > </li> > {% empty %} > <li>No results found.</li> > {% endfor %} > </ul> > > .. > > The problem that I am facing is that > > {{ result }} is None > and therefore > {{ result.object.some_or_other_field }} is not accessible > and even > {{ result.hostname }} (a stored field) is not accessible > > From the django shell I can query the objects from the index. > python manage.py shell > fPython 2.7.6 (default, Mar 22 2014, 22:59:56) > [GCC 4.8.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole) > >>> from haystack.query import SearchQuerySet > >>> sqs = SearchQuerySet().all() > No handlers could be found for logger "elasticsearch" > >>> len(sqs) > 141 > >>> sqs[0].hostname > u'dcis' > >>> sqs[0].object.uuid > UUID('0dfd418a-5b5a-4b98-8308-949c3950084d') > > If you have any tips as to how I can debug further, then let me know. > > Thanks, > /mike > > > > > > > >
-- You received this message because you are subscribed to the Google Groups "django-haystack" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-haystack+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.