old_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  from datetime import datetime
  
  from haystack.indexes import SearchIndex, CharField, DateTimeField
  from haystack import site
  
  from .models import Poll
  
  
  class PollIndex(SearchIndex):
      text = CharField(document=True, use_template=True)
      date_available = DateTimeField(model_attr='date_available')
      date_update = DateTimeField(model_attr='date_update')
  
      def get_updated_field(self):
          return 'date_update'
  
      def index_queryset(self):
          return Poll.objects.filter(
              date_available__lte=datetime.now(),
              published=True)
  
  
  site.register(Poll, PollIndex)
  
new_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  from datetime import datetime
  
  from haystack.indexes import SearchIndex, Indexable, CharField, DateTimeField
  
  from .models import Poll
  
  
  class PollIndex(SearchIndex, Indexable):
      text = CharField(document=True, use_template=True)
      date_available = DateTimeField(model_attr='date_available')
      date_update = DateTimeField(model_attr='date_update')
  
      def get_updated_field(self):
          return 'date_update'
  
      def index_queryset(self):
          return Poll.objects.filter(
              date_available__lte=datetime.now(),
              published=True)
  
subject: update haystack version to 2.0