title: Django Haystack - A SearchIndex Based on Multiple Models
body: <p>I have some problems by trying to create my SearchIndex with Haystack on Django and I don't know what to do.</p>
  
  <p><strong>Here are my two models</strong>:</p>
  
  <pre><code># Meta: stores meta data about tutorials (category, title)
  class Meta(models.Model):
      """
      Database [tutorial.meta]
      """
      mta_title = models.CharField(max_length=TUTORIAL_TITLE_MAX)
      mta_views = models.PositiveIntegerField(default=0)
  
  
  # Contents: stores the tutorial text content
  class Contents(models.Model):
      """
      Database [tutorial.contents]
      """
      tut_id = IdField()
      cnt_body = BBCodeTextField()
  </code></pre>
  
  <p>Now I want to base my SearchIndex on the 3 following fields: mta_title, mta_views and cnt_body. Here are my current SearchIndex:</p>
  
  <pre><code>from haystack import indexes
  from tutorial.models import Meta as TutorialMeta
  from account.models import Profile as UserProfile
  
  
  class TutorialMetaIndex(indexes.SearchIndex, indexes.Indexable):
      text = indexes.CharField(document=True, use_template=True)
      title = indexes.CharField(model_attr='mta_title')
      views = indexes.CharField(model_attr='mta_views')
      # Haystack reserves the content field names for internal use
      cnt_body = indexes.CharField()
  
      def get_model(self):
          return TutorialMeta
  
      def index_queryset(self, using=None):
          """Used when the entire index for model is updated."""
          return self.get_model().objects.all()
  
      def prepare_cnt_body(self, obj):
          ????
  </code></pre>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/16170537/haystack-one-searchindex-for-multiple-models">on this question</a>, that the answer was to create a prepare_cnt_body. But I don't know what I should return.</p>
  
  <p>Thank you everyone.</p>